-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get opentelemetry trace id from request headers instead of creating a new trace #2376
Comments
Hi @ptanov 👋 Thanks for opening the issue 🙌 Gotcha, I think this is a solid motivation. I might find some time to implement it. But could you help me a bit on the road with understanding the traceparent header. So a request comes in with a header named |
@ErikKaum yeah essentially, most frameworks do this automatically and I am surprised the axum opentelemetry integration doesn't just do this automatically. Specifically, you usually check to see if there is an "active trace" before starting a new one, so wherever the integration is starting a new trace/determining if there is an active trace is where you'd probably need to look to see if it even knows about active traces. Ideally, there is some middleware layer that parses out the trace from the header and sets the "active trace" immediately. |
Hi @ErikKaum , Yes, it is exactly as described by @noyoshi - it is usually done automatically by the framework. The format of the content of the header is described here: https://www.w3.org/TR/trace-context/#traceparent-header |
Thank you! One more thing that could be useful to you- usually if trace is not automatically propagated by the framework (e.g. by let extractor = HeaderExtractor(headers);
let propagator = global::get_text_map_propagator(|propagator| propagator.clone());
let span = propagator.extract(&extractor);
let _guard = span.make_current(); assuming that but I couldn't make it work :( Sorry I'm not familiar with TGI codebase nor with rust. I'm testing it by providing |
Thank you @ptanov 🚀 this already helps a lot! |
Hi @ErikKaum, |
Hi @ptanov Sorry for the radio silence, unfortunately it's been very busy lately and I haven't been able to prioritize this 🙁 |
Hi @ErikKaum , 73 ;) |
Thanks @kozistr , |
Big thanks @kozistr 🙌 |
Feature request
Currently a new trace is created per each HTTP request. It would be useful if trace is get (if available) from the request using traceparent header as defined in https://opentelemetry.io/docs/specs/otel/context/api-propagators/#propagators-distribution https://www.w3.org/TR/trace-context/
In this way you will be able to trace the request through microservice invocations.
Motivation
I want to track the request using opentelemetry starting from frontend, backend and then TGI
Your contribution
I don't have enough understanding of TGI code
The text was updated successfully, but these errors were encountered: