opentracing / opentracing-java

OpenTracing API for Java. ๐Ÿ›‘ This library is DEPRECATED! https://github.com/opentracing/specification/issues/163
http://opentracing.io
Apache License 2.0
1.68k stars 344 forks source link

Can we override traceId by custom uniqueId which we currenty have it across systems ? #272

Closed hyginous29 closed 6 years ago

hyginous29 commented 6 years ago

Hi openTracing team,

Is there an option to override "traceId" by custom uniqueId ?

This would help in using our existing uniqueId to build the trace across apps.

yurishkuro commented 6 years ago

It's not supported or recommended, although I'm sure people hacked around it.

Especially at the level of OpenTracing API we have no idea what format the underlying tracing system uses for trace ID (could be random 128bit, could be UUIDv4, could be hierarchical like MS does), or whether it supports externally provided IDs.

yurishkuro commented 6 years ago

Workaround: you can store the external ID as a tag on the span to correlate later.

hyginous29 commented 6 years ago

Thanks for your response.

If set my existing external ID as Tag, will it be propagated across the services/systems?

Also, can i see the whole trace using above external ID in the Trace UI ?

yurishkuro commented 6 years ago

If set my existing external ID as Tag, will it be propagated across the services/systems?

If you want that external ID propagated, you can save it to baggage instead of the tag.

Also, can i see the whole trace using above external ID in the Trace UI ?

Depending on the tracing backend you may be able to search for spans with the tag with that external ID.

hyginous29 commented 6 years ago

Thank you!

KishoreKaushal commented 5 years ago

@yurishkuro Since, its been one year, I would like to know the status of this issue. Is it officially supported, if not, then any future plans for this? Thank You.

KishoreKaushal commented 5 years ago

If set my existing external ID as Tag, will it be propagated across the services/systems?

If you want that external ID propagated, you can save it to baggage instead of the tag.

Also, can i see the whole trace using above external ID in the Trace UI ?

Depending on the tracing backend you may be able to search for spans with the tag with that external ID.

I tried adding an item in Baggage:

tracer.activeSpan().setBaggageItem("customId" , "12345");

Unfortunately it was not propagated across other spanContext in the same trace.

whiskeysierra commented 5 years ago

adding an item in Baggage setTag

:beetle:

What you want is setBaggageItem.

KishoreKaushal commented 5 years ago

adding an item in Baggage setTag

๐Ÿž

What you want is setBaggageItem.

I am sorry I tried using the setBaggageItem. It's a typo.

whiskeysierra commented 5 years ago

Which implementation are you using?

KishoreKaushal commented 5 years ago

Which implementation are you using?

I am using Jaeger and on top of that java-rabbitmq-client.

I have three services say A, B, and C. A sends a message through a queue to B and then B forwards that message to C through another queue. I wanted a customId to propagated through the complete trace.

whiskeysierra commented 5 years ago

Not sure how jaeger uses rabbitmq to propagate baggage, but their docs suggest this:

Limitation: since HTTP headers donโ€™t preserve the case, Jaeger recommends baggage keys to be lowercase-snake-case, e.g. my-baggage-key-1.

https://www.jaegertracing.io/docs/1.6/client-libraries/#baggage