v0.13.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2020 License: Apache-2.0 Imports: 8 Imported by: 0



Package global provides global providers, propagators and more.



This section is empty.


This section is empty.


func ErrorHandler added in v0.11.0

func ErrorHandler() otel.ErrorHandler

ErrorHandler returns the global ErrorHandler instance. If no ErrorHandler instance has been set (`SetErrorHandler`), the default ErrorHandler which logs errors to STDERR is returned.

func Handle added in v0.7.0

func Handle(err error)

Handle is a convience function for ErrorHandler().Handle(err)

func Meter added in v0.3.0

func Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter

Meter creates an implementation of the Meter interface from the global MeterProvider. The instrumentationName must be the name of the library providing instrumentation. This name may be the same as the instrumented code only if that code provides built-in instrumentation. If the instrumentationName is empty, then a implementation defined default name will be used instead.

This is short for MeterProvider().Meter(name)

func MeterProvider

func MeterProvider() metric.MeterProvider

MeterProvider returns the registered global meter provider. If none is registered then a default meter provider is returned that forwards the Meter interface to the first registered Meter.

Use the meter provider to create a named meter. E.g.

meter := global.MeterProvider().Meter("")


meter := global.Meter("")

func SetErrorHandler added in v0.11.0

func SetErrorHandler(h otel.ErrorHandler)

SetErrorHandler sets the global ErrorHandler to be h.

func SetMeterProvider

func SetMeterProvider(mp metric.MeterProvider)

SetMeterProvider registers `mp` as the global meter provider.

func SetTextMapPropagator added in v0.13.0

func SetTextMapPropagator(propagator otel.TextMapPropagator)

SetTextMapPropagator sets propagator as the global TSetTextMapPropagator.

func SetTracerProvider added in v0.12.0

func SetTracerProvider(tp trace.TracerProvider)

SetTracerProvider registers `tp` as the global trace provider.

func TextMapPropagator added in v0.13.0

func TextMapPropagator() otel.TextMapPropagator

TextMapPropagator returns the global TextMapPropagator. If none has been set, a No-Op TextMapPropagator is returned.

func Tracer added in v0.3.0

func Tracer(name string) trace.Tracer

Tracer creates a named tracer that implements Tracer interface. If the name is an empty string then provider uses default name.

This is short for TracerProvider().Tracer(name)

func TracerProvider added in v0.12.0

func TracerProvider() trace.TracerProvider

TracerProvider returns the registered global trace provider. If none is registered then an instance of NoopTracerProvider is returned.

Use the trace provider to create a named tracer. E.g.

tracer := global.TracerProvider().Tracer("")


tracer := global.Tracer("")


This section is empty.


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL