-
When marked as not sampledShould I use a method like SpanFromContex().IsValid() in my application to return quickly to reduce the consumption of tracing. My span has only a few additions. All attachments are no more than 15 in total (including Attribute, event, link, resouce) When TraceProvider is not setWhat happens in this case? example |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
this is the default tracer provider. If no configuration has happened, the interface will still be working, but under that noop tracer provider. If you want to check by yourself, you should run your own benchmark tests though. |
Beta Was this translation helpful? Give feedback.
-
opentelemetry-go/trace/trace.go Line 217 in 1f5b159
opentelemetry-go/trace/trace.go Line 285 in 1f5b159
With head-based sampling, you may get non-recording spans. |
Beta Was this translation helpful? Give feedback.
span.SpanContext.IsValid
checks that the current trace and span IDs are valid:opentelemetry-go/trace/trace.go
Line 217 in 1f5b159
span.SpanContext.IsSampled
checks whethere the span state has the sample flag (coming from the propagator):opentelemetry-go/trace/trace.go
Line 285 in 1f5b159
span.IsRecording
returns true if the span is recording (and if it's not finished).A recording span: https://github.com/open-telemetry/opentelemetry-go/blob/main/sdk/trace/span.go#L172
A non-recording span: https://github.com/open-telemetry/opentelemetry-go/blob/main/trace/noop.go#L65
With…