@dog_stats_api.timed('status.service.celery.status')
def celery_status(_):
 stats = (celery.control.inspect().stats() or {})
 return HttpResponse(json.dumps(stats, indent=4), content_type='application/json')

@ dog_stats_api . timed ( 'status.service.celery.status' ) def celery_status ( _ ) : stats = ( celery . control . inspect ( ) . stats ( ) or { } ) return HttpResponse ( json . dumps ( stats , indent = 4 ) , content_type = 'application/json' )
a view that returns celery stats .