Skip to content

[FIX] sentry: give each cron job its own scope - #3732

Open
moylop260 wants to merge 2 commits into
OCA:19.0from
vauxoo-dev:19.0-fix-sentry-cron-scope-moy
Open

moylop260 wants to merge 2 commits into
OCA:19.0from
vauxoo-dev:19.0-fix-sentry-cron-scope-moy

Conversation

@moylop260

Copy link
Copy Markdown
Contributor

A cron worker serves no WSGI request, so the middleware that scopes HTTP requests never covers it. Its jobs keep the scope built when the SDK was initialized, before the workers forked, so events from unrelated jobs report the same trace and carry each other's breadcrumbs.

Fork the scope in ir.cron._callback and drop the trace and breadcrumbs that forking keeps.

A cron worker serves no WSGI request, so the middleware that scopes HTTP
requests never covers it. Its jobs keep the scope built when the SDK was
initialized, before the workers forked, so events from unrelated jobs
report the same trace and carry each other's breadcrumbs.

Fork the scope in ir.cron._callback and drop the trace and breadcrumbs
that forking keeps.
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @fernandahf, @barsi, @naglis, @versada,
some modules you are maintaining are being modified, check this out!

@moylop260 moylop260 self-assigned this Sep 18, 2026
A queue job runs inside an HTTP request, so it already gets a scope of
its own, but it is reported under the route that ran it and every job
groups under that one name. Name it after the job instead.

Only when queue_job is available, the way the module already treats
server_environment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants