fix(observability): use ENABLE_OBSERVABILITY as OTel SDK gate
Problem
When the observability stack is disabled, the OTel Collector container is not deployed, but OTEL_EXPORTER_OTLP_ENDPOINT always defaults to http://otel-collector:4318 in docker-compose. This causes Python OPEA services to spam DNS resolution errors every 15 seconds.
Root Cause
Python tracing.py has an early-return guard (if not endpoint_base: return) that should skip SDK init when no collector is deployed. But the docker-compose default means the env var is always set — the guard never triggers.
Fix
Use ENABLE_OBSERVABILITY as the primary gate for OTel SDK initialization:
- docker-compose.yaml: Added ENABLE_OBSERVABILITY to all 5 application services (backend, chatqna, retriever, reranker, dataprep)
- Python tracing.py: New guard when ENABLE_OBSERVABILITY != 1 — SDK no-op
- Node.js tracing.js: Same gate
The OTEL_EXPORTER_OTLP_ENDPOINT check is kept as defense-in-depth.
User Impact
None — preserves the existing single-flag contract: ENABLE_OBSERVABILITY=1 enables everything.
Tests
- Python: 51 passed (2 new tests for ENABLE_OBSERVABILITY gate)
- Node.js: 66 passed (1 new test for ENABLE_OBSERVABILITY gate)