How to increment gauge value in celery timeout?

54 views
Skip to first unread message

Yogita Bhardwaj

unread,
May 24, 2023, 6:01:07 AM5/24/23
to Prometheus Users
The specific query I am struggling with involves, I am using Prometheus gauge metrics to increment the value outside celery task and to decrement the value of that gauge metrics when timeout occurs. but I m not able to achieve this. Despite my efforts to resolve it, I have been unable to achieve the desired results. I have reviewed the Prometheus documentation and explored various online resources, but I haven't been able to find a suitable solution.

Brian Candler

unread,
May 24, 2023, 6:25:22 AM5/24/23
to Prometheus Users
Since you mention "celery" I *guess* you are probably writing Python code, and I *guess* you are using the Python client library for prometheus. Whether you are exposing metrics via direct HTTP scrape, or using push_gateway, I don't know.

Give that your question is (probably) about programming with the Python client library, then I think the starting point should be to show the code that you've written so far, and explain how it doesn't do what you want.

Also, if you can explain what it is you're trying to achieve, there may be a different and better way to solve your issue. For example, are you trying to expose a metric for the number of active celery tasks? If so, using an existing exporter which converts celery status into prometheus metrics may be a better solution: e.g.
Reply all
Reply to author
Forward
0 new messages