Prevent Azure Monitor metrics from leaking into consumer application logs - #155
Merged
Conversation
bjorn-einar-bjartnes-4ss
previously approved these changes
Aug 17, 2026
There was a problem hiding this comment.
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().propagatebecomesFalsewhen Application Insights is enabled, which makes regressions likely (especially sincemetric()is cached). Consider adding a test that setsENV_VAR_ENABLE_APP_INSIGHTS, stubs_ensure_azure_monitor_configured/configure_azure_monitor, callsmetric(), and assertslogger.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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
bjorn-einar-bjartnes-4ss
approved these changes
Aug 17, 2026
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.
This PR is related to user story ESS-4314
Description
When Application Insights integration is enabled, the
client_metric_appinsightlogger emits messages that propagate up to thedatareservoiriologger 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 todatareservoirio- regardless of the log level the application has configured.Checklist