Repository navigation
Python: Avoid duplicate log export when root logger already has an OTel handler - #9897
Open
Dineshsuriya D (droideronline) wants to merge 1 commit into
Open
Dineshsuriya D (droideronline) wants to merge 1 commit into
Dineshsuriya D (droideronline) wants to merge 1 commit into
Conversation
…el handler configure_otel_providers attaches a LoggingHandler to the agent_framework logger. If the application already has an OTel LoggingHandler on the root logger, agent_framework records propagate to it and were exported twice. Skip adding the handler in that case and correct the comment to name the logger it attaches to.
Dineshsuriya D (droideronline)
temporarily deployed
to
github-app-auth
October 30, 2026 17:53 — with
GitHub Actions
Inactive
Dineshsuriya D (droideronline)
requested review from
Darren Cohen (dargilco),
Jose Alvarez (jpalvarezl),
sophia-ramsey and
westey (westey-m)
as code owners
October 30, 2026 17:53
Dineshsuriya D (droideronline)
temporarily deployed
to
github-app-auth
October 30, 2026 17:54 — with
GitHub Actions
Inactive
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
configure_otel_providersattaches an OTelLoggingHandlerto theagent_frameworklogger. When an application also has an OTelLoggingHandleron the root logger (for example to export its own,httpxandazurelogs),agent_frameworkrecords propagate to root and are exported twice. The adjacent comment also said "root logger" while the code attaches toagent_framework.Description & Review Guide
_configure_providers, skip adding the handler when the root logger already has an OTelLoggingHandler, and fix the comment. Added a test covering both the root-handler-present and absent cases.configure_otel_providers. Behavior is unchanged when there is no root OTel handler.Related Issue
Fixes #9896
AI Assistance
AI assistance details: issue analysis, implementation, tests, and this description.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.