Merge pull request #22523 from BerriAI/fix/lint-undefined-kwargs

Fix undefined kwargs in InFlightRequestsMiddleware
This commit is contained in:
Julio Quinteros Pro 2026-03-01 17:27:38 -03:00 committed by GitHub
commit 00affc01b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -62,13 +62,14 @@ class InFlightRequestsMiddleware:
try:
from prometheus_client import Gauge
kwargs: dict[str, Any] = {}
if "PROMETHEUS_MULTIPROC_DIR" in os.environ:
# livesum aggregates across all worker processes in the scrape response
kwargs["multiprocess_mode"] = "livesum"
InFlightRequestsMiddleware._gauge = Gauge(
"litellm_in_flight_requests",
"Number of HTTP requests currently in-flight on this uvicorn worker",
**kwargs, # type: ignore[arg-type]
**kwargs,
)
except Exception:
InFlightRequestsMiddleware._gauge = None