fix: make OTLP span export opt-in #175

Merged
rosa merged 2 commits from ops/opt-in-otlp-export into main 2026-08-11 01:42:37 +00:00
Owner

Telemetry init unconditionally built an OTLP batch exporter, so a deploy with no collector got recurring export failures against the implicit localhost:4318 default — effectively requiring a Jaeger/OTLP collector for a plain single-box deployment.

Span export is now opt-in:

  • Config gains an otlp_export_enabled field, populated in from_env from the standard OTEL_EXPORTER_OTLP_ENDPOINT variable (or the traces-specific OTEL_EXPORTER_OTLP_TRACES_ENDPOINT override); per the OpenTelemetry spec, an empty value counts as unset.
  • init_telemetry builds the exporter and tracer provider only when opted in and returns Option<SdkTracerProvider>; the fmt + EnvFilter (VERNIER_LOG) layers are installed in both modes, and shutdown flushes buffered spans only when a provider exists.
  • The dev environment opts in explicitly via mise.toml so spans keep flowing to the compose Jaeger; the README documents the opt-in for operators.

When an endpoint is configured, the exporter path is unchanged from before.

Closes #155

Telemetry init unconditionally built an OTLP batch exporter, so a deploy with no collector got recurring export failures against the implicit `localhost:4318` default — effectively requiring a Jaeger/OTLP collector for a plain single-box deployment. Span export is now opt-in: - `Config` gains an `otlp_export_enabled` field, populated in `from_env` from the standard `OTEL_EXPORTER_OTLP_ENDPOINT` variable (or the traces-specific `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` override); per the OpenTelemetry spec, an empty value counts as unset. - `init_telemetry` builds the exporter and tracer provider only when opted in and returns `Option<SdkTracerProvider>`; the `fmt` + `EnvFilter` (`VERNIER_LOG`) layers are installed in both modes, and shutdown flushes buffered spans only when a provider exists. - The dev environment opts in explicitly via `mise.toml` so spans keep flowing to the compose Jaeger; the README documents the opt-in for operators. When an endpoint is configured, the exporter path is unchanged from before. Closes #155
Telemetry init unconditionally built an OTLP batch exporter, so a deploy
with no collector got recurring export failures against the implicit
localhost:4318 default. Export is now enabled only when the standard
OTEL_EXPORTER_OTLP_ENDPOINT (or the traces-specific override) is set;
otherwise only the fmt/EnvFilter logging layers are installed and there
is nothing to flush on shutdown. The dev environment opts in explicitly
to keep spans flowing to the compose Jaeger.

Closes #155
refactor: rename the endpoint-detection helper to otlp_endpoint_configured
All checks were successful
ci/woodpecker/push/clippy Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
5773c54b81
Distinguishes "an endpoint is named" from the otlp_export_enabled field
it feeds, which states the outcome.
rosa merged commit acecc2cbcd into main 2026-08-11 01:42:37 +00:00
rosa deleted branch ops/opt-in-otlp-export 2026-08-11 01:42:37 +00:00
Sign in to join this conversation.
No description provided.