Skip to content

Add log handler configuration to autoinstrumentation#4298

Open
JWinermaSplunk wants to merge 8 commits intoopen-telemetry:mainfrom
JWinermaSplunk:log-handler-autoinstrumentation
Open

Add log handler configuration to autoinstrumentation#4298
JWinermaSplunk wants to merge 8 commits intoopen-telemetry:mainfrom
JWinermaSplunk:log-handler-autoinstrumentation

Conversation

@JWinermaSplunk
Copy link

@JWinermaSplunk JWinermaSplunk commented Mar 4, 2026

Description

Add support for OTEL_PYTHON_LOG_HANDLER_LEVEL environment variable to configure log handler level in auto instrumentation.

Fixes open-telemetry/opentelemetry-python#4034

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Added test cases in test_handler.py and test_logging.py

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@JWinermaSplunk JWinermaSplunk marked this pull request as ready for review March 10, 2026 20:29
@JWinermaSplunk JWinermaSplunk requested a review from a team as a code owner March 10, 2026 20:29
@JWinermaSplunk JWinermaSplunk changed the title [WIP] Add log handler configuration to autoinstrumentation Add log handler configuration to autoinstrumentation Mar 10, 2026
Copy link
Member

@pmcollins pmcollins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, thanks for the change. Added a few minor comments.

@JWinermaSplunk JWinermaSplunk force-pushed the log-handler-autoinstrumentation branch from f5d6f30 to 2d0e89c Compare March 10, 2026 23:18
@aabmass aabmass moved this to Ready for review in Python PR digest Mar 12, 2026
@aabmass aabmass requested review from herin049 and pmcollins March 12, 2026 16:07
Copy link
Member

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Copy link
Member

@pmcollins pmcollins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks. Added a doc suggestion.


.. envvar:: OTEL_PYTHON_LOG_HANDLER_LEVEL

Set this env var to configure the log level of the ``LoggingHandler`` installed by this instrumentation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could add more explanation about what it means to set the log level of the logging handler. e.g.

Set this env var to filter which log records are exported by OpenTelemetry. Only records at or above this level will be exported. For example, setting this to warning means DEBUG and INFO logs are still handled by your normal logging setup but are not exported as OTel logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

Allow configuration of LoggingHandler in autoinstrumentation

5 participants