fix(prometheus.py): fix metric name to be more accurate

change metric name from litellm_failed_requests_metric to litellm_llm_api_failed_requests_metric
This commit is contained in:
Krrish Dholakia 2024-04-18 12:30:44 -07:00
parent 28edb77350
commit d8d78bfb4f

View file

@ -22,9 +22,9 @@ class PrometheusLogger:
verbose_logger.debug(f"in init prometheus metrics") verbose_logger.debug(f"in init prometheus metrics")
from prometheus_client import Counter from prometheus_client import Counter
self.litellm_failed_requests_metric = Counter( self.litellm_llm_api_failed_requests_metric = Counter(
name="litellm_failed_requests_metric", name="litellm_llm_api_failed_requests_metric",
documentation="Total number of failed LLM calls to litellm", documentation="Total number of failed LLM API calls via litellm",
labelnames=["end_user", "hashed_api_key", "model", "team"], labelnames=["end_user", "hashed_api_key", "model", "team"],
) )
@ -105,7 +105,7 @@ class PrometheusLogger:
### FAILURE INCREMENT ### ### FAILURE INCREMENT ###
if "exception" in kwargs: if "exception" in kwargs:
self.litellm_failed_requests_metric.labels( self.litellm_llm_api_failed_requests_metric.labels(
end_user_id, user_api_key, model, user_api_team end_user_id, user_api_key, model, user_api_team
).inc() ).inc()
except Exception as e: except Exception as e: