Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow set of prometheus collector addr as env var #3

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.getenv("CELERY_PROMETHEUS_COLLECTOR_ADDR"),
help=help,
)

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