Skip to content

Python: support enable_message_events parameter in enable_instrumentation (#8412) - #8452

Closed
Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
microsoft:mainfrom
ManoharPaturi:fix/enable-instrumentation-message-events-8412
Closed

Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
microsoft:mainfrom
ManoharPaturi:fix/enable-instrumentation-message-events-8412

Conversation

@ManoharPaturi

Copy link
Copy Markdown
Contributor

Motivation & Context

  1. Why is this change required?
    enable_instrumentation() in agent_framework.observability allowed configuring enable_sensitive_data and force, but did not accept enable_message_events. When using the Microsoft OpenTelemetry Distro (configure_azure_monitor), callers need to configure message event emission without mutating internal settings or relying solely on environment variables.
  2. What problem does it solve?
    As described in [Feature]: Support enable_message_events parameter in enable_instrumentation() to allow Microsoft OTel Distro configuration #8412, configure_azure_monitor in the Microsoft OTel Distro has its own message event collection and can cause duplicate message events unless enable_message_events=False can be explicitly configured.
  3. What scenario does it contribute to?
    Programmatic configuration of message event emission in enable_instrumentation() alongside existing enable_sensitive_data.
  4. If it fixes an open issue, please link to the issue below.
    Closes [Feature]: Support enable_message_events parameter in enable_instrumentation() to allow Microsoft OTel Distro configuration #8412.

Description & Review Guide

  • What are the major changes?
    • Added enable_message_events: bool | None = None keyword argument to enable_instrumentation().
    • When enable_message_events is not None, sets OBSERVABILITY_SETTINGS.enable_message_events = enable_message_events.
    • When None, re-reads ENABLE_MESSAGE_EVENTS from environment (defaulting to True) to handle environment changes after import (e.g. load_dotenv()), aligning with enable_sensitive_data.
    • Added docstrings and unit tests in test_observability.py.
  • What is the impact of these changes?
    • Clean API parity for enable_message_events alongside enable_sensitive_data without breaking changes.
  • What do you want reviewers to focus on?
    • Parameter defaults and behavior alignment with enable_sensitive_data.

Related Issue

Closes #8412

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change.

…tion (microsoft#8412)

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@agent-framework-automation agent-framework-automation Bot added the python Usage: [Issues, PRs], Target: Python label Sep 17, 2026
@eavanvalkenburg

Copy link
Copy Markdown
Member

Closing, this is a duplicate of #8451

This branch was successfully deployed

1 active deployment
github-app-auth — a30e2466 Deployed Sep 17, 2026 by ManoharPaturi via limit_open_prs #1353
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Support enable_message_events parameter in enable_instrumentation() to allow Microsoft OTel Distro configuration

3 participants