[#34] tracing: use atomic.Pointer
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
33445c6810
commit
0c67b8fefa
2 changed files with 3 additions and 3 deletions
|
@ -99,8 +99,8 @@ func Shutdown(ctx context.Context) error {
|
||||||
return flushAndShutdown(ctx)
|
return flushAndShutdown(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getDefaultTracer() *atomic.Value {
|
func getDefaultTracer() *atomic.Pointer[tracerHolder] {
|
||||||
v := &atomic.Value{}
|
v := new(atomic.Pointer[tracerHolder])
|
||||||
v.Store(&tracerHolder{Tracer: trace.NewNoopTracerProvider().Tracer("")})
|
v.Store(&tracerHolder{Tracer: trace.NewNoopTracerProvider().Tracer("")})
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,5 +8,5 @@ import (
|
||||||
|
|
||||||
// StartSpanFromContext creates a span and a context.Context containing the newly-created span.
|
// StartSpanFromContext creates a span and a context.Context containing the newly-created span.
|
||||||
func StartSpanFromContext(ctx context.Context, operationName string, opts ...trace.SpanStartOption) (context.Context, trace.Span) {
|
func StartSpanFromContext(ctx context.Context, operationName string, opts ...trace.SpanStartOption) (context.Context, trace.Span) {
|
||||||
return tracer.Load().(*tracerHolder).Tracer.Start(ctx, operationName, opts...)
|
return tracer.Load().Tracer.Start(ctx, operationName, opts...)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue