0

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?

  • 1
    Usually the OpenTracing instrumentation does not send additional headers in the response, because for correlating events it's enough to only send headers forward in the requests. However, it *has* been the topic of discussion of the last W3C Trace Context working group face-to-face meeting in Seattle. It is not clear from your question what you're trying to achieve by response headers. – Yuri Shkuro Dec 17 '19 at 18:42
  • I'd like to have an access to certain request logs via trace id. Thanks for your answer. – Альберт Александров Dec 18 '19 at 08:59

1 Answers1

0

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