Skip to content
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

Add api::context::propagation::Carrier implementation for http::header::HeaderMap #114

Closed
swilcox3 opened this issue May 18, 2020 · 3 comments

Comments

@swilcox3
Copy link
Contributor

Hey, I'm loving the direction this is going, I think it's really going to help me with my microservices backend written in tonic. I've already got my individual services reporting to Jaeger, now I'm trying to get context propagation working. tonic exposes a trace_fn that gives you a http::header::HeaderMap. I'm trying to use a B3Propagator to extract the context from the HeaderMap, but Carrier is only implemented for HashMap with &'static str as the key.
Could you make an implementation of Carrier for http::header::HeaderMap please? Because of Rust's rules around implementations, I can't make an implementation of a foreign trait on a foreign type.
Also in general, it seems like Carrier shouldn't be using &'static str, but should instead just be using &str. I can take a stab at a pull request if you like.

@jtescher
Copy link
Member

Hey @swilcox3, moving to &str sounds like a good improvement. A PR there would be appreciated! Also you can see https://github.com/open-telemetry/opentelemetry-rust/tree/master/examples/grpc for a working example of the (currently sub-optimal) tonic usage.

I think adding an impl for http::header::HeaderMap would be good as well, maybe behind a http feature flag?

@swilcox3
Copy link
Contributor Author

swilcox3 commented May 18, 2020 via email

@jtescher
Copy link
Member

jtescher commented Jun 1, 2020

Resolved in #115

@jtescher jtescher closed this as completed Jun 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants