use EmptySpanContext function instead of global variable (#86)

This commit is contained in:
thinkerou
2019-08-12 10:59:35 -07:00
committed by rghetia
parent 623b062e17
commit 290f108852
4 changed files with 8 additions and 9 deletions
+4 -5
View File
@@ -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()
+1 -1
View File
@@ -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.