-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[16.0][FIX] sentry: respect sentry_logging_level (forward-port) #2887
[16.0][FIX] sentry: respect sentry_logging_level (forward-port) #2887
Conversation
Hi @barsi, @fernandahf, @moylop260, @naglis, @versada, |
c4f102f
to
b114338
Compare
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.
Thank you for considering to port this one! (errors seem unrelated and occur on other recent PRs as well)
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.
LGTM, thanks!
Before this fix, the Sentry module sent events for WARNING- level logs, even if sentry_logging_level was registered as "error" or higher. The fix itself is minor: setup of the integration mistakenly set the hardcoded WARNING level to the event handler and the sentry_logging_level to the breadcrumb handler, when they should have been the other way around. The largest part of the diff is a reworking of the tests in order to properly replicate the issue: * The test previously emitted a fake log event directly using the integration's handler's emit-method, which skipped the part of the logic that actually filters based on logging level. This has been changed to use a bespoke NoopHandler and dedicated Logger, so that the tests can emit "actual logs" and test Sentry as accurately as possible. * The tests were not configured to use a non-default logging level, thus making it so that none of them caught the fact we were basically hard-coding the setting to WARNING-level. The tests now set the logging level to ERROR in order to make sure the configuration parameter works when it is non-default. * Changes to configuration (especially ignored loggers) were leaking from one test into others. The tests were directly mutating the `odoo.tools.config.options` mapping, without resetting it afterward, leaving the changes in place for subsequent tests. Introduced a helper method `patch_config` that can be used to patch the config object so that the patch is undone at the end of the test.
Sentry level is error by default and warnings are not captured.
b114338
to
eccff82
Compare
This PR has the |
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.
Tech review! god job, thanks!
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.
Tech review, god job, thanks!
/ocabot merge patch |
Hey, thanks for contributing! Proceeding to merge this for you. |
Congratulations, your PR was merged at df6471c. Thanks a lot for contributing to OCA. ❤️ |
Superseeds #2719