observability¶
OpenTelemetry providers for Go services. Build OTLP providers for logs, metrics
and traces from one typed config, with validated endpoints and a fallback to the
standard OTEL_EXPORTER_OTLP_* environment variables.
gitlab.com/phpboyscout/go/observability sets up OpenTelemetry export for a service
without bringing a framework along. 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, because that is
its job. Apart from the OpenTelemetry modules, the only module it imports is
go/errors, and adepfootprint_test.goguard forbids go-tool-base, Viper, Cobra, pflag, Charm and the AWS, GCP and Azure 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,metricsandtracingeach build their own exporter, so a service that only traces never links the log or metric exporters. - 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, so there is 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, a set of small, framework-free Go modules extracted from go-tool-base.
Further reading¶
The blog collects its posts on this subject under the Observability tag. For a guided start, Add OpenTelemetry traces, metrics and logs to a Go service wires these providers into a running service, as part of the Building a web service in Go route.
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.