Skip to content

Celery beat exclude option#2130

Merged
antonpirker merged 9 commits intomasterfrom
antonpirker/2119-celery-beat-exclude-option
May 22, 2023
Merged

Celery beat exclude option#2130
antonpirker merged 9 commits intomasterfrom
antonpirker/2119-celery-beat-exclude-option

Conversation

@antonpirker
Copy link
Contributor

@antonpirker antonpirker commented May 22, 2023

Adds a exclude_beat_tasks option to CeleryIntegration where users can exclude Celery Beat tasks from being auto-instrumented.

Fixes #2119

Documentation PR: getsentry/sentry-docs#6995

@antonpirker
Copy link
Contributor Author

antonpirker commented May 22, 2023

I extracted a new function (match_regex_list) from how the matching of trace_propagation_targets works right now to reuse the behavior.

One possible foot gun:
In trace_propagation_targets we do sub-string matches (as described in the documentation: https://docs.sentry.io/platforms/python/configuration/options/#trace-propagation-targets)

This could lead to unintended matches if you have two tasks task-a and task-a-b and you set exclude_beat_tasks=["task-a"] it will exclude task-a and task-a-b.

Not the best developer experience, but it is the behavior we have no in trace_propagation_targets.

@antonpirker
Copy link
Contributor Author

Changed to always match the full task names.

@antonpirker antonpirker marked this pull request as ready for review May 22, 2023 13:11
@antonpirker antonpirker requested review from sentrivana and sl0thentr0py and removed request for sentrivana May 22, 2023 14:21
@antonpirker antonpirker enabled auto-merge (squash) May 22, 2023 14:34
@antonpirker antonpirker merged commit 1d9effe into master May 22, 2023
@antonpirker antonpirker deleted the antonpirker/2119-celery-beat-exclude-option branch May 22, 2023 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exclude Celery Beat tasks from auto-instrumenting

2 participants