mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-18 09:45:23 +00:00
fix(prometheus): restore the team gauge label definitions
The previous commit dropped two files that belong with it: the four label sets on `PrometheusMetricLabels` and their `DEFINED_PROMETHEUS_METRICS` entries, plus the success-hook test's stub for the new helper. Without them `get_labels_for_metric` raises `AttributeError: type object 'PrometheusMetricLabels' has no attribute 'litellm_remaining_team_requests_for_model'` for every logger construction, which is why checks unrelated to this feature went red. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
67f2e25560
commit
a87ddbe262
2 changed files with 19 additions and 0 deletions
|
|
@ -301,6 +301,10 @@ DEFINED_PROMETHEUS_METRICS = Literal[
|
|||
"litellm_deployment_rpm_limit",
|
||||
"litellm_remaining_api_key_requests_for_model",
|
||||
"litellm_remaining_api_key_tokens_for_model",
|
||||
"litellm_remaining_team_requests_for_model",
|
||||
"litellm_remaining_team_tokens_for_model",
|
||||
"litellm_team_rpm_limit",
|
||||
"litellm_team_tpm_limit",
|
||||
"litellm_api_key_rate_limit_allowed_metric",
|
||||
"litellm_api_key_rate_limit_used_metric",
|
||||
"litellm_team_rate_limit_allowed_metric",
|
||||
|
|
@ -839,6 +843,17 @@ class PrometheusMetricLabels:
|
|||
UserAPIKeyLabelNames.MODEL_ID.value,
|
||||
]
|
||||
|
||||
litellm_remaining_team_requests_for_model: ClassVar[Sequence[str]] = [
|
||||
UserAPIKeyLabelNames.TEAM.value,
|
||||
UserAPIKeyLabelNames.TEAM_ALIAS.value,
|
||||
UserAPIKeyLabelNames.v1_LITELLM_MODEL_NAME.value,
|
||||
]
|
||||
|
||||
litellm_remaining_team_tokens_for_model = litellm_remaining_team_requests_for_model
|
||||
|
||||
litellm_team_rpm_limit = litellm_remaining_team_requests_for_model
|
||||
|
||||
litellm_team_tpm_limit = litellm_remaining_team_requests_for_model
|
||||
litellm_api_key_rate_limit_allowed_metric: ClassVar[tuple[str, ...]] = (
|
||||
UserAPIKeyLabelNames.API_KEY_HASH.value,
|
||||
UserAPIKeyLabelNames.API_KEY_ALIAS.value,
|
||||
|
|
@ -1185,6 +1200,9 @@ class NoOpMetric:
|
|||
def labels(self, *args, **kwargs):
|
||||
return self
|
||||
|
||||
def remove(self, *labelvalues: object) -> None:
|
||||
pass
|
||||
|
||||
def inc(self, *args, **kwargs) -> None:
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ async def test_async_post_call_success_hook_includes_client_ip_user_agent():
|
|||
logger._increment_remaining_budget_metrics = AsyncMock()
|
||||
logger._set_virtual_key_rate_limit_metrics = MagicMock()
|
||||
logger._set_v3_rate_limit_allowed_and_used_metrics = MagicMock()
|
||||
logger._set_team_rate_limit_metrics = MagicMock()
|
||||
logger._set_latency_metrics = MagicMock()
|
||||
logger.set_llm_deployment_success_metrics = MagicMock()
|
||||
logger._increment_cache_metrics = MagicMock()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue