Conversation
|
@JohanEndare We continued here, your review is welcome |
|
@ntsirintanis It looks like your last commit are only pre-commit fixes to Johan's commit, so in this case I would just squash them into one. Perhaps also reword his commit message to exclude the draft/untested comments, we're going to assume that once this gets merged it's tested and out of draft, so no need to refer to that. |
d9e7473 to
150bd02
Compare
mpurnell1
left a comment
There was a problem hiding this comment.
Thank you for migrating this module to Odoo 19! I noticed one small issue while porting this code into our database and thought I would bring it to your attention.
415f716 to
be9ecde
Compare
Kiplangatdan
left a comment
There was a problem hiding this comment.
@ntsirintanis Some complains about the unknown option sentry-xx in the odoo.conf file.
Nothing to do with the module but just Odoo 19.0 being strict with conf file.
|
This PR has the |
So it's going to be in the conf file instead of env variables now? Or was it always so? |
* [ADD] sentry module * [FIX] updated sentry module according to PR comments
- [FIX] sentry: fixes missing `raven` library preventing loading of modules - [FIX] 2to3 script on py file - [FIX] add requirements.txt
sentry: It is not always possible to read commit information from a production environment. In those cases it is useful to be able to set a release version manually. [UPD] Update sentry.pot
[UPD] Update sentry.pot
because OCA/maintainer-tools#459 [UPD] Update sentry.pot
fix OCA/maintainer-tools#459 OCA#1776 (comment) Credits sbidoul [UPD] README.rst
Currently, version 1.17.0 of sentry_sdk is causing the following error:
SentryOption("with_locals", DEFAULT_OPTIONS["with_locals"], None),
KeyError: 'with_locals'.
Where the with_locals key is not found in the dictionary, generating an
error, stopping the installation of the sentry module.
In version 1.17.0 rename 'with_locals' to 'include_local_variables'
getsentry/sentry-python@79e3316
This commit adjust the get_sentry_options() method in
https://github.com/Vauxoo/server-tools/blob/16.0/sentry/const.py file, set the new variable.
Odoo requires urllib3 == 1.26.5 https://github.com/Vauxoo/odoo/blob/e0feda462961ae612cacc36d1a75d56c5594fd22/requirements.txt#L56 sentry-sdk > 1.9.0 required urllib3 >= 1.26.11 https://github.com/getsentry/sentry-python/blob/4f1f782fbedc9adcf1dfcd2092bb328443f09e8c/setup.py#L43 Currently, urllib3 >= 1.26.11 is causing the following error in response.py: ``` Traceback (most recent call last): "/home/odoo/.local/lib/python3.8/site-packages/urllib3/response.py", line 705, in _error_catcher yield File "/home/odoo/.local/lib/python3.8/site-packages/urllib3/response.py", line 830, in _raw_read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) urllib3.exceptions.IncompleteRead: IncompleteRead(1501 bytes read, -827 more expected) ``` On the other hand, sentry 1.9.0 supports urllib3 >= 1.10.0, satisfying odoo requirements. This partially reverts OCA@d7ae024. That was initially introduced to support newer versions of `sentry_sdk`, but won't be required anymore due to this downgrade.
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. NOTE: this commit was cherry-picked from d24f3d7, and includes some changes to test code that was not in the original due to conflicts.
…repository Debian Bullseye is used as base docker image for odoo:15.0
To avoid following error: AttributeError: 'InMemoryTransport' object has no attribute 'options'
Fixes
```
File "/home/odoo/.local/lib/python3.12/site-packages/sentry_sdk/client.py", line 595, in _prepare_event
new_event = before_send(event, hint or {})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/odoo/src/user/oca-server-tools/sentry/hooks.py", line 66, in before_send
if event.setdefault("tags", {})["include_context"]:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
KeyError: 'include_context'
2025-07-08 14:45:45,907 14296 INFO quatra-18-0-development-21441249 sentry_sdk.errors: before send dropped event
```
Error is only logged when running Sentry in debug mode, otherwise events are dropped silently.
be9ecde to
71015b8
Compare
@JohanEndare The latest commit fixes this issue. It's now using a specific The readme is updated. Please test and review. |
|
@JohanEndare If you are happy I can merge |

Preserving commit history for #3489