Skip to content

Commit 9210107

Browse files
authored
Merge pull request #655 from MerginMaps/configure-monitoring-queues
Enable sent events
2 parents 882ed68 + b850859 commit 9210107

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

server/mergin/celery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from .config import Configuration
1212
from .app import mail
1313

14-
1514
# create on flask app independent object
1615
# we need this for defining tasks, and celery is then configured in run_celery.py
1716
celery = Celery(
@@ -68,6 +67,7 @@ def __call__(self, *args, **kwargs):
6867
celery.conf.update(app.config)
6968
celery.conf.update(
7069
task_acks_late=Configuration.CELERY_ACKS_LATE,
70+
task_send_sent_event=Configuration.CELERY_SEND_TASK_SENT_EVENT,
7171
worker_concurrency=Configuration.CELERYD_CONCURRENCY,
7272
worker_prefetch_multiplier=Configuration.CELERYD_PREFETCH_MULTIPLIER,
7373
)

server/mergin/config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ class Configuration(object):
6969
"CELERY_RESULT_BACKEND_TRANSPORT_OPTIONS", default="{}", cast=eval
7070
)
7171
CELERY_ACKS_LATE = config("CELERY_ACKS_LATE", default=False, cast=bool)
72+
# send a task-sent event when a task is published so that monitoring tools
73+
# (e.g. celery-exporter) can report the queue name, including for failed tasks
74+
CELERY_SEND_TASK_SENT_EVENT = config(
75+
"CELERY_SEND_TASK_SENT_EVENT", default=False, cast=bool
76+
)
7277
CELERYD_CONCURRENCY = config("CELERYD_CONCURRENCY", default=1, cast=int)
7378
CELERYD_PREFETCH_MULTIPLIER = config(
7479
"CELERYD_PREFETCH_MULTIPLIER", default=4, cast=int

0 commit comments

Comments
 (0)