Source File
globaltracer.go
Belonging Package
github.com/opentracing/opentracing-go
package opentracingtype registeredTracer struct {tracer TracerisRegistered bool}var (globalTracer = registeredTracer{NoopTracer{}, false})// SetGlobalTracer sets the [singleton] opentracing.Tracer returned by// GlobalTracer(). Those who use GlobalTracer (rather than directly manage an// opentracing.Tracer instance) should call SetGlobalTracer as early as// possible in main(), prior to calling the `StartSpan` global func below.// Prior to calling `SetGlobalTracer`, any Spans started via the `StartSpan`// (etc) globals are noops.func ( Tracer) {globalTracer = registeredTracer{, true}}// GlobalTracer returns the global singleton `Tracer` implementation.// Before `SetGlobalTracer()` is called, the `GlobalTracer()` is a noop// implementation that drops all data handed to it.func () Tracer {return globalTracer.tracer}// StartSpan defers to `Tracer.StartSpan`. See `GlobalTracer()`.func ( string, ...StartSpanOption) Span {return globalTracer.tracer.StartSpan(, ...)}// InitGlobalTracer is deprecated. Please use SetGlobalTracer.func ( Tracer) {SetGlobalTracer()}// IsGlobalTracerRegistered returns a `bool` to indicate if a tracer has been globally registeredfunc () bool {return globalTracer.isRegistered}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |