Skip to content

Track queue time on Celery#206

Merged
adamchainz merged 1 commit intomasterfrom
issue_35_celery_time_in_queue
Aug 10, 2019
Merged

Track queue time on Celery#206
adamchainz merged 1 commit intomasterfrom
issue_35_celery_time_in_queue

Conversation

@adamchainz
Copy link
Copy Markdown
Contributor

Fixes #35. Track the queue time by using an extra haeder to track when the task is added to the queue and comparing when it gets executed. This should work in most setups but if the celery app isn't all set up on the producer side, we are well defended against it.

Like #205, I manually tested on Celery 3.1.x locally by editing tox.ini and reinstalling with tox -r.

@adamchainz adamchainz requested a review from cschneid July 2, 2019 15:00
@adamchainz adamchainz force-pushed the issue_35_celery_time_in_queue branch 2 times, most recently from 6f664d3 to c27b74b Compare July 3, 2019 08:39
Copy link
Copy Markdown
Contributor

@dlanderson dlanderson left a comment

Choose a reason for hiding this comment

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

LGTM!

except TypeError:
pass
else:
span.tag("queue_time", queue_time)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm guessing this should be a request tag (aka context) instead of a span tag @dlanderson / @cschneid ? same as discussion on the other celery PR https://github.com/scoutapp/scout_apm_python/pull/205/files#r300129980

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, a request tag is better here. Especially since it's not describing "the section of code that is running", it's saying something about the request as a whole.

@adamchainz adamchainz force-pushed the issue_34_celery_queue_name branch 2 times, most recently from 91380a1 to 0881794 Compare August 9, 2019 08:47
@adamchainz adamchainz force-pushed the issue_35_celery_time_in_queue branch from c27b74b to eb108c0 Compare August 10, 2019 08:15
@adamchainz adamchainz changed the base branch from issue_34_celery_queue_name to master August 10, 2019 08:41
Fixes #35. Track the queue time by using an extra haeder to track when the task is added to the queue and comparing when it gets executed. This should work in most setups but if the celery app isn't all set up on the producer side, we are well defended against it.

Like #205, I manually tested on Celery 3.1.x locally by editing `tox.ini` and reinstalling with `tox -r`.
@adamchainz adamchainz force-pushed the issue_35_celery_time_in_queue branch from eb108c0 to 0bbf099 Compare August 10, 2019 08:41
@adamchainz adamchainz merged commit cbc3efd into master Aug 10, 2019
@adamchainz adamchainz deleted the issue_35_celery_time_in_queue branch August 10, 2019 08:56
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.

Capture Celery Time-in-queue

3 participants