Skip to content

Prevent Azure Monitor metrics from leaking into consumer application logs - #155

Merged
ivan-nikalaichanka-4ss merged 2 commits into
masterfrom
ESS-4314
Aug 18, 2026
Merged

Prevent Azure Monitor metrics from leaking into consumer application logs#155
ivan-nikalaichanka-4ss merged 2 commits into
masterfrom
ESS-4314

Conversation

@ivan-nikalaichanka-4ss

@ivan-nikalaichanka-4ss ivan-nikalaichanka-4ss commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

This PR is related to user story ESS-4314

Description

When Application Insights integration is enabled, the client_metric_appinsight logger emits messages that propagate up to the datareservoirio logger and beyond. Since ancestor loggers' levels and filters are not considered during propagation (only handler-level filtering applies), these internal telemetry messages leak into any handler a consuming application has attached to datareservoirio - regardless of the log level the application has configured.

Checklist

  • PR title is descriptive and fit for injection into release notes (see tips below)
  • Correct label(s) are used

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a logging-propagation issue where internal Azure Monitor / Application Insights metric logs from the client metrics logger bubble up into consumer applications’ handlers attached to datareservoirio, even when consumers configure restrictive logger levels.

Changes:

  • Disable logger propagation for the client metrics Application Insights logger when AI integration is enabled.
  • Add inline documentation pointing to Python logging propagation behavior.
Suppressed comments (1)

datareservoirio/client.py:49

  • This change is intended to stop the metric logger from propagating into consumer-installed handlers. There’s no unit test covering that metric().propagate becomes False when Application Insights is enabled, which makes regressions likely (especially since metric() is cached). Consider adding a test that sets ENV_VAR_ENABLE_APP_INSIGHTS, stubs _ensure_azure_monitor_configured/configure_azure_monitor, calls metric(), and asserts logger.propagate is False.
            logger.propagate = False
            logger.setLevel(logging.DEBUG)
            _ensure_azure_monitor_configured(
                connection_string=environment._application_insight_connectionstring,
                logger_name=__name__ + "_metric_appinsight",

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread datareservoirio/client.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@ivan-nikalaichanka-4ss
ivan-nikalaichanka-4ss merged commit a0efedd into master Aug 18, 2026
12 checks passed
@ivan-nikalaichanka-4ss
ivan-nikalaichanka-4ss deleted the ESS-4314 branch August 18, 2026 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Development

Successfully merging this pull request may close these issues.

3 participants