observability¶
Hardened OpenTelemetry setup for Go services — build OTLP providers for logs,
metrics, and traces from one typed config, with graceful fallback to the standard
OTEL_EXPORTER_OTLP_* environment variables.
gitlab.com/phpboyscout/go/observability gives a service opinionated OpenTelemetry
wiring without a framework in tow: resolve a typed
Settings
once, then hand it to the logs, metrics, and tracing provider factories. It is
the observability layer extracted from
go-tool-base.
Why¶
- Framework-free, OTel-native. It carries the OpenTelemetry SDK — that is its job
— but nothing else. The only non-OTel dependency is
cockroachdb/errors; adepfootprint_test.goguard forbids go-tool-base, Viper/Cobra, Charm, and the cloud SDKs. - Typed values in, providers out.
otelcoreworks from a typedSettings; you own how those are sourced.ResolveSettingsmerges a shared config with per-signal overrides, so one endpoint serves all three signals with targeted exceptions. - Independent signal packages.
logs,metrics, andtracingeach build their own exporter — a service that only traces never links the log/metric exporters. - Graceful env fallback. An empty
Endpointis intentional, not an error: the SDK then reads the standardOTEL_EXPORTER_OTLP_*variables. See the config model.
What it does not do¶
Worth reading before you go looking for something that is not here. It builds
OTLP/HTTP exporters only — no gRPC, no Prometheus, no stdout. It produces no
telemetry of its own — no HTTP, gRPC, runtime or database instrumentation. It
registers nothing globally, and it does not honour Settings.Enabled,
OTEL_TRACES_SAMPLER or OTEL_METRIC_EXPORT_INTERVAL.
The full list, with the reasoning, is on What this module does not do.
Where next¶
- Getting started — a tracer provider in a dozen lines.
- Export all three signals — traces, metrics and logs to a local collector you can watch.
- How-to guides — wire the signals, correlate logs with traces, diagnose telemetry that never arrives.
- Reference — configuration keys,
provider options and defaults, the
OTEL_*contract, and every error. - Explanation — the config model, the limitations, and the OTel version lockstep.
- API reference — full godoc on pkg.go.dev.
Part of the phpboyscout Go toolkit — small, framework-free Go modules extracted from go-tool-base.
Further reading¶
The blog carries a curated route through this subject: Building a command-line tool in Go collects everything written about it, ordered so you can start at the beginning rather than newest-first.
Ask phpbotscout

He answers questions about the projects over on the Discord, citing the docs where they already cover it, and offering to raise an issue where they don't. Bring a bug, an idea, or a questionable engineering decision.