Commit Graph

11 Commits (ff6bb4ee2192532c04a48e7d753130f5705ed032)

Author SHA1 Message Date
Atte Isopuro 20270d0248 [FIX] sentry: respect sentry_logging_level
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 d24f3d77a3,
and includes some changes to test code that was not in the original due
to conflicts.
2024-05-13 12:22:13 +03:00
Deivis Laya cef05e13f0 [FIX] sentry: downgrade sentry-sdk to compatible version
Odoo requires urllib3 == 1.26.5
e0feda4629/requirements.txt (L56)

sentry-sdk > 1.9.0 required urllib3 >= 1.26.11
4f1f782fbe/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
d7ae024951.
That was initially introduced to support newer versions of `sentry_sdk`, but won't be required anymore
due to this downgrade.
2024-05-13 12:22:13 +03:00
Deivis Laya 7374723986 [FIX] sentry: change with_locals to include_local_variables variable
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'
79e33169aa

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.
2024-05-13 12:22:13 +03:00
Florian Mounier 7d82a46c52 [FIX] sentry: warn about sentry_transport only if it is specified in config 2024-05-13 12:22:13 +03:00
Florian Mounier 47f44c9d1a [FIX] sentry: Coerce numerical config values 2024-05-13 12:22:13 +03:00
Fernanda Hernandez f176b8bd9d [IMP] sentry: migrate sentry-raven to new api sentry-sdk 2024-05-13 12:22:13 +03:00
Ivan 4f78f32bba [IMP] sentry: black, isort 2024-05-13 12:22:13 +03:00
Simone Orsi 6681cab825 Global pylint cleanup 2024-05-13 12:22:13 +03:00
Atte Isopuro 0af26db9a9 Enable setting a release option directly
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
2024-05-13 12:22:13 +03:00
Naglis Jonaitis a12917d37e [FIX] sentry: fixes missing `raven` library preventing loading of modules
Related: #761 #879 #881
2024-05-13 12:22:13 +03:00
Naglis Jonaitis 03c1f1b37a [ADD] sentry module (#761)
* [ADD] sentry module

* [FIX] updated sentry module according to PR comments
2024-05-13 12:22:13 +03:00