Changes committed

This commit is contained in:
2026-06-01 21:49:53 +05:30
parent 8537c653c1
commit 3163bb213e
387 changed files with 21940 additions and 107 deletions

View File

@@ -0,0 +1,29 @@
from __future__ import annotations
from fastapi import FastAPI
from prometheus_fastapi_instrumentator import Instrumentator
from app.core.config import settings
def setup_metrics(app: FastAPI) -> None:
"""Configure Prometheus metrics instrumentation."""
if not settings.prometheus_enabled:
return
instrumentator = Instrumentator(
should_group_status_codes=True,
should_ignore_untemplated=True,
should_respect_env_var=False,
excluded_handlers=["/metrics", "/api/v1/health", "/docs", "/openapi.json"],
env_var_name="PROMETHEUS_ENABLED",
inprogress_name="docengine_inprogress_requests",
inprogress_labels=True,
)
instrumentator.instrument(app).expose(
app,
endpoint="/metrics",
include_in_schema=False,
should_gzip=True,
)