How can I get a trace ID from OpenTracing API?

喜你入骨 提交于 2019-12-05 17:41:22

At the moment the OpenTracing API does not expose trace ID. It is being discussed in this issue: https://github.com/opentracing/specification/issues/24

One thing you can do right now is to call tracer.inject(null, Builtin.HTTP_HEADERS, map. It will put all IDs with baggage (SpanContext) into the map. Then you can get ID by its name. However this solution is not vedor neutral.

Other solution is to cast SpanContext into specific implementation and get the IDs by getter (if there is any)

Ben has offered a new way to provide this id. ref: https://github.com/opentracing/specification/issues/24#issuecomment-286261320

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!