diff --git a/noop.go b/noop.go index 0d32f69..5c1ed92 100644 --- a/noop.go +++ b/noop.go @@ -1,6 +1,10 @@ package opentracing -import "github.com/opentracing/opentracing-go/log" +import ( + "context" + + "github.com/opentracing/opentracing-go/log" +) // A NoopTracer is a trivial, minimum overhead implementation of Tracer // for which all operations are no-ops. @@ -48,11 +52,19 @@ func (n noopSpan) LogEvent(event string) {} func (n noopSpan) LogEventWithPayload(event string, payload interface{}) {} func (n noopSpan) Log(data LogData) {} +// noopSpan as SpanExt1 +func (n noopSpan) TracerExt1() TracerExt1 { return defaultNoopTracer } + // StartSpan belongs to the Tracer interface. func (n NoopTracer) StartSpan(operationName string, opts ...StartSpanOption) Span { return defaultNoopSpan } +// StartSpanWithContext belongs to the TracerExt1 interface. +func (n NoopTracer) StartSpanWithContext(ctx context.Context, operationName string, opts ...StartSpanOption) (context.Context, SpanExt1) { + return ContextWithSpan(ctx, defaultNoopSpan), defaultNoopSpan +} + // Inject belongs to the Tracer interface. func (n NoopTracer) Inject(sp SpanContext, format interface{}, carrier interface{}) error { return nil