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.
Where next¶
- Getting started — a tracer provider in a dozen lines.
- Wire OTLP signals — logs, metrics, and traces together, and per-signal overrides.
- Endpoint & config model
— how
Settingsresolves and when the SDK falls back to env vars. - API reference — full godoc on pkg.go.dev.
Part of the phpboyscout Go toolkit — small, framework-free Go modules extracted from go-tool-base.