Modify metrics service endpoint (#3443)

This commit is contained in:
lambert0312
2025-04-21 15:35:38 +08:00
committed by GitHub
parent 685d8980c3
commit c44f2869c9

View File

@@ -784,6 +784,8 @@ def add_api_key_middleware(app, api_key: str):
return await call_next(request)
if request.url.path.startswith("/health"):
return await call_next(request)
if request.url.path.startswith("/metrics"):
return await call_next(request)
if request.headers.get("Authorization") != "Bearer " + api_key:
return ORJSONResponse(content={"error": "Unauthorized"}, status_code=401)
return await call_next(request)