Tracer lifetime
#4060
Replies: 1 comment 1 reply
-
In terms of functionality, both work. This may be a rust specific question though. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I am adding OpenTelemetry instrumentation to a Rust HTTP server. I am seeking clarification about the recommended lifetime of a
Tracer
instance. In particular I am trying to decide between:Tracer
instance (callTracerProvider.tracer
when creating the layer)Tracer
should be acquired for each requestMy understanding is that the first approach is better as this middleware layer represents a single instrumentation scope. I also understand that both ways should work, but I am trying to keep my instrumentation idiomatic.
The documentation for
TracerProvider
currently has the following sentence which clarifies that it usually has the lifetime of the application:Unfortunately the
Tracer
documentation does not have such guidance.What tracer lifetime would you recommend? Instantiate once for the middleware layer, or on each request?
Beta Was this translation helpful? Give feedback.
All reactions