Extract headers using opentelemetry-http HeaderExtractor #2657
-
Hey you all, I currently try to build an open telemetry tracing middleware. To extract the parent context for spans I am following this example: There you can see how the request.headers() are used to get the parent context. The problem I have is that the request.headers() in my Axum handler are from type axum::http::HeaderMap, but the open telemetry extractor expects the type the http::HeaderMap I am quite new to rust and I am pretty confused at the moment. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hey, it sounds like you are using two different versions of the
|
Beta Was this translation helpful? Give feedback.
-
Hey, thanks for the response. I just checked my Cargo.lock. There are indeed two different versions of the I will try to investigate how to resolve the version conflict. |
Beta Was this translation helpful? Give feedback.
Hey, it sounds like you are using two different versions of the
http
crate at the same time, and getting a type mismatch when trying to useHeaderMap
from both interchangeably.axum::http
is simply a re-export of thehttp
crate as you can see here. As of axum 0.7, that's version 1.x.y of thehttp
crate, before it was version 0.2.x.