From 40550e5b8806990e7c8b260e67e8e7e73e0acf2b Mon Sep 17 00:00:00 2001 From: "Jugal D. Bhatt" <55304795+jugaldb@users.noreply.github.com> Date: Thu, 14 Aug 2025 16:16:48 -0700 Subject: [PATCH] [Proxy] Litellm add DB metrics to prometheus (#13626) * Fix - add safe divide by 0 for most places to prevent crash * feat(prometheus): add new metrics for monitoring pod lock manager and spend update queues * fix(prometheus): specify type for buffer monitoring metrics in PrometheusMetricLabels * Revert "Fix - add safe divide by 0 for most places to prevent crash" This reverts commit 265d40e39051e148996b9fb7f354730c57ff23ac. --- litellm/types/integrations/prometheus.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/litellm/types/integrations/prometheus.py b/litellm/types/integrations/prometheus.py index 839c1048c3d..e0ee950d260 100644 --- a/litellm/types/integrations/prometheus.py +++ b/litellm/types/integrations/prometheus.py @@ -176,6 +176,11 @@ DEFINED_PROMETHEUS_METRICS = Literal[ "litellm_deployment_failure_responses", "litellm_deployment_total_requests", "litellm_deployment_success_responses", + "litellm_pod_lock_manager_size", + "litellm_in_memory_daily_spend_update_queue_size", + "litellm_redis_daily_spend_update_queue_size", + "litellm_in_memory_spend_update_queue_size", + "litellm_redis_spend_update_queue_size", ] @@ -378,6 +383,17 @@ class PrometheusMetricLabels: litellm_deployment_success_responses = litellm_deployment_total_requests + # Buffer monitoring metrics - these typically don't need additional labels + litellm_pod_lock_manager_size: List[str] = [] + + litellm_in_memory_daily_spend_update_queue_size: List[str] = [] + + litellm_redis_daily_spend_update_queue_size: List[str] = [] + + litellm_in_memory_spend_update_queue_size: List[str] = [] + + litellm_redis_spend_update_queue_size: List[str] = [] + @staticmethod def get_labels(label_name: DEFINED_PROMETHEUS_METRICS) -> List[str]: default_labels = getattr(PrometheusMetricLabels, label_name)