-
Notifications
You must be signed in to change notification settings - Fork 722
Filter duplicate logs out of some logger
's logs that might otherwise endlessly log
#4695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Filter duplicate logs out of some logger
's logs that might otherwise endlessly log
#4695
Conversation
...xporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/_internal/__init__.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
…metry/exporter/otlp/proto/common/_internal/__init__.py Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
...xporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/_internal/__init__.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left comment
@@ -39,6 +39,26 @@ | |||
from opentelemetry.util._once import Once | |||
|
|||
|
|||
class DuplicateFilter(logging.Filter): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't context based suppression the right way to prevent self-logging?
https://github.com/open-telemetry/opentelemetry-python/blob/main/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/export/__init__.py#L546
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want to suppress it entirely.. just stop it from endlessly logging // going into the recursive loop...
Also how does that suppression key work exactly ? I couldn't figure it out, and I'm not sure it covers all the scenarios..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the issue about "telemetry-induced-telemetry", where the act of exporting a telemetry triggers the creation of another telemetry? If yes, contextual suppression would be the best solution from my understanding..
(Sorry I am not familiar with this repo, but working on similar problem in other OTel languages, and found this PR!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently in auto instrumentation any call to the logging
module in python gets picked up the OTLP root logging handler and exported as a OTLP LogRecord. There is an environment variable to disable that behavior entirely: _OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED
But the issue reported that I am fixing is when we internally invoke the logging
module because the logs exporter is down / failed, and that results in an endless stream of logs or a recursive overflow.. I think we do generally want our own internal calling of the logging module to result in an OTLP log export..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we suppress, there won't be any feedback to the user
Description
Filter duplicate logs out of some
logger
's logs on the export logs path that might otherwise endlessly log or cause a recursion depth exceeded issue in cases where logging itself results in an exception.Fixes #4688
Fixes #2701
Fixes #4323
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Unit tests
Does This PR Require a Contrib Repo Change?
Checklist: