##// END OF EJS Templates
fix(celery): setup statsd on celery
super-admin -
r5243:adbd81da default
parent child Browse files
Show More
@@ -162,7 +162,11 b" def _init_celery(app_type=''):"
162
162
163 log.debug('Got Pyramid ENV: %s', env)
163 log.debug('Got Pyramid ENV: %s', env)
164
164
165 celery_settings = get_celery_config(env['registry'].settings)
165 settings = env['registry'].settings
166 celery_settings = get_celery_config(settings)
167
168 # init and bootstrap StatsdClient
169 StatsdClient.setup(settings)
166
170
167 setup_celery_app(
171 setup_celery_app(
168 app=env['app'], root=env['root'], request=env['request'],
172 app=env['app'], root=env['root'], request=env['request'],
@@ -188,10 +192,11 b' def on_beat_init(sender=None, conf=None,'
188 def task_prerun_signal(task_id, task, args, **kwargs):
192 def task_prerun_signal(task_id, task, args, **kwargs):
189 ping_db()
193 ping_db()
190 statsd = StatsdClient.statsd
194 statsd = StatsdClient.statsd
195
191 if statsd:
196 if statsd:
192 task_repr = getattr(task, 'name', task)
197 task_repr = getattr(task, 'name', task)
193 statsd.incr('rhodecode_celery_task_total', tags=[
198 statsd.incr('rhodecode_celery_task_total', tags=[
194 'task:{}'.format(task_repr),
199 f'task:{task_repr}',
195 'mode:async'
200 'mode:async'
196 ])
201 ])
197
202
General Comments 0
You need to be logged in to leave comments. Login now