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

Missing a queue name upon receiving a task event #335

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TheLazzziest
Copy link

Hi there!

Context

I am facing the issue with missing values for queue label for the Celery tasks metrics. Basically, I don't see any other value except the default one: celery
image

So I tried to run the exporter locally, and here is what I've found:

  • track_task_event only considers queue property upon receiving a task, but the queue name is not always available in this way ( I assume it's available when a queue name is passed directly to the call).

To improve lookup capabilities of the exporter, I've added another way of getting a queue name which must solve the aforementioned issue.

# couldn't find the target task by id
# the dictionary path is missing
logger.warning(f"Couldn't find the target task by its id: {target.id}")
return queue_name
Copy link
Owner

Choose a reason for hiding this comment

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

What happens when an app deployment changes the queue and the celery-exporter doesn't restart?

Copy link
Author

Choose a reason for hiding this comment

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

It will keep return the old queue name until the cache will have been invalidated.
That was my next question which I missed to include in the header. Pardon for that 🙏

How to not query the broker for each task as it can lead to some performance degradation depending on the producing rate ?

Several strategies comes at once, namely:

  • we need to start another worker to invalidate the cache
  • remove caching for this lookup method at this point
  • decrease the cache size

I've also taken a look into Flower to see how it manages such cases, but couldn't find any relevant parts related to queue name processing.

@danihodovic
Copy link
Owner

Can you add a test?

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.

2 participants