Documentation
¶
Overview ¶
Package telemetry provides contrib OpenTelemetry wiring helpers.
The package keeps tracing and instrumented HTTP client dependencies outside the stable core module. Configure explicit timeouts and exporters in application bootstrap. InitTracing returns an error when tracing is enabled without an OTLP endpoint instead of silently disabling exporter setup.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitTracing ¶
InitTracing initializes OpenTelemetry tracing from the provided config. It is safe to call multiple times; only the first call will take effect.
func WrapHTTPClient ¶
WrapHTTPClient returns a shallow copy of the client using an OTel transport.
func WrapHTTPTransport ¶
func WrapHTTPTransport(base http.RoundTripper) http.RoundTripper
WrapHTTPTransport returns a RoundTripper that propagates trace context.
Types ¶
type TraceConfig ¶
type TraceConfig struct {
Enabled bool
ServiceName string
Endpoint string
Protocol string
Environment string
Sampler string
SamplerArg string
SampleRatio float64
}
TraceConfig holds tracing configuration inputs.
func LoadTraceConfig ¶
func LoadTraceConfig(loader *config.Loader) TraceConfig
LoadTraceConfig loads tracing configuration using the shared config loader.
func TraceConfigFromEnv ¶
func TraceConfigFromEnv() TraceConfig
TraceConfigFromEnv loads tracing configuration from environment variables.