Search code examples
djangojaeger

Jaeger traceID in response headers


I'm playing with JaegerTracing in Django using tutorial https://github.com/contino/jaeger-django-docker-tutorial. Now I don't know how to take out traceId from response headers because it's not there.

When finding traces in Jaeger UI it returns response with data (see also screenshot below):

{
    "data": [{
        "traceID": "885bef8bbc18649c",
        "spans": [{
            "traceID": "885bef8bbc18649c",
            "spanID": "cc4a59c2161aa05d",
            "flags": 1,
            "operationName": "test",
            "references": [],
            "startTime": 1576579367614065,
            "duration": 430,
            "tags": [{
                "key": "sampler.type",
                "type": "string",
                "value": "const"
            }, {
                "key": "sampler.param",
                "type": "bool",
                "value": true
            }, {
                "key": "component",
                "type": "string",
                "value": "django"
            }, {
                "key": "span.kind",
                "type": "string",
                "value": "server"
            }, {
                "key": "http.method",
                "type": "string",
                "value": "GET"
            }, {
                "key": "http.url",
                "type": "string",
                "value": "/polls/test/"
            }, {
                "key": "path",
                "type": "string",
                "value": "/polls/test/"
            }, {
                "key": "method",
                "type": "string",
                "value": "GET"
            }, {
                "key": "http.status_code",
                "type": "int64",
                "value": 200
            }],
            "logs": [],
            "processID": "p1",
            "warnings": null
        }],
        "processes": {
            "p1": {
                "serviceName": "polls_app",
                "tags": [{
                    "key": "hostname",
                    "type": "string",
                    "value": "12625857e878"
                }, {
                    "key": "ip",
                    "type": "string",
                    "value": "172.23.0.3"
                }, {
                    "key": "jaeger.version",
                    "type": "string",
                    "value": "Python-3.13.1.dev0"
                }]
            }
        },
        "warnings": null
    }],
    "total": 0,
    "limit": 0,
    "offset": 0,
    "errors": null
}

enter image description here

I suspected it in response headers but it is not.

How can I do this?


Solution

  • Found out how. I just added one single line of code into tracing.py of django_opentracing lib:

    enter image description here

    And the result:

    enter image description here