mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-16 02:24:06 -08:00
b5c833ca21
* Update go.mod dependencies before release Signed-off-by: Julius Volz <julius.volz@gmail.com> * Add issue for showing query warnings in promtool Signed-off-by: Julius Volz <julius.volz@gmail.com> * Revert json-iterator back to 1.1.6 It produced errors when marshaling Point values with special float values. Signed-off-by: Julius Volz <julius.volz@gmail.com> * Fix expected step values in promtool tests after client_golang update Signed-off-by: Julius Volz <julius.volz@gmail.com> * Update generated protobuf code after proto dep updates Signed-off-by: Julius Volz <julius.volz@gmail.com>
43 lines
1.4 KiB
Go
43 lines
1.4 KiB
Go
package opentracing
|
|
|
|
type registeredTracer struct {
|
|
tracer Tracer
|
|
isRegistered 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 SetGlobalTracer(tracer Tracer) {
|
|
globalTracer = registeredTracer{tracer, 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 GlobalTracer() Tracer {
|
|
return globalTracer.tracer
|
|
}
|
|
|
|
// StartSpan defers to `Tracer.StartSpan`. See `GlobalTracer()`.
|
|
func StartSpan(operationName string, opts ...StartSpanOption) Span {
|
|
return globalTracer.tracer.StartSpan(operationName, opts...)
|
|
}
|
|
|
|
// InitGlobalTracer is deprecated. Please use SetGlobalTracer.
|
|
func InitGlobalTracer(tracer Tracer) {
|
|
SetGlobalTracer(tracer)
|
|
}
|
|
|
|
// IsGlobalTracerRegistered returns a `bool` to indicate if a tracer has been globally registered
|
|
func IsGlobalTracerRegistered() bool {
|
|
return globalTracer.isRegistered
|
|
}
|