Skip to content

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.

go get gitlab.com/phpboyscout/go/observability

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; a depfootprint_test.go guard forbids go-tool-base, Viper/Cobra, Charm, and the cloud SDKs.
  • Typed values in, providers out. otelcore works from a typed Settings; you own how those are sourced. ResolveSettings merges a shared config with per-signal overrides, so one endpoint serves all three signals with targeted exceptions.
  • Independent signal packages. logs, metrics, and tracing each build their own exporter — a service that only traces never links the log/metric exporters.
  • Graceful env fallback. An empty Endpoint is intentional, not an error: the SDK then reads the standard OTEL_EXPORTER_OTLP_* variables. See the config model.

Where next


Part of the phpboyscout Go toolkit — small, framework-free Go modules extracted from go-tool-base.