Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not create a span when task is triggered by Celery Beat #2510

Merged
merged 9 commits into from
Nov 16, 2023

Conversation

antonpirker
Copy link
Member

@antonpirker antonpirker commented Nov 15, 2023

We create a span for submitting a Celery task for execution (when apply_async() is called). In cases where web frameworks are calling apply_async() this is fine, because the web framework created a transaction where the span is attached.

When Celery Beat wakes up and is calling apply_async() this is not good, because there is no transaction and then the span ID of the newly created span will be given to the task as parent_span_id leading to orphaned transactions.

So in case apply_async() is called by Celery Beat, we do not create a span for submitting the task for execution.

Fixes #1096

@antonpirker antonpirker marked this pull request as ready for review November 15, 2023 13:46
Copy link
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@antonpirker antonpirker merged commit 0c9803a into master Nov 16, 2023
314 checks passed
@antonpirker antonpirker deleted the antonpirker/parent-span-celery-beat branch November 16, 2023 09:03
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.

parent_span_id being attached to root celerybeat transactions
2 participants