Explanation¶
Background and reasoning. Nothing here is needed to get telemetry flowing; all of it is useful when deciding whether this module fits, or when something behaves in a way that looks wrong until you know why.
- Endpoint resolution and the config model: why
otelcoretakes typed values rather than a config container, how shared and per-signal settings merge, and why an empty endpoint is a feature. - What this module does not do: the transports, exporters and conveniences deliberately left out, and the combinations that do not work.
- RED, USE and cardinality: what the
instrumenthelpers measure, where they follow OpenTelemetry rather thantransport-metrics, and how attribute values stay bounded. - Why the OpenTelemetry versions are pinned in lockstep: what the pins protect against, and what they cost.
Four ideas the rest of the documentation assumes¶
Typed values in, providers out. The module does no configuration parsing and no
environment scanning of its own. You resolve a Settings from wherever your
configuration lives; it turns that into a provider. Removing the coupling to a config
framework is the reason the module exists separately at all.
One exporter, three destinations. logs, metrics and tracing each ask
otelcore.Exporter for their own signal, so a collector, a slog logger or a writer
serves all three without the signal packages knowing which it was given.
Recording an error is kept apart from exporting it. Building a provider happens once,
at start-up, and needs the SDK and an exporter. Recording an error happens on every
failure, often inside a library. spanerr therefore lives in its own package and imports
only the OpenTelemetry APIs, so a library that records errors does not put an exporter
into every binary that imports it. It is here at all because go/errors leaves the
OpenTelemetry side of its error contract to this module: the kind, the origin stack and
the hints that the SDK's RecordError cannot see.
An empty endpoint is intentional. It means "fall back to the standard
OTEL_EXPORTER_OTLP_* environment variables", not "misconfigured". It is never treated
as an error, in code or in documentation.