mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-14 01:35:29 +08:00
[Bugfix] Fix 307 Redirect for /metrics (#4523)
This commit is contained in:
parent
a88bb9b032
commit
4dc8026d86
@ -119,7 +119,7 @@ class Metrics:
|
||||
buckets=[1, 2, 5, 10, 20],
|
||||
)
|
||||
self.counter_request_success = Counter(
|
||||
name="vllm:request_success",
|
||||
name="vllm:request_success_total",
|
||||
documentation="Count of successfully processed requests.",
|
||||
labelnames=labelnames + [Metrics.labelname_finish_reason])
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ import asyncio
|
||||
import importlib
|
||||
import inspect
|
||||
import os
|
||||
import re
|
||||
from contextlib import asynccontextmanager
|
||||
from http import HTTPStatus
|
||||
|
||||
@ -12,6 +13,7 @@ from fastapi.exceptions import RequestValidationError
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.responses import JSONResponse, Response, StreamingResponse
|
||||
from prometheus_client import make_asgi_app
|
||||
from starlette.routing import Mount
|
||||
|
||||
import vllm
|
||||
from vllm.engine.arg_utils import AsyncEngineArgs
|
||||
@ -55,8 +57,10 @@ def parse_args():
|
||||
|
||||
|
||||
# Add prometheus asgi middleware to route /metrics requests
|
||||
metrics_app = make_asgi_app()
|
||||
app.mount("/metrics", metrics_app)
|
||||
route = Mount("/metrics", make_asgi_app())
|
||||
# Workaround for 307 Redirect for /metrics
|
||||
route.path_regex = re.compile('^/metrics(?P<path>.*)$')
|
||||
app.routes.append(route)
|
||||
|
||||
|
||||
@app.exception_handler(RequestValidationError)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user