Skip to content

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

Merged
antonpirker merged 9 commits into
masterfrom
antonpirker/parent-span-celery-beat
Nov 16, 2023
Merged

antonpirker merged 9 commits into
masterfrom
antonpirker/parent-span-celery-beat

Conversation

@antonpirker

@antonpirker antonpirker commented Nov 15, 2023 •

Copy link
Copy Markdown
Contributor

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

@sentrivana sentrivana left a comment

Copy link
Copy Markdown
Collaborator

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
@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