Documentation ¶
Overview ¶
Package tracing provides tools for working with tracing.
Index ¶
- func FromContext(ctx context.Context) otrace.TracerProvider
- func Initialize(ctx context.Context, config *Config) (otrace.TracerProvider, func(context.Context) error, error)
- func NewContextWithTracerProvider(ctx context.Context, tp otrace.TracerProvider) context.Context
- type CollectorConfig
- type Config
- type WriterConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
func FromContext(ctx context.Context) otrace.TracerProvider
FromContext returns the tracer provider that is attached to the context or returns a noop tracer provider if it does not exist.
func Initialize ¶
func Initialize(ctx context.Context, config *Config) (otrace.TracerProvider, func(context.Context) error, error)
Initialize initializes the tracing package and returns the tracer provider. If tracing is not enabled it returns a noop tracer provider instead.
func NewContextWithTracerProvider ¶
NewContextWithTracerProvider returns a derived context with the tracer provider set.
Types ¶
type CollectorConfig ¶
type CollectorConfig struct { EndpointURL string `name:"endpoint-url" description:"The URL of the collector endpoint"` Insecure bool `name:"insecure" description:"Use insecure connection"` TLS tlsconfig.Client `name:"tls"` }
CollectorConfig represents configuration for the trace collector exporter.
type Config ¶
type Config struct { Enable bool `name:"enable" description:"Enable telemetry"` Exporter string `name:"exporter" description:"Telemetry exporter (otlp, writer)"` CollectorConfig CollectorConfig `name:"collector-config" description:"Trace collector exporter configuration"` WriterConfig WriterConfig `name:"writer-config" description:"Writer exporter configuration"` SampleProbability float64 `` //nolint:lll /* 130-byte string literal not displayed */ }
Config represents configuration for OpenTelemetry tracing.
type WriterConfig ¶
type WriterConfig struct { Destination string `name:"destination" description:"Destination of telemetry writer (stdout, stderr)"` Timestamps bool `name:"timestamps" description:"Print timestamps"` Pretty bool `name:"pretty" description:"Human readable format"` }
WriterConfig represents configuration for the stdout exporter.
Click to show internal directories.
Click to hide internal directories.