open-telemetry / open-telemetry/opentelemetry-python
feat(config): add docker-tests e2e for OTEL_CONFIG_FILE plumbing
@herin049 is already working on this.
Since Jul 14, 2026.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 19
Description
Motivation
#5271 wires OTEL_CONFIG_FILE through _OTelSDKConfigurator._configure so the SDK loads and applies a declarative YAML/JSON file when the env var is set. The unit tests in tests/_configuration/test_configurator_file_routing.py cover the routing logic in isolation (mocked _initialize_components, configure_sdk, load_config_file), but nothing exercises the full path against a real running collector.
Picked up from @xrmx's review:
LGTM, what do you think of adding a test in a followup PR (in docker-tests?) to check that the plumbing is working e2e?
Proposed test shape
Add a new subdirectory under tests/opentelemetry-docker-tests/tests/ (alongside otlpexporter/ and opencensus/) that:
- Reuses the existing OTLP collector container from
docker-compose.yml. - Writes a minimal declarative config YAML pointing the OTLP span exporter at the collector endpoint.
- Launches a Python process with
OTEL_CONFIG_FILE=/path/to/that.yaml(and no otherOTEL_*vars), instantiates_OTelSDKConfigurator(), emits a span via the global tracer, and shuts down. - Asserts the collector received the expected span.
This proves the chain: env-var detection → load_config_file → schema validation → _dict_to_dataclass → configure_sdk → per-signal factories → OTLP exporter → wire.
Useful follow-ons in the same suite:
- Same for metric and log signals.
- Negative path: invalid YAML → process exits non-zero with
ConfigurationError. - Env-var fallback:
OTEL_CONFIG_FILEunset +OTEL_TRACES_EXPORTER=otlpstill works (verifies the routing doesn't break the existing env-var path).
Related
- PR #5271 — wires
OTEL_CONFIG_FILE(the change this test covers) - Tracking issue #3631 — declarative config
Refs #3631
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.