fix(prometheus.py): always initialize label_filters for PrometheusLogger (#11764)

This commit is contained in:
Cole McIntosh 2025-06-16 10:20:57 -06:00 committed by GitHub
parent 06519e3f03
commit 6d373876d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -41,6 +41,9 @@ class PrometheusLogger(CustomLogger):
from litellm.proxy.proxy_server import CommonProxyErrors, premium_user
# Always initialize label_filters, even for non-premium users
self.label_filters = self._parse_prometheus_config()
if premium_user is not True:
verbose_logger.warning(
f"🚨🚨🚨 Prometheus Metrics is on LiteLLM Enterprise\n🚨 {CommonProxyErrors.not_premium_user.value}"
@ -51,9 +54,6 @@ class PrometheusLogger(CustomLogger):
)
return
# Parse prometheus metrics configuration for label filtering
self.label_filters = self._parse_prometheus_config()
# Create metric factory functions
self._counter_factory = self._create_metric_factory(Counter)
self._gauge_factory = self._create_metric_factory(Gauge)