Files
plane/docs
Sriram Veeraghanta b6e1f24f7c fix(api/observability): address PR review — leak, fork-safety, bounded shutdown, gate unification
Review fixes for #9419:

- Pin headers on the license telemetry exporter so it can no longer inherit
  OTEL_EXPORTER_OTLP_HEADERS and ship an operator's APM credential to
  telemetry.plane.so. An empty dict is falsy and does not suppress the
  exporters' env fallback, so the value has to be non-empty.
- manage.py: apply --settings before the first plane.* import, which otherwise
  materializes LazySettings from the default module and silently ignored the
  flag (breaking the local runserver entrypoint).
- Defer OTLP exporter creation to worker_process_init on the Celery prefork
  pool; the gRPC channel is created eagerly and is not fork-safe.
- Bound interpreter-exit flushing: shutdown_on_exit=False on both providers plus
  an atexit hook on the existing bounded flush_otel(). With an unreachable
  collector a manage.py command now exits in ~3.5s instead of ~63s.
- Stamp a per-process service.instance.id so gunicorn workers and prefork
  children stop exporting colliding cumulative http.server.* streams.
- Resolve instrumentors lazily and isolate each import, and take
  opentelemetry-instrumentation-httpx[instruments] so a missing httpx cannot
  crash every entrypoint with OTEL_ENABLED=0.
- Add a shared is_otel_active() (enabled AND any endpoint var, signal-specific
  included) used by setup, both settings modules and celery, so the log schema
  never changes in a process that exports nothing.
- Emit the boot banner through an explicit stderr handler and name the
  observability loggers in LOGGING so disable_existing_loggers stops silencing
  export errors.
- Strip whitespace in _protocol(); treat blank env values as unset so compose's
  ${VAR:-} interpolation no longer defeats the sampler defaults.
- Deployments: give migrator the OTel env, spell out the sampler defaults, and
  ship OTEL_ENABLED commented out on AIO, where plane.env is exported after
  container env and clobbered it.
- Docs: correct the emitted-metrics list, the log-schema gate, and the filelog
  pipeline (Docker envelope needs a second json_parser; trace context needs
  trace_parser, not move).
- Tests: fix the conftest env leak (monkeypatch.delenv, delete-only teardown)
  and cover the new gating, defaults, deferred providers and logging config.

Claude-Session: https://claude.ai/code/session_01BpGkdpVLNQ3Ziqcd6zK2qV
2026-08-30 11:50:21 +05:30
..