[Bugfix][Frontend] Fix missing /metrics endpoint (#6463)
This commit is contained in:
@@ -73,11 +73,13 @@ async def lifespan(app: fastapi.FastAPI):
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
# Add prometheus asgi middleware to route /metrics requests
|
||||
route = Mount("/metrics", make_asgi_app())
|
||||
# Workaround for 307 Redirect for /metrics
|
||||
route.path_regex = re.compile('^/metrics(?P<path>.*)$')
|
||||
router.routes.append(route)
|
||||
|
||||
def mount_metrics(app: fastapi.FastAPI):
|
||||
# Add prometheus asgi middleware to route /metrics requests
|
||||
metrics_route = Mount("/metrics", make_asgi_app())
|
||||
# Workaround for 307 Redirect for /metrics
|
||||
metrics_route.path_regex = re.compile('^/metrics(?P<path>.*)$')
|
||||
app.routes.append(metrics_route)
|
||||
|
||||
|
||||
@router.get("/health")
|
||||
@@ -167,6 +169,8 @@ def build_app(args):
|
||||
app.include_router(router)
|
||||
app.root_path = args.root_path
|
||||
|
||||
mount_metrics(app)
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=args.allowed_origins,
|
||||
|
||||
Reference in New Issue
Block a user