package
Version:
v1.2.0
Opens a new window with list of versions in this module.
Published: Feb 19, 2026
License: MIT
Opens a new window with license information.
Imports: 16
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
internal/telemetry
Logic overview
The telemetry package configures OpenTelemetry tracing behavior.
- Supports operational trace modes:
off, sampled, errors, detailed.
- Applies sampler strategy based on configured mode and sample ratio.
- Stores active mode globally so dependency clients can omit detailed spans unless
detailed is enabled.
- Registers a global tracer provider.
- Optionally wires an OTLP/HTTP trace exporter when
OTLPEndpoint is configured.
- Exposes shutdown hook for graceful provider flush/cleanup.
API reference
Types
Config: telemetry config input (Enabled, ServiceName, OTLPEndpoint, TraceMode, TraceSampleRatio).
Runtime: initialized telemetry runtime (TracerProvider, Shutdown).
Functions
Setup(cfg Config) (Runtime, error): initializes global tracing provider and returns runtime handles.
TraceMode() string: returns normalized active trace mode.
ShouldTraceDependencies() bool: returns true only when detailed dependency spans should be emitted.
Documentation
¶
func ShouldTraceDependencies() bool
ShouldTraceDependencies reports if detailed dependency spans should be emitted.
TraceMode reports the configured global trace mode.
Config configures OpenTelemetry tracing setup.
Runtime contains initialized telemetry providers and lifecycle hooks.
Setup initializes global OpenTelemetry tracing according to the provided configuration.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.