fix(celery): setup statsd on celery
This commit is contained in:
parent
ef6ae48f2a
commit
1f4420a3d8
1 changed files with 7 additions and 2 deletions
|
|
@ -162,7 +162,11 @@ def _init_celery(app_type=''):
|
|||
|
||||
log.debug('Got Pyramid ENV: %s', env)
|
||||
|
||||
celery_settings = get_celery_config(env['registry'].settings)
|
||||
settings = env['registry'].settings
|
||||
celery_settings = get_celery_config(settings)
|
||||
|
||||
# init and bootstrap StatsdClient
|
||||
StatsdClient.setup(settings)
|
||||
|
||||
setup_celery_app(
|
||||
app=env['app'], root=env['root'], request=env['request'],
|
||||
|
|
@ -188,10 +192,11 @@ def on_beat_init(sender=None, conf=None, **kwargs):
|
|||
def task_prerun_signal(task_id, task, args, **kwargs):
|
||||
ping_db()
|
||||
statsd = StatsdClient.statsd
|
||||
|
||||
if statsd:
|
||||
task_repr = getattr(task, 'name', task)
|
||||
statsd.incr('rhodecode_celery_task_total', tags=[
|
||||
'task:{}'.format(task_repr),
|
||||
f'task:{task_repr}',
|
||||
'mode:async'
|
||||
])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue