diff --git a/litellm/types/integrations/prometheus.py b/litellm/types/integrations/prometheus.py index 5b1d32cd93c..d62a0dd9c90 100644 --- a/litellm/types/integrations/prometheus.py +++ b/litellm/types/integrations/prometheus.py @@ -224,6 +224,9 @@ DEFINED_PROMETHEUS_METRICS = Literal[ "litellm_remaining_user_budget_metric", "litellm_user_max_budget_metric", "litellm_user_budget_remaining_hours_metric", + # User and team count metrics + "litellm_total_users", + "litellm_teams_count", "litellm_deployment_state", "litellm_deployment_failure_responses", "litellm_deployment_total_requests", diff --git a/tests/test_litellm/integrations/test_prometheus_user_team_metrics.py b/tests/test_litellm/integrations/test_prometheus_user_team_metrics.py index 361ab7332f8..e580e0908f0 100644 --- a/tests/test_litellm/integrations/test_prometheus_user_team_metrics.py +++ b/tests/test_litellm/integrations/test_prometheus_user_team_metrics.py @@ -927,3 +927,28 @@ def test_custom_latency_buckets(): REGISTRY.unregister(collector) except Exception: pass + + +def test_user_team_count_metrics_pass_config_validation(monkeypatch): + """litellm_total_users and litellm_teams_count must be configurable via + prometheus_metrics_config without raising a validation error. + + Regression test for https://github.com/BerriAI/litellm/issues/30839 + """ + import litellm + + monkeypatch.setattr( + litellm, + "prometheus_metrics_config", + [ + { + "group": "my_metrics", + "metrics": ["litellm_total_users", "litellm_teams_count"], + } + ], + ) + + logger = PrometheusLogger() + + assert "litellm_total_users" in logger.enabled_metrics + assert "litellm_teams_count" in logger.enabled_metrics