-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
fix stopasynciteration-counted-as-failure #20693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix stopasynciteration-counted-as-failure #20693
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile OverviewGreptile SummaryThe PR updates Main gap: the implementation only exempts Confidence Score: 3/5
|
| Filename | Overview |
|---|---|
| litellm/integrations/prometheus.py | Pending: need to inspect diff to verify StopAsyncIteration handling and metrics behavior. |
| tests/enterprise/litellm_enterprise/enterprise_callbacks/test_prometheus_logging_callbacks.py | Pending: need to inspect diff to verify test coverage and correctness. |
Sequence Diagram
sequenceDiagram
participant App as LiteLLM
participant PL as PrometheusLogger
participant PF as prometheus_label_factory
participant PM as litellm_deployment_failure_responses
App->>PL: set_llm_deployment_failure_metrics(kwargs)
Note over App,PL: kwargs may include exception
alt exception != None AND not control-flow
PL->>PL: _is_control_flow_exception(exception) == false
PL->>PF: build labels (deployment_id, api_base, provider,...)
PF-->>PL: _labels
PL->>PM: labels(**_labels).inc()
else exception is None OR control-flow (StopAsyncIteration/StopIteration)
PL->>PL: _is_control_flow_exception(exception) == true/exception None
Note over PL,PM: Skip incrementing failure metric
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 2 comments
tests/enterprise/litellm_enterprise/enterprise_callbacks/test_prometheus_logging_callbacks.py
Show resolved
Hide resolved
Additional Comments (1)
|
|
@Harshit28j can you please work to have this be a 4/5+ on greptile, the feedback seems legitimate, unless i'm missing something. |

Relevant issues
Fixes a bug where
StopAsyncIteration(and other control flow exceptions) were incorrectly counted as deployment failures in Prometheus metrics. Also fixesNameErrorandmypyissues in prometheus.py.Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unitCI (LiteLLM team)
Branch creation CI run
Link:
CI run for the last commit
Link:
Merge / cherry-pick CI run
Links:
Type
🐛 Bug Fix
Changes