open-telemetry / open-telemetry/opentelemetry-python-contrib

[instrumentation] write auto-instrumentation loader messages to stderr when OTEL_LOG_LEVEL=debug

Open
#4,540 0 comments 0 reactions 1 assignee View on GitHub

@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

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.