tracing-opentelemetry: why is SpanBuilder::start
only called in on_close
instead of new_span
?
#2133
-
This is not really a feature request, but more of an attempt to understand the design decisions taken in Am I correct in assuming that this means that |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You are correct that otel's global Cases where you would want |
Beta Was this translation helpful? Give feedback.
-
Thanks for clarifying! |
Beta Was this translation helpful? Give feedback.
You are correct that otel's global
Context
is not used to track current spans as they are instead paired with tracing spans and tracked through the tracing registry. The main reason that an otel span is not started until the associated tracing span ends is to support setting a parent trace id / context after the associated tracing span has been created, which the otel API does not support.Cases where you would want
Context::current().span()
are generally handled via either tracing'sSpan::current()
for setting attributes, andOpenTelemetrySpanExt::context
to read / inject the current context into a client request or otherwise bridge back to otel.