diff --git a/server/mergin/celery.py b/server/mergin/celery.py index 1ed09246..9c7a2b39 100644 --- a/server/mergin/celery.py +++ b/server/mergin/celery.py @@ -11,7 +11,6 @@ from .config import Configuration from .app import mail - # create on flask app independent object # we need this for defining tasks, and celery is then configured in run_celery.py celery = Celery( @@ -68,6 +67,7 @@ def __call__(self, *args, **kwargs): celery.conf.update(app.config) celery.conf.update( task_acks_late=Configuration.CELERY_ACKS_LATE, + task_send_sent_event=Configuration.CELERY_SEND_TASK_SENT_EVENT, worker_concurrency=Configuration.CELERYD_CONCURRENCY, worker_prefetch_multiplier=Configuration.CELERYD_PREFETCH_MULTIPLIER, ) diff --git a/server/mergin/config.py b/server/mergin/config.py index 15773799..f2041410 100644 --- a/server/mergin/config.py +++ b/server/mergin/config.py @@ -69,6 +69,11 @@ class Configuration(object): "CELERY_RESULT_BACKEND_TRANSPORT_OPTIONS", default="{}", cast=eval ) CELERY_ACKS_LATE = config("CELERY_ACKS_LATE", default=False, cast=bool) + # send a task-sent event when a task is published so that monitoring tools + # (e.g. celery-exporter) can report the queue name, including for failed tasks + CELERY_SEND_TASK_SENT_EVENT = config( + "CELERY_SEND_TASK_SENT_EVENT", default=False, cast=bool + ) CELERYD_CONCURRENCY = config("CELERYD_CONCURRENCY", default=1, cast=int) CELERYD_PREFETCH_MULTIPLIER = config( "CELERYD_PREFETCH_MULTIPLIER", default=4, cast=int