You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was playing with tracing and OpenTelemetry and I was noticing that under some conditions, my test applications were not sending traces at all.
Looking at one of the examples, I saw opentelemetry::global::shutdown_tracer_provider(). Adding this at the end of my program made things work reliably (apparently!).
I think this is related to very short programs that run quickly. Somehow accumulated traces are lost on exit.
Proposal
While this is documented in the opentelemetry crate, and I found it in the examples, I think users of this crate would appreciate some nudging towards this.
Alternatives
Or perhaps, the shutdown can happen automatically? That would be even better.
The text was updated successfully, but these errors were encountered:
In my case, it's quite the opposite. This call has had no effect whatsoever. The application exits quickly after receiving a SIGINT, and no span is exported—I can clearly sense it. The program must wait for 10 seconds upon exit to ensure the export of spans.
My initialization method is identical to the one provided in the project's example: opentelemetry-otlp.rs.
My operating environment:
docker run -d -p4317:4317 -p16686:16686 jaegertracing/all-in-one:latest
opentelemetry = { version = "0.25", features = ["trace", "metrics"] }
opentelemetry_sdk = { version = "0.25", default-features = false, features = [
"trace",
"rt-tokio",
] }
opentelemetry-stdout = { version = "0.25", features = ["trace", "metrics"] }
opentelemetry-otlp = { version = "0.25", features = ["metrics"] }
opentelemetry-semantic-conventions = "0.25"
tracing-subscriber = { version = "0.3.0", default-features = false, features = [
"registry",
"std",
"fmt",
"chrono",
"env-filter",
"ansi",
"tracing-log",
] }
tracing-opentelemetry = "=0.26.0"
tracing-core = "0.1.28"
If you send a SIGINT and don't handle it, shutdown_tracer_provider is never called so it's somewhat expected the spans weren't exported. Or am I misunderstanding what you were trying to say?
Feature Request
Motivation
I was playing with tracing and OpenTelemetry and I was noticing that under some conditions, my test applications were not sending traces at all.
Looking at one of the examples, I saw
opentelemetry::global::shutdown_tracer_provider()
. Adding this at the end of my program made things work reliably (apparently!).I think this is related to very short programs that run quickly. Somehow accumulated traces are lost on exit.
Proposal
While this is documented in the
opentelemetry
crate, and I found it in the examples, I think users of this crate would appreciate some nudging towards this.Alternatives
Or perhaps, the shutdown can happen automatically? That would be even better.
The text was updated successfully, but these errors were encountered: