diff --git a/lifecycle/gunicorn.conf.py b/lifecycle/gunicorn.conf.py index 5d09d5a3e..d9ffdfe53 100644 --- a/lifecycle/gunicorn.conf.py +++ b/lifecycle/gunicorn.conf.py @@ -7,14 +7,11 @@ from tempfile import gettempdir import structlog from kubernetes.config.incluster_config import SERVICE_HOST_ENV_NAME -from prometheus_client import values -from prometheus_client.values import MultiProcessValue from authentik import get_full_version from authentik.lib.config import CONFIG from authentik.lib.utils.http import get_http_session from authentik.lib.utils.reflection import get_env -from lifecycle.worker import DjangoUvicornWorker bind = "127.0.0.1:8000" @@ -72,17 +69,11 @@ workers = int(os.environ.get("WORKERS", default_workers)) threads = int(os.environ.get("THREADS", 4)) # pylint: disable=unused-argument -def post_fork(server, worker: DjangoUvicornWorker): - """Tell prometheus to use worker number instead of process ID for multiprocess""" - values.ValueClass = MultiProcessValue(lambda: worker.nr) - - -# pylint: disable=unused-argument -def worker_exit(server, worker: DjangoUvicornWorker): +def worker_exit(server, worker): """Remove pid dbs when worker is shutdown""" from prometheus_client import multiprocess - multiprocess.mark_process_dead(worker.nr) + multiprocess.mark_process_dead(worker.pid) if not CONFIG.y_bool("disable_startup_analytics", False):