Skip to content

[serve] Fix autoscaling metrics#53778

Merged
zcin merged 1 commit intoray-project:masterfrom
zcin:fix-autoscaling-metrics
Jun 13, 2025
Merged

[serve] Fix autoscaling metrics#53778
zcin merged 1 commit intoray-project:masterfrom
zcin:fix-autoscaling-metrics

Conversation

@zcin
Copy link
Copy Markdown
Contributor

@zcin zcin commented Jun 12, 2025

Why are these changes needed?

Only collect handle running request metrics if there are none recorded on the replicas.

https://anyscale1.atlassian.net/browse/SERVE-848

Signed-off-by: Cindy Zhang <cindyzyx9@gmail.com>
Copilot AI review requested due to automatic review settings June 12, 2025 21:20
@zcin zcin requested a review from a team as a code owner June 12, 2025 21:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the autoscaling metrics collection logic so that handle-level running request metrics are only aggregated when no metrics have been recorded on the replicas.

  • Introduces a preliminary loop over replicas to sum running request metrics.
  • Adds a conditional section in the handle metrics loop to conditionally aggregate running metrics.
Comments suppressed due to low confidence (1)

python/ray/serve/_private/autoscaling_state.py:302

  • Avoid using 'id' as a variable name since it shadows the built-in function. Consider renaming it to 'replica_id' for clarity.
for id in self._running_replicas:

@zcin zcin requested a review from abrarsheikh June 12, 2025 21:20
@abrarsheikh abrarsheikh added the go add ONLY when ready to merge, run all tests label Jun 13, 2025
@zcin zcin merged commit 078e650 into ray-project:master Jun 13, 2025
5 checks passed
@zcin zcin deleted the fix-autoscaling-metrics branch June 13, 2025 16:41
elliot-barn pushed a commit that referenced this pull request Jun 18, 2025
## Why are these changes needed?

Only collect handle running request metrics if there are none recorded
on the replicas.

https://anyscale1.atlassian.net/browse/SERVE-848

Signed-off-by: Cindy Zhang <cindyzyx9@gmail.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
elliot-barn pushed a commit that referenced this pull request Jul 2, 2025
## Why are these changes needed?

Only collect handle running request metrics if there are none recorded
on the replicas.

https://anyscale1.atlassian.net/browse/SERVE-848

Signed-off-by: Cindy Zhang <cindyzyx9@gmail.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants