Skip to content

Move logger handlers to opentelemetry-instrumentation-logging#4210

Merged
xrmx merged 25 commits intoopen-telemetry:mainfrom
xrmx:move-logger-handlers-to-autoinstrumentation
Mar 3, 2026
Merged

Move logger handlers to opentelemetry-instrumentation-logging#4210
xrmx merged 25 commits intoopen-telemetry:mainfrom
xrmx:move-logger-handlers-to-autoinstrumentation

Conversation

@xrmx
Copy link
Contributor

@xrmx xrmx commented Feb 17, 2026

Description

PR for moving LoggingHandler outside of sdk.

Refs open-telemetry/opentelemetry-python#4330
Fixes open-telemetry/opentelemetry-python#4316

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

  • tox

Does This PR Require a Core Repo Change?

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

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.

Looks nice -- added a couple of questions.

@xrmx xrmx changed the title Move logger handlers to autoinstrumentation Move logger handlers to opentelemetry-instrumentation-logging Feb 20, 2026
@xrmx xrmx force-pushed the move-logger-handlers-to-autoinstrumentation branch from 1002797 to 267f85b Compare February 23, 2026 15:49
@xrmx xrmx marked this pull request as ready for review February 23, 2026 15:49
@xrmx
Copy link
Contributor Author

xrmx commented Feb 23, 2026

Added tests, fixed leaks and a wrong test in the copied sdk tests 😓 Added the removal of the handler on uninstrument() if it was instrumented.

@xrmx xrmx requested a review from pmcollins February 23, 2026 15:52
@xrmx xrmx requested a review from a team as a code owner February 24, 2026 10:35
@xrmx
Copy link
Contributor Author

xrmx commented Feb 25, 2026

Genai examples updated in #4263

Copy link
Contributor

@tammy-baylis-swi tammy-baylis-swi left a comment

Choose a reason for hiding this comment

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

Thanks for all the adjustments. Lgtm

@xrmx xrmx requested a review from emdneto March 2, 2026 08:45
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 -- mostly English tweaks.

@xrmx xrmx force-pushed the move-logger-handlers-to-autoinstrumentation branch from 562fb69 to 5f95328 Compare March 3, 2026 09:09
@xrmx xrmx merged commit 489bca3 into open-telemetry:main Mar 3, 2026
771 checks passed
@github-project-automation github-project-automation bot moved this from Ready for review to Done in Python PR digest Mar 3, 2026
shuningc pushed a commit to shuningc/opentelemetry-python-contrib that referenced this pull request Mar 5, 2026
…elemetry#4210)

* Move logging integrations into auto-instrumentation

* opentelemetry-instrumentation-logging: move the sdk logging handler here

And hook it up via entry point

* Add header and future annotations import

* Rename entry point group to opentelemetry_logging_integrations

* Consider setting up the LoggingHandler as a normal instrumentation

* Fix typo

* Add missing import

* Copy handler tests from core

* More work towards green tests

* Cleanup properly after loggingHandler tests

* Quite hard to expect a mock to setup the handler

* Call removehandler also on local loggers

No change in practice

* Fix wrong noop test

* Move to our own env var for controlling autoinstrumentation

* Copy handler benchmark from sdk

* Document the new environment variables

* Add changelog

* Please pylint

* Added warning about coexistence with sdk code

* Reword a bit

* Assert that the LoggingHandler has not been setup in uninstrumented test

* Add manual handling of auto instrumentation and code attributes logging

* Update instrumentation/opentelemetry-instrumentation-logging/src/opentelemetry/instrumentation/logging/constants.py

* Apply suggestions from code review

Co-authored-by: Pablo Collins <pablo.collins@gmail.com>

* Apply more Pablo feedback

---------

Co-authored-by: Pablo Collins <pablo.collins@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Logs SDK: Logging Handler bridge populates unstable code attributes

5 participants