Show More
@@ -64,13 +64,6 b' def run_task(task, *args, **kwargs):' | |||
|
64 | 64 | t = None |
|
65 | 65 | if rhodecode.CELERY_ENABLED and allow_async: |
|
66 | 66 | |
|
67 | statsd = StatsdClient.statsd | |
|
68 | if statsd: | |
|
69 | task_repr = getattr(task, 'name', task) | |
|
70 | statsd.incr('rhodecode_celery_task_total', tags=[ | |
|
71 | 'task:{}'.format(task_repr) | |
|
72 | ]) | |
|
73 | ||
|
74 | 67 | try: |
|
75 | 68 | t = task.apply_async(args=args, kwargs=kwargs) |
|
76 | 69 | log.debug('executing task %s:%s in async mode', t.task_id, task) |
@@ -88,6 +81,13 b' def run_task(task, *args, **kwargs):' | |||
|
88 | 81 | |
|
89 | 82 | else: |
|
90 | 83 | log.debug('executing task %s:%s in sync mode', 'TASK', task) |
|
84 | statsd = StatsdClient.statsd | |
|
85 | if statsd: | |
|
86 | task_repr = getattr(task, 'name', task) | |
|
87 | statsd.incr('rhodecode_celery_task_total', tags=[ | |
|
88 | 'task:{}'.format(task_repr), | |
|
89 | 'mode:sync' | |
|
90 | ]) | |
|
91 | 91 | |
|
92 | 92 | # we got async task, return it after statsd call |
|
93 | 93 | if t: |
@@ -41,6 +41,7 b' from kombu.serialization import register' | |||
|
41 | 41 | |
|
42 | 42 | import rhodecode |
|
43 | 43 | |
|
44 | from rhodecode.lib.statsd_client import StatsdClient | |
|
44 | 45 | from rhodecode.lib.celerylib.utils import parse_ini_vars, ping_db |
|
45 | 46 | from rhodecode.lib.ext_json import json |
|
46 | 47 | from rhodecode.lib.pyramid_utils import bootstrap, setup_logging |
@@ -182,6 +183,13 b' def on_beat_init(sender=None, conf=None,' | |||
|
182 | 183 | @signals.task_prerun.connect |
|
183 | 184 | def task_prerun_signal(task_id, task, args, **kwargs): |
|
184 | 185 | ping_db() |
|
186 | statsd = StatsdClient.statsd | |
|
187 | if statsd: | |
|
188 | task_repr = getattr(task, 'name', task) | |
|
189 | statsd.incr('rhodecode_celery_task_total', tags=[ | |
|
190 | 'task:{}'.format(task_repr), | |
|
191 | 'mode:async' | |
|
192 | ]) | |
|
185 | 193 | |
|
186 | 194 | |
|
187 | 195 | @signals.task_success.connect |
@@ -192,6 +200,7 b' def task_success_signal(result, **kwargs' | |||
|
192 | 200 | closer() |
|
193 | 201 | |
|
194 | 202 | |
|
203 | ||
|
195 | 204 | @signals.task_retry.connect |
|
196 | 205 | def task_retry_signal( |
|
197 | 206 | request, reason, einfo, **kwargs): |
General Comments 0
You need to be logged in to leave comments.
Login now