Documentation ¶
Overview ¶
Package tracer provides a global OpenTelemetry tracer.
Index ¶
- func Init(opts ...func(*options)) (func(context.Context) error, error)
- func RootedCtx(ctx context.Context, traceID trace.TraceID) context.Context
- func Start(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
- func WithJaeger(addr string) func(*options)
- func WithJaegerOrNoop(jaegerAddr string) func(*options)
- func WithJaegerService(service string) func(*options)
- func WithStdOut(w io.Writer) func(*options)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
Init initialises the global tracer via the option(s) defaulting to a noop tracer. It returns a shutdown function.
func RootedCtx ¶ added in v0.2.0
RootedCtx returns a copy of the parent context containing a tracing span context rooted to the trace ID. All spans started from the context will be rooted to the trace ID.
func Start ¶
func Start(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
Start creates a span and a context.Context containing the newly-created span from the global tracer. See go.opentelemetry.io/otel/trace#Start for more details.
func WithJaeger ¶
func WithJaeger(addr string) func(*options)
WithJaeger returns an option to configure an OpenTelemetry tracing exporter for Jaeger.
func WithJaegerOrNoop ¶
func WithJaegerOrNoop(jaegerAddr string) func(*options)
WithJaegerOrNoop returns an option to configure an OpenTelemetry tracing exporter for Jaeger if the address is not empty, else the default noop tracer is retained.
func WithJaegerService ¶ added in v0.2.0
func WithJaegerService(service string) func(*options)
WithJaegerService returns an option to configure the jaeger service name.
func WithStdOut ¶
WithStdOut returns an option to configure an OpenTelemetry exporter for tracing telemetry to be written to an output destination as JSON.
Types ¶
This section is empty.