Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetGlobalTracer ¶
func GetGlobalTracer[T tracerLike]() T
GetGlobalTracer returns the current global tracer. It is the responsability of the caller to ensure that calling code uses `tracer.Tracer` as generic type.
func SetGlobalTracer ¶
func SetGlobalTracer[T tracerLike](t T)
SetGlobalTracer sets the global tracer to t. It is the responsibility of the caller to ensure that the value is `tracer.Tracer`.
func StoreGlobalTracer ¶ added in v2.1.0
func StoreGlobalTracer[M mockTracerLike, T tracerLike](m M)
StoreGlobalTracer is a helper function to set the global tracer internally without stopping the old one. WARNING: this is used by the civisibilitymocktracer working as a wrapper around the global tracer, hence we don't stop the tracer. DO NOT USE THIS FUNCTION ON NORMAL tracer.Tracer.
Types ¶
type GlobalTracerSnapshot ¶ added in v2.12.0
type GlobalTracerSnapshot[T tracerLike] struct {
// contains filtered or unexported fields
}
GlobalTracerSnapshot identifies one publication, including its interface pointer. Comparing that pointer avoids overwriting a newer publication, even when it happens to contain the same tracer again.
func SnapshotGlobalTracer ¶ added in v2.12.0
func SnapshotGlobalTracer[T tracerLike]() GlobalTracerSnapshot[T]
func (GlobalTracerSnapshot[T]) Replace ¶ added in v2.12.0
func (s GlobalTracerSnapshot[T]) Replace(next T) bool
Replace publishes next only while this snapshot is current. It does not stop the previous tracer: the caller must distinguish adopted from displaced resources and close only the latter, after the publication succeeds.
func (GlobalTracerSnapshot[T]) Tracer ¶ added in v2.12.0
func (s GlobalTracerSnapshot[T]) Tracer() T