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

minitrace-opentelemetry doesn't work with opentelemetry_zipkin exporter #182

Closed
dotansimha opened this issue Jan 22, 2024 · 3 comments
Closed

Comments

@dotansimha
Copy link
Contributor

Seems like using opentelemetry_otlp works great (https://github.com/tikv/minitrace-rust/tree/master/minitrace-opentelemetry), but when an exporter from opentelemetry_zipkin (https://crates.io/crates/opentelemetry-zipkin) is in use, seems like the global collector expects a tokio runtime to be available, and fails with:

thread 'minitrace-global-collector' panicked at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:250:5:
there is no reactor running, must be called from the context of a Tokio 1.x runtime

This is how I configured the reporter and exporter:

let exporter = opentelemetry_zipkin::new_pipeline()
          .with_service_name(service_name)
          .with_collector_endpoint(endpoint)
          .init_exporter()?;

let reporter = OpenTelemetryReporter::new(exporter,  SpanKind::Server, resource, lib);

I assume it might be related to the fact that

@dotansimha dotansimha changed the title minitrace-opentelemetry doesn't work with opentelemetry_zipkin minitrace-opentelemetry doesn't work with opentelemetry_zipkin exporter Jan 22, 2024
@andylokandy
Copy link
Collaborator

Do you have a tokio runtime initialized when creating the zipkin reporter?

@andylokandy
Copy link
Collaborator

andylokandy commented Jan 23, 2024

opentelemetry community is sort of messy at this moment... while opentelemetry_jaeger must be used in a environment without tokio, opentelemetry_zipkin requires the opposite.. But anyway I do have workaround: make a Reporter wrapper who ensure that a tokio runtimr exists and call inner reporter afterwards.

@dotansimha
Copy link
Contributor Author

Do you have a tokio runtime initialized when creating the zipkin reporter?

I am using actix as web server, and it's a wrapper around tokio, so yeah I do have one.

opentelemetry community is sort of messy at this moment... while opentelemetry_jaeger must be used in a environment without tokio, opentelemetry_zipkin requires the opposite.. But anyway I do have workaround: make a Reporter wrapper who ensure that a tokio runtimr exists and call inner reporter afterwards.

I agree it's kinda it's in a mess, but the recent changes of providing the Runtime to each SpanProcessor kinda makes sense (also related: #179 (comment)).
I can create a processor that uses async runtime, or not.

I prefer the Reporter trait and it's simplicity, and it might be easier to implement a "native" minitrace exporter for Zipkin, instead of using the opentelemetry_rust one.

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