Page MenuHomeSoftware Heritage

D2394.id8435.diff
No OneTemporary

D2394.id8435.diff

diff --git a/swh/scheduler/celery_backend/listener.py b/swh/scheduler/celery_backend/listener.py
--- a/swh/scheduler/celery_backend/listener.py
+++ b/swh/scheduler/celery_backend/listener.py
@@ -16,6 +16,8 @@
import celery
from celery.events import EventReceiver
+from swh.core.statsd import statsd
+
class ReliableEventReceiver(EventReceiver):
def __init__(self, channel, handlers=None, routing_key='#',
@@ -46,7 +48,10 @@
"""Process the received event by dispatching it to the appropriate
handler."""
handler = self.handlers.get(type) or self.handlers.get('*')
- handler and handler(event, message)
+ if handler:
+ handler(event, message)
+ statsd.increment('swh_listener_handled_event_total',
+ tags={'event_type': type})
ACTION_SEND_DELAY = datetime.timedelta(seconds=1.0)
diff --git a/swh/scheduler/celery_backend/runner.py b/swh/scheduler/celery_backend/runner.py
--- a/swh/scheduler/celery_backend/runner.py
+++ b/swh/scheduler/celery_backend/runner.py
@@ -7,6 +7,7 @@
import logging
from kombu.utils.uuid import uuid
+from swh.core.statsd import statsd
from swh.scheduler import get_scheduler, compute_nb_tasks_from
@@ -73,7 +74,10 @@
pending_tasks.extend(grabbed_tasks)
logger.info('Grabbed %s tasks %s',
len(grabbed_tasks), task_type_name)
-
+ statsd.increment(
+ 'swh_runner_scheduled_task_total',
+ len(grabbed_tasks),
+ tags={'task_type': task_type})
if not pending_tasks:
return all_backend_tasks

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 23, 2:33 AM (17 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3228044

Event Timeline