open-telemetry / open-telemetry/opentelemetry-python

feat(config): add docker-tests e2e for OTEL_CONFIG_FILE plumbing

Open
#5,318 2 comments 0 reactions 1 assignee View on GitHub

@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:

  1. Reuses the existing OTLP collector container from docker-compose.yml.
  2. Writes a minimal declarative config YAML pointing the OTLP span exporter at the collector endpoint.
  3. Launches a Python process with OTEL_CONFIG_FILE=/path/to/that.yaml (and no other OTEL_* vars), instantiates _OTelSDKConfigurator(), emits a span via the global tracer, and shuts down.
  4. Asserts the collector received the expected span.

This proves the chain: env-var detection → load_config_file → schema validation → _dict_to_dataclassconfigure_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_FILE unset + OTEL_TRACES_EXPORTER=otlp still 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.