open-telemetry / open-telemetry/opentelemetry-python-contrib
[instrumentation] write auto-instrumentation loader messages to stderr when OTEL_LOG_LEVEL=debug
@pmcollins is already working on this.
Since May 6, 2026.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 1.1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 16
Description
Write auto-instrumentation debug messages to stderr when OTEL_LOG_LEVEL=debug
What problem do you want to solve?
When Python auto-instrumentation runs, it is hard to tell which instrumentors were loaded. These messages are logged, but they are usually not visible when opentelemetry-instrument runs even though OTEL_LOG_LEVEL=debug may have been set. This is because auto-instrumentation runs from sitecustomize, before the application has had a chance to configure logging.
Writing these messages to stderr would be especially useful in k8s/operator-based deployments, where many instrumentation packages may be present in the auto-instrumentation image and users need to understand what happened at startup.
Expected behavior
When the user explicitly sets OTEL_LOG_LEVEL=debug or OTEL_LOG_LEVEL=trace, auto-instrumentation should write minimal startup messages to stderr.
For example:
DEBUG:opentelemetry.instrumentation.auto_instrumentation._load:Distribution 'distro' will be configured
DEBUG:opentelemetry.instrumentation.auto_instrumentation._load:Instrumented 'requests'
Proposed solution
Write auto-instrumentation startup messages to stderr when auto-instrumentation runs and OTEL_LOG_LEVEL=debug or OTEL_LOG_LEVEL=trace is set. Don't attempt to configure application logging. In the unlikely event that the application has already set up logging and then makes an explicit call to auto_instrumentation.initialize(), suppress this new output channel to prevent double logging.
Would you like to implement a fix?
Yes.
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.