Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the metrics system to provide fine-grained request state tracking. Instead of a single "completed" counter, requests are now categorized as succeeded, cancelled, or aborted. The num_api_waiting_reqs is now a computed property derived from total - completed - routed rather than being manually calculated in multiple places.
Changes:
- Replaces
num_completed_reqswithnum_succeeded_reqs,num_cancelled_reqs, andnum_aborted_reqsinSchedulerStats, with computed properties for derived metrics (num_failed_reqs,num_completed_reqs,num_uncompleted_reqs,num_api_waiting_reqs). - Updates
MetricsProcessorto exposeincrease_succeeded_requests,increase_cancelled_requests, andincrease_aborted_requestsmethods, and updates call sites inasync_engine.py. - Updates Prometheus gauges and log messages to report the new fine-grained metrics.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
lmdeploy/metrics/stats.py |
Replaces num_completed_reqs field with fine-grained counters and computed properties |
lmdeploy/metrics/metrics_processor.py |
Adds increase_succeeded_requests, increase_cancelled_requests, increase_aborted_requests methods |
lmdeploy/serve/core/async_engine.py |
Updates call sites: cancelled in exception handler, aborted for pre-start abort, succeeded after generator loop |
lmdeploy/metrics/loggers.py |
Updates log format and Prometheus gauges for new metric names |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fine-grained metrics calculation:
Now it looks like: