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

the trait bound tonic::metadata::MetadataMap: opentelemetry::propagation::Extractor is not satisfied #430

Closed
smhmayboudi opened this issue Jan 17, 2021 · 3 comments

Comments

@smhmayboudi
Copy link

Thanks in advance for all your efforts. I update my project from tonic 0.3.1 to 0.4.0. However, I am receiving an error. Is this related to your crate since you are using the old version of tonic?

    #[tracing::instrument(fields(otel.kind = "server"))]
    async fn delete(&self, request: Request<AtDeleteReqDto>) -> Result<Response<AtResDto>, Status> {
        let parent_context = opentelemetry::global::get_text_map_propagator(|propagator| {
            propagator.extract(request.metadata())
        });
        let span = tracing::Span::current();
        span.set_parent(parent_context);
        let req = request.get_ref();
        let res = self.service.delete(req).await?;
        Ok(Response::new(res))
    }

Error

the trait bound `tonic::metadata::MetadataMap: opentelemetry::propagation::Extractor` is not satisfied

the trait `opentelemetry::propagation::Extractor` is not implemented for `tonic::metadata::MetadataMap`

note: required for the cast to the object type `dyn opentelemetry::propagation::Extractor`rustc(E0277)
@djc
Copy link
Contributor

djc commented Jan 17, 2021

Yes, opentelemetry doesn't yet support tonic 0.4. In fact, in #414 I've removed support for tonic directly from the opentelemetry crate. You can look at the diff for the commit to see how to add back the (fairly trivial) impls to make it work again. If there's enough demand, I suppose we could release a separate crate with tonic support that includes these impls.

@smhmayboudi
Copy link
Author

So are you going to remove features = ["tonic"] from opentelemetry crate as well.

@djc
Copy link
Contributor

djc commented Jan 17, 2021

Yes, it has been removed from the master branch.

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