From 055aeacc71522dfad2f149da2a79037e5095a0b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Mon, 27 Jan 2025 11:08:25 +0100 Subject: [PATCH] Add tasks number in Prometheus --- github_app_geo_project/scripts/process_queue.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/github_app_geo_project/scripts/process_queue.py b/github_app_geo_project/scripts/process_queue.py index 59c58c1221..b68fa17157 100644 --- a/github_app_geo_project/scripts/process_queue.py +++ b/github_app_geo_project/scripts/process_queue.py @@ -813,6 +813,10 @@ async def __call__(self, *args: Any, **kwds: Any) -> Any: def _watch(self) -> None: while True: _LOGGER.debug("Prometheus watch: alive") + try: + _NB_JOBS.labels("Tasks").set(len(asyncio.all_tasks())) + except RuntimeError: + pass with self.Session() as session: for status in models.JobStatus: _NB_JOBS.labels(status.name).set(