File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -311,13 +311,24 @@ def mount_metrics(app: FastAPI):
311311 # See https://prometheus.github.io/client_python/multiprocess/
312312 from prometheus_client import (CollectorRegistry , make_asgi_app ,
313313 multiprocess )
314+ from prometheus_fastapi_instrumentator import Instrumentator
314315
315316 prometheus_multiproc_dir_path = os .getenv ("PROMETHEUS_MULTIPROC_DIR" , None )
316317 if prometheus_multiproc_dir_path is not None :
317318 logger .debug ("vLLM to use %s as PROMETHEUS_MULTIPROC_DIR" ,
318319 prometheus_multiproc_dir_path )
319320 registry = CollectorRegistry ()
320321 multiprocess .MultiProcessCollector (registry )
322+ Instrumentator (
323+ excluded_handlers = [
324+ "/metrics" ,
325+ "/health" ,
326+ "/load" ,
327+ "/ping" ,
328+ "/version" ,
329+ ],
330+ registry = registry ,
331+ ).add ().instrument (app ).expose (app )
321332
322333 # Add prometheus asgi middleware to route /metrics requests
323334 metrics_route = Mount ("/metrics" , make_asgi_app (registry = registry ))
You can’t perform that action at this time.
0 commit comments