change: log out details about PROMETHEUS_MULTIPROC_DIR

Additionally, respond with a 503 if the var is not set when
/metrics is requested.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2022-02-19 11:28:16 -08:00
parent 388e64d0af
commit c83c5cdc42
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
4 changed files with 35 additions and 5 deletions

View file

@ -74,6 +74,10 @@ async def app_startup():
if not session_secret:
raise Exception("[fastapi] session_secret must not be empty")
if not os.environ.get("PROMETHEUS_MULTIPROC_DIR", None):
logger.warning("$PROMETHEUS_MULTIPROC_DIR is not set, the /metrics "
"endpoint is disabled.")
app.mount("/static/css",
StaticFiles(directory="web/html/css"),
name="static_css")