INNER CODE UNIT · Python
read_metrics
LoD-Dawn/Fast-Vben-Admin · backend/app/main.py:229
def read_metrics(request: Request):
if not settings.METRICS_ENABLED:
raise HTTPException(status_code=404, detail="Metrics are disabled")
if settings.METRICS_AUTH_TOKEN:
expected_authorization = f"Bearer {settings.METRICS_AUTH_TOKEN}"
if request.headers.get("authorization") != expected_authorization:
raise HTTPException(status_code=401, detail="Metrics authentication failed")
return build_metrics_response()