File tree 1 file changed +11
-0
lines changed 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):
311
311
# See https://prometheus.github.io/client_python/multiprocess/
312
312
from prometheus_client import (CollectorRegistry , make_asgi_app ,
313
313
multiprocess )
314
+ from prometheus_fastapi_instrumentator import Instrumentator
314
315
315
316
prometheus_multiproc_dir_path = os .getenv ("PROMETHEUS_MULTIPROC_DIR" , None )
316
317
if prometheus_multiproc_dir_path is not None :
317
318
logger .debug ("vLLM to use %s as PROMETHEUS_MULTIPROC_DIR" ,
318
319
prometheus_multiproc_dir_path )
319
320
registry = CollectorRegistry ()
320
321
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 )
321
332
322
333
# Add prometheus asgi middleware to route /metrics requests
323
334
metrics_route = Mount ("/metrics" , make_asgi_app (registry = registry ))
You can’t perform that action at this time.
0 commit comments