From 65c0626aa4c01f387b02cf0238880dfa5bd21593 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Thu, 22 Aug 2024 13:29:35 -0700 Subject: [PATCH] fix init correct prometheus metrics --- litellm/integrations/prometheus.py | 35 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/litellm/integrations/prometheus.py b/litellm/integrations/prometheus.py index 321c1cc1fc9..1471f59b75c 100644 --- a/litellm/integrations/prometheus.py +++ b/litellm/integrations/prometheus.py @@ -103,26 +103,27 @@ class PrometheusLogger(CustomLogger): "Remaining budget for api key", labelnames=["hashed_api_key", "api_key_alias"], ) + + ######################################## + # LiteLLM Virtual API KEY metrics + ######################################## + # Remaining MODEL RPM limit for API Key + self.litellm_remaining_api_key_requests_for_model = Gauge( + "litellm_remaining_api_key_requests_for_model", + "Remaining Requests API Key can make for model (model based rpm limit on key)", + labelnames=["hashed_api_key", "api_key_alias", "model"], + ) + + # Remaining MODEL TPM limit for API Key + self.litellm_remaining_api_key_tokens_for_model = Gauge( + "litellm_remaining_api_key_tokens_for_model", + "Remaining Tokens API Key can make for model (model based tpm limit on key)", + labelnames=["hashed_api_key", "api_key_alias", "model"], + ) + # Litellm-Enterprise Metrics if premium_user is True: - ######################################## - # LiteLLM Virtual API KEY metrics - ######################################## - # Remaining MODEL RPM limit for API Key - self.litellm_remaining_api_key_requests_for_model = Gauge( - "litellm_remaining_api_key_requests_for_model", - "Remaining Requests API Key can make for model (model based rpm limit on key)", - labelnames=["hashed_api_key", "api_key_alias", "model"], - ) - - # Remaining MODEL TPM limit for API Key - self.litellm_remaining_api_key_tokens_for_model = Gauge( - "litellm_remaining_api_key_tokens_for_model", - "Remaining Tokens API Key can make for model (model based tpm limit on key)", - labelnames=["hashed_api_key", "api_key_alias", "model"], - ) - ######################################## # LLM API Deployment Metrics / analytics ########################################