Users/singankit/supress noisy logs#47280
Open
singankit wants to merge 11 commits into
Open
Conversation
Disable azure_sdk instrumentation in opentelemetry distro setup to reduce noise from internal Azure SDK telemetry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Set logging level to WARNING for the Azure Monitor OTel exporter logger to reduce noise alongside the existing HTTP logging policy suppression. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The azure.monitor.opentelemetry.exporter logger suppression must happen after _configure_tracing() to catch child loggers created during setup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…added ones The _NoisyLoggerFilter was only applied to the SDK's own console handler, but use_microsoft_opentelemetry() adds additional handlers to root that bypass our filter. Now we apply the filter to ALL root handlers after tracing setup completes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Setting logger level BEFORE use_microsoft_opentelemetry() ensures the level is already in place when the distro creates handlers and background threads. This matches the behavior of setting it in main.py (which works) without needing NullHandler or propagate=False hacks. Preserves full visibility when user sets log_level=DEBUG. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
resolve_log_level() returns a string like 'INFO', not an int. Use logging.getLevelName() to convert before comparison. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…s from noisy loggers
Remove diagnostic prints and unnecessary post-distro re-application. The distro respects pre-set logger levels, so a single setLevel(WARNING) before _configure_tracing() is sufficient.
The pre-distro setLevel(WARNING) prevents INFO records from being created, making the filter redundant.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates azure-ai-agentserver-core’s observability setup to reduce noisy INFO-level console output by suppressing specific Azure logger names unless the user opts into DEBUG logging.
Changes:
- Introduces a
_SUPPRESSED_LOGGERSlist to centralize “noisy” logger names. - Applies WARNING-level overrides for those loggers (when
log_levelis above DEBUG) before initializing OTel tracing/export.
Comment on lines
+88
to
+92
| # Logger names whose INFO messages are too noisy for the console. | ||
| _SUPPRESSED_LOGGERS = ( | ||
| "azure.monitor.opentelemetry.exporter", | ||
| "azure.core.pipeline.policies.http_logging_policy", | ||
| ) |
Comment on lines
+140
to
+146
| # Suppress noisy loggers by setting their level to WARNING. | ||
| # Must be done BEFORE _configure_tracing() — the distro respects | ||
| # pre-set levels, preventing repetitive "Transmission succeeded" INFO messages. | ||
| # Preserve visibility when user explicitly requests DEBUG. | ||
| if logging.getLevelName(resolved_level) > logging.DEBUG: | ||
| for _noisy in _SUPPRESSED_LOGGERS: | ||
| logging.getLogger(_noisy).setLevel(logging.WARNING) |
|
|
||
| # Suppress the noisy Azure Core HTTP logging policy logger. | ||
| logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(logging.WARNING) | ||
| # Suppress noisy loggers by setting their level to WARNING. |
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.
Description
Please add an informative description that covers that changes made by the pull request and link all relevant issues.
If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines