v2/trace: exporting cannot be turned off, so services without a collector log export errors forever
Problem
trace.Config.Endpoint has no "do not export" value. Leaving it empty falls back to localhost:4318 rather than disabling the exporter:
v2/trace/trace.go:44:Default: "" — the SDK honours OTEL_EXPORTER_OTLP_ENDPOINT or falls back to http://localhost:4318v2/trace/env.go:213: an emptyEndpointis filled from the environment, never left unsetv2/tracehas no noop or off path at v2.29.2
So a LabKit v2 service deployed without a collector retries forever. From an Artifact Registry pod:
traces export: Post "https://localhost:4318/v1/traces": dial tcp [::1]:4318: connect: connection refusedrepeating every few seconds for the life of the process.
Two wrinkles:
- The fallback URL is
https, becauseInsecureis only applied whenEndpointis also set. A local collector on plain HTTP is not reachable by the default either. - The errors bypass the structured logger, so they cannot be filtered by level.
Ask
Let a service say "no tracing" without inventing a fake endpoint: treat an unset Endpoint as no exporter, or add an explicit switch.
This matters most for self-managed deployments, where a collector is optional. Surfaced while documenting the Artifact Registry self-managed install (gitlab-org/ops/artifact-registry!921 (merged)).