mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2026-06-19 21:45:50 +02:00
use EmptySpanContext function instead of global variable (#86)
This commit is contained in:
@@ -38,11 +38,10 @@ type SpanContext struct {
|
||||
TraceOptions byte
|
||||
}
|
||||
|
||||
var (
|
||||
// INVALID_SPAN_CONTEXT is meant for internal use to return invalid span context during error
|
||||
// conditions.
|
||||
INVALID_SPAN_CONTEXT = SpanContext{}
|
||||
)
|
||||
// EmptySpanContext is meant for internal use to return invalid span context during error conditions.
|
||||
func EmptySpanContext() SpanContext {
|
||||
return SpanContext{}
|
||||
}
|
||||
|
||||
func (sc SpanContext) IsValid() bool {
|
||||
return sc.HasTraceID() && sc.HasSpanID()
|
||||
|
||||
@@ -31,7 +31,7 @@ var _ Span = (*noopSpan)(nil)
|
||||
|
||||
// SpancContext returns an invalid span context.
|
||||
func (noopSpan) SpanContext() core.SpanContext {
|
||||
return core.INVALID_SPAN_CONTEXT
|
||||
return core.EmptySpanContext()
|
||||
}
|
||||
|
||||
// IsRecordingEvents always returns false for noopSpan.
|
||||
|
||||
Reference in New Issue
Block a user