[16.0][sentry] sentry_ignore_exceptions is not applied to the exceptions logged without exc_info

Aperta
#3,815 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Miftahussalam ci sta già lavorando.

Dal 26/10/2026.

  • #3816 di @Miftahussalam — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Start with sentry/hooks.py and inspect before_send, then compare how sentry_ignore_exceptions is configured with the fixed const.DEFAULT_IGNORED_EXCEPTIONS check for log records without exc_info. The issue names odoo/http.py (Application.__call__) and says it is opening a pull request with tests; check that work before starting. Done means the configured ignored exceptions behave the same with and without exc_info, including the listed ValidationError and UserError cases.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Module

sentry 16.0.3.0.3. The same code is in 17.0, 18.0 and 19.0.

Describe the bug

Odoo logs the UserError and AccessError of a request, and their subclasses such as ValidationError, with _logger.warning(exc): the exception is the message of the log record and there is no exc_info (odoo/http.py, Application.__call__).

sentry_ignore_exceptions is applied by sentry_sdk (ignore_errors) only to the events that have an exc_info. For the log records without exc_info, before_send in sentry/hooks.py drops the exception by the fixed list const.DEFAULT_IGNORED_EXCEPTIONS, not by the option.

So the option has no effect on these exceptions: setting sentry_ignore_exceptions empty, or to a list without ValidationError, does not let a ValidationError raised in a request reach Sentry. It is still dropped.

To Reproduce

Calling the before_send of the module with a log record that has a ValidationError or a UserError as message, with the option set to different values:

sentry_ignore_exceptions ValidationError UserError
empty dropped dropped
odoo.exceptions.AccessDenied dropped dropped
odoo.exceptions.ValidationError dropped dropped

The same with a real request: with sentry_logging_level = warn and sentry_ignore_exceptions empty, a button that raises a ValidationError logs WARNING odoo.http: <message>, and no event is sent.

Expected behavior

The configured sentry_ignore_exceptions is applied the same way with and without exc_info.

Additional context

  • The hardcoded check explains why raising a UserError is never sent, but it also makes the option look broken for anybody who wants to send some of them.
  • The table of readme/CONFIGURE.rst names the option sentry_ignored_exceptions, while the code reads sentry_ignore_exceptions (and the example configuration of the same file uses the second name).
  • A very old related discussion: #792.

I am opening a pull request with a fix (the log records are checked against the ignore_errors list of the client) and tests.

Lingua principale
Python
Stelle
960
Fork
1.7k
Merge medio
7g 2h
PR unite (30g)
8

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OCA/server-tools

Tutte le issue di OCA/server-tools

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.