Skip to content

Commit

Permalink
Allow set of prometheus collector addr as env var
Browse files Browse the repository at this point in the history
  • Loading branch information
agershman committed Dec 15, 2023
1 parent def3163 commit e62e712
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Guillaume Gauvrit <guillaume@gandi.net>
Michael Vieira <michael.vieira@gandi.net>
Michael Vieira <michael.vieira@gandi.net>
Andrew Gershman <andrew.j.gershman@gmail.com>
7 changes: 6 additions & 1 deletion src/celery_prometheus/prometheus_bootstep.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Helper for celery."""
import logging
import os
from argparse import ArgumentParser
from typing import Any, Mapping, Optional, cast

Expand All @@ -26,7 +27,11 @@ def add_prometheus_option(app: Celery) -> None:
if celery_version.major < 5:

def add_preload_arguments(parser: ArgumentParser) -> None:
parser.add_argument("--prometheus-collector-addr", default=None, help=help)
parser.add_argument(
"--prometheus-collector-addr",
default=os.environ.get("CELERY_PROMETHEUS_COLLECTOR_ADDR"),
help=help,
)

app.user_options["preload"].add(add_preload_arguments)
else:
Expand Down

0 comments on commit e62e712

Please sign in to comment.