From 15d8988569fcf41437b3d6fd451dd25524eda3b8 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 29 Apr 2022 18:13:10 +0200 Subject: [PATCH] Revert "lifecycle: use worker nr instead of process id to keep number of prometheus database files low" This reverts commit 254249e38b97f4e94585f0fe30fd5d3ccd2dd4f1. Signed-off-by: Jens Langhammer --- lifecycle/gunicorn.conf.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) 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):