Skip to content

Commit

Permalink
Add prometheus endpoint to celery worker. (google#836)
Browse files Browse the repository at this point in the history
  • Loading branch information
hacktobeer committed Jul 8, 2021
1 parent 963a97d commit 75a60ee
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions turbinia/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,13 @@ def __init__(self, jobs_denylist=None, jobs_allowlist=None):

def start(self):
"""Start Turbinia Celery Worker."""
if config.PROMETHEUS_ENABLED:
if config.PROMETHEUS_PORT and config.PROMETHEUS_ADDR:
log.info('Starting Prometheus endpoint.')
start_http_server(
port=config.PROMETHEUS_PORT, addr=config.PROMETHEUS_ADDR)
else:
log.info('Prometheus enabled but port or address not set!')
log.info('Running Turbinia Celery Worker.')
self.worker.task(task_manager.task_runner, name='task_runner')
argv = ['celery', 'worker', '--loglevel=info', '--pool=solo']
Expand Down

0 comments on commit 75a60ee

Please sign in to comment.