From 4eb7f29f8e56da73ac7d023aa0257c237f231d46 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Thu, 17 Jul 2025 23:45:15 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8A(summary)=20add=20Celery=20exporter?= =?UTF-8?q?=20configuration=20for=20monitoring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable Celery task lifecycle events and broker dispatch events per @rouja's exporter requirements. Basic configuration following documentation without parameterization. --- src/summary/summary/core/celery_config.py | 11 +++++++++++ src/summary/summary/core/celery_worker.py | 2 ++ 2 files changed, 13 insertions(+) create mode 100644 src/summary/summary/core/celery_config.py diff --git a/src/summary/summary/core/celery_config.py b/src/summary/summary/core/celery_config.py new file mode 100644 index 00000000..dc192d0e --- /dev/null +++ b/src/summary/summary/core/celery_config.py @@ -0,0 +1,11 @@ + +# https://github.com/danihodovic/celery-exporter +# Enable task events for Prometheus monitoring via celery-exporter. + +# worker_send_task_events: Sends task lifecycle events (e.g., started, succeeded, failed), +# allowing the exporter to track task execution metrics and durations. +worker_send_task_events = True + +# task_send_sent_event: Sends an event when a task is dispatched to the broker, +# enabling full lifecycle tracking from submission to completion (including queue time). +task_send_sent_event = True diff --git a/src/summary/summary/core/celery_worker.py b/src/summary/summary/core/celery_worker.py index 58ed0dce..a4be696e 100644 --- a/src/summary/summary/core/celery_worker.py +++ b/src/summary/summary/core/celery_worker.py @@ -37,6 +37,8 @@ celery = Celery( broker_connection_retry_on_startup=True, ) +celery.config_from_object('summary.core.celery_config') + if settings.sentry_dsn and settings.sentry_is_enabled: @signals.celeryd_init.connect