Tracer: Export ContextWithSpan (#73715)

Export ContextWithSpan
This commit is contained in:
Alexander Weaver 2023-08-25 13:48:58 -05:00 committed by GitHub
parent 39077769a8
commit 2245a3d0d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -92,7 +92,7 @@ func (t *FakeSpan) AddEvents(keys []string, values []EventValue) {
} }
} }
func (t *FakeSpan) contextWithSpan(ctx context.Context) context.Context { func (t *FakeSpan) ContextWithSpan(ctx context.Context) context.Context {
return ctx return ctx
} }

View File

@ -128,7 +128,7 @@ type Span interface {
// contextWithSpan returns a context.Context that holds the parent // contextWithSpan returns a context.Context that holds the parent
// context plus a reference to this span. // context plus a reference to this span.
contextWithSpan(ctx context.Context) context.Context ContextWithSpan(ctx context.Context) context.Context
} }
func ProvideService(cfg *setting.Cfg) (Tracer, error) { func ProvideService(cfg *setting.Cfg) (Tracer, error) {
@ -188,7 +188,7 @@ func SpanFromContext(ctx context.Context) Span {
// It is the equivalent of opentracing.ContextWithSpan and trace.ContextWithSpan. // It is the equivalent of opentracing.ContextWithSpan and trace.ContextWithSpan.
func ContextWithSpan(ctx context.Context, span Span) context.Context { func ContextWithSpan(ctx context.Context, span Span) context.Context {
if span != nil { if span != nil {
return span.contextWithSpan(ctx) return span.ContextWithSpan(ctx)
} }
return ctx return ctx
} }
@ -487,7 +487,7 @@ func (s OpentelemetrySpan) AddEvents(keys []string, values []EventValue) {
} }
} }
func (s OpentelemetrySpan) contextWithSpan(ctx context.Context) context.Context { func (s OpentelemetrySpan) ContextWithSpan(ctx context.Context) context.Context {
if s.span != nil { if s.span != nil {
ctx = trace.ContextWithSpan(ctx, s.span) ctx = trace.ContextWithSpan(ctx, s.span)
// Grafana also manages its own separate traceID in the context in addition to what opentracing handles. // Grafana also manages its own separate traceID in the context in addition to what opentracing handles.