Jaeger traceID 响应 headers
Jaeger traceID in response headers
我正在使用教程 https://github.com/contino/jaeger-django-docker-tutorial 在 Django 中使用 JaegerTracing。现在我不知道如何从响应 headers 中取出 traceId,因为它不存在。
在 Jaeger 中找到痕迹时 UI 它 returns 响应数据(另请参见下面的屏幕截图):
{
"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
}
我怀疑是回应headers但不是。
我该怎么做?
找到方法了。我刚刚在 django_opentracing lib:
的 tracing.py 中添加了一行代码
结果:
我正在使用教程 https://github.com/contino/jaeger-django-docker-tutorial 在 Django 中使用 JaegerTracing。现在我不知道如何从响应 headers 中取出 traceId,因为它不存在。
在 Jaeger 中找到痕迹时 UI 它 returns 响应数据(另请参见下面的屏幕截图):
{
"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
}
我怀疑是回应headers但不是。
我该怎么做?
找到方法了。我刚刚在 django_opentracing lib:
的 tracing.py 中添加了一行代码结果: