Repository navigation
[serve] Include custom metrics method and report to controller - #56005
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism for replicas to report custom autoscaling metrics to the controller. The changes look good overall, enabling more flexible autoscaling strategies. My review includes suggestions to refactor the state management for these new metrics to improve clarity and maintainability, fixes for a few incorrect type hints, and a recommendation to make timestamping more robust. Most importantly, the new tests for this feature are currently placeholders and need to be fully implemented to ensure the functionality is working as expected.
arcyleung
force-pushed
the
serve-custom-metrics
branch
from
August 31, 2025 20:10
2caab7b to
2520d98
Compare
abrarsheikh
reviewed
Sep 2, 2025
abrarsheikh
reviewed
Sep 2, 2025
zcin
reviewed
Sep 3, 2025
arcyleung
force-pushed
the
serve-custom-metrics
branch
8 times, most recently
from
September 11, 2025 12:56
22aa476 to
bc9180b
Compare
arcyleung
force-pushed
the
serve-custom-metrics
branch
from
September 14, 2025 02:17
f741071 to
9dd2c03
Compare
abrarsheikh
reviewed
Sep 14, 2025
abrarsheikh
reviewed
Sep 14, 2025
arcyleung
force-pushed
the
serve-custom-metrics
branch
from
September 15, 2025 01:18
7097557 to
243fb25
Compare
abrarsheikh
reviewed
Sep 15, 2025
arcyleung
force-pushed
the
serve-custom-metrics
branch
from
September 15, 2025 13:06
2f20f6b to
fc1f4b4
Compare
abrarsheikh
approved these changes
Sep 15, 2025
abrarsheikh
left a comment
Contributor
There was a problem hiding this comment.
one comment but looks good to me
arcyleung
force-pushed
the
serve-custom-metrics
branch
2 times, most recently
from
September 16, 2025 01:15
043270c to
da71014
Compare
Signed-off-by: Arthur Leung <[email protected]>
arcyleung
force-pushed
the
serve-custom-metrics
branch
from
September 18, 2025 03:11
15cc57b to
51318ac
Compare
Signed-off-by: Arthur Leung <[email protected]>
arcyleung
force-pushed
the
serve-custom-metrics
branch
from
September 18, 2025 03:40
51318ac to
fd6d296
Compare
matthewdeng
approved these changes
Sep 18, 2025
arcyleung
force-pushed
the
serve-custom-metrics
branch
from
September 18, 2025 17:41
61aece9 to
a576cfd
Compare
Signed-off-by: Arthur Leung <[email protected]>
arcyleung
force-pushed
the
serve-custom-metrics
branch
from
September 18, 2025 18:00
a576cfd to
650a489
Compare
zcin
approved these changes
Sep 18, 2025
zma2
pushed a commit
to zma2/ray
that referenced
this pull request
Sep 23, 2025
…roject#56005) ## Why are these changes needed? Required by https://docs.google.com/document/d/1KtMUDz1O3koihG6eh-QcUqudZjNAX3NsqqOMYh3BoWA/edit?tab=t.0#heading=h.jo7hyr9zpyw <img width="1563" height="901" alt="image" src="https://github.com/user-attachments/assets/f6405710-2622-41d3-b5a5-b2440b705ddd" /> Allows each replica to call a method `record_autoscaling_stats` and sends the resultant custom metrics to the controller. ## Related issue number <!-- For example: "Closes ray-project#1234" --> ## Checks - [x] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [x] I've run `scripts/format.sh` to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [x] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [x] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: Arthur Leung <[email protected]> Co-authored-by: Arthur Leung <[email protected]> Signed-off-by: Zhiqiang Ma <[email protected]>
ZacAttack
pushed a commit
to ZacAttack/ray
that referenced
this pull request
Sep 24, 2025
…roject#56005) ## Why are these changes needed? Required by https://docs.google.com/document/d/1KtMUDz1O3koihG6eh-QcUqudZjNAX3NsqqOMYh3BoWA/edit?tab=t.0#heading=h.jo7hyr9zpyw <img width="1563" height="901" alt="image" src="https://github.com/user-attachments/assets/f6405710-2622-41d3-b5a5-b2440b705ddd" /> Allows each replica to call a method `record_autoscaling_stats` and sends the resultant custom metrics to the controller. ## Related issue number <!-- For example: "Closes ray-project#1234" --> ## Checks - [x] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [x] I've run `scripts/format.sh` to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [x] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [x] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: Arthur Leung <[email protected]> Co-authored-by: Arthur Leung <[email protected]> Signed-off-by: zac <[email protected]>
elliot-barn
pushed a commit
that referenced
this pull request
Sep 24, 2025
## Why are these changes needed? Required by https://docs.google.com/document/d/1KtMUDz1O3koihG6eh-QcUqudZjNAX3NsqqOMYh3BoWA/edit?tab=t.0#heading=h.jo7hyr9zpyw <img width="1563" height="901" alt="image" src="https://github.com/user-attachments/assets/f6405710-2622-41d3-b5a5-b2440b705ddd" /> Allows each replica to call a method `record_autoscaling_stats` and sends the resultant custom metrics to the controller. ## Related issue number <!-- For example: "Closes #1234" --> ## Checks - [x] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [x] I've run `scripts/format.sh` to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [x] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [x] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: Arthur Leung <[email protected]> Co-authored-by: Arthur Leung <[email protected]> Signed-off-by: elliot-barn <[email protected]>
marcostephan
pushed a commit
to marcostephan/ray
that referenced
this pull request
Sep 24, 2025
…roject#56005) ## Why are these changes needed? Required by https://docs.google.com/document/d/1KtMUDz1O3koihG6eh-QcUqudZjNAX3NsqqOMYh3BoWA/edit?tab=t.0#heading=h.jo7hyr9zpyw <img width="1563" height="901" alt="image" src="https://github.com/user-attachments/assets/f6405710-2622-41d3-b5a5-b2440b705ddd" /> Allows each replica to call a method `record_autoscaling_stats` and sends the resultant custom metrics to the controller. ## Related issue number <!-- For example: "Closes ray-project#1234" --> ## Checks - [x] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [x] I've run `scripts/format.sh` to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [x] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [x] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: Arthur Leung <[email protected]> Co-authored-by: Arthur Leung <[email protected]> Signed-off-by: Marco Stephan <[email protected]>
elliot-barn
pushed a commit
that referenced
this pull request
Sep 27, 2025
## Why are these changes needed? Required by https://docs.google.com/document/d/1KtMUDz1O3koihG6eh-QcUqudZjNAX3NsqqOMYh3BoWA/edit?tab=t.0#heading=h.jo7hyr9zpyw <img width="1563" height="901" alt="image" src="https://github.com/user-attachments/assets/f6405710-2622-41d3-b5a5-b2440b705ddd" /> Allows each replica to call a method `record_autoscaling_stats` and sends the resultant custom metrics to the controller. ## Related issue number <!-- For example: "Closes #1234" --> ## Checks - [x] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [x] I've run `scripts/format.sh` to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [x] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [x] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: Arthur Leung <[email protected]> Co-authored-by: Arthur Leung <[email protected]> Signed-off-by: elliot-barn <[email protected]>
dstrodtman
pushed a commit
to dstrodtman/ray
that referenced
this pull request
Oct 6, 2025
…roject#56005) ## Why are these changes needed? Required by https://docs.google.com/document/d/1KtMUDz1O3koihG6eh-QcUqudZjNAX3NsqqOMYh3BoWA/edit?tab=t.0#heading=h.jo7hyr9zpyw <img width="1563" height="901" alt="image" src="https://github.com/user-attachments/assets/f6405710-2622-41d3-b5a5-b2440b705ddd" /> Allows each replica to call a method `record_autoscaling_stats` and sends the resultant custom metrics to the controller. ## Related issue number <!-- For example: "Closes ray-project#1234" --> ## Checks - [x] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [x] I've run `scripts/format.sh` to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [x] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [x] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: Arthur Leung <[email protected]> Co-authored-by: Arthur Leung <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
snorkelopstesting1-a11y
pushed a commit
to snorkel-marlin-repos/ray-project_ray_pr_56005_88d9466a-0611-46d8-b978-1b015005f3d2
that referenced
this pull request
Oct 11, 2025
Original PR #56005 by arcyleung Original: ray-project/ray#56005
snorkelopstesting1-a11y
added a commit
to snorkel-marlin-repos/ray-project_ray_pr_56005_88d9466a-0611-46d8-b978-1b015005f3d2
that referenced
this pull request
Oct 11, 2025
…rt to controller Merged from original PR #56005 Original: ray-project/ray#56005
snorkelopstesting1-a11y
pushed a commit
to snorkel-marlin-repos/ray-project_ray_pr_56005_a7c4be8c-a6e2-4aac-8af9-a2f347b474a0
that referenced
this pull request
Oct 11, 2025
Original PR #56005 by arcyleung Original: ray-project/ray#56005
snorkelopstesting1-a11y
added a commit
to snorkel-marlin-repos/ray-project_ray_pr_56005_a7c4be8c-a6e2-4aac-8af9-a2f347b474a0
that referenced
this pull request
Oct 11, 2025
…rt to controller Merged from original PR #56005 Original: ray-project/ray#56005
6 of 8 tasks
snorkelopstesting4-web
pushed a commit
to snorkel-marlin-repos/ray-project_ray_pr_56005_1f64f249-9bbc-4b3e-8106-afd8a3b1cb58
that referenced
this pull request
Oct 22, 2025
Original PR #56005 by arcyleung Original: ray-project/ray#56005
snorkelopstesting4-web
added a commit
to snorkel-marlin-repos/ray-project_ray_pr_56005_1f64f249-9bbc-4b3e-8106-afd8a3b1cb58
that referenced
this pull request
Oct 22, 2025
…rt to controller Merged from original PR #56005 Original: ray-project/ray#56005
landscapepainter
pushed a commit
to landscapepainter/ray
that referenced
this pull request
Nov 17, 2025
…roject#56005) ## Why are these changes needed? Required by https://docs.google.com/document/d/1KtMUDz1O3koihG6eh-QcUqudZjNAX3NsqqOMYh3BoWA/edit?tab=t.0#heading=h.jo7hyr9zpyw <img width="1563" height="901" alt="image" src="https://github.com/user-attachments/assets/f6405710-2622-41d3-b5a5-b2440b705ddd" /> Allows each replica to call a method `record_autoscaling_stats` and sends the resultant custom metrics to the controller. ## Related issue number <!-- For example: "Closes ray-project#1234" --> ## Checks - [x] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [x] I've run `scripts/format.sh` to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [x] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [x] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: Arthur Leung <[email protected]> Co-authored-by: Arthur Leung <[email protected]>
Future-Outlier
pushed a commit
to Future-Outlier/ray
that referenced
this pull request
Dec 7, 2025
…roject#56005) ## Why are these changes needed? Required by https://docs.google.com/document/d/1KtMUDz1O3koihG6eh-QcUqudZjNAX3NsqqOMYh3BoWA/edit?tab=t.0#heading=h.jo7hyr9zpyw <img width="1563" height="901" alt="image" src="https://github.com/user-attachments/assets/f6405710-2622-41d3-b5a5-b2440b705ddd" /> Allows each replica to call a method `record_autoscaling_stats` and sends the resultant custom metrics to the controller. ## Related issue number <!-- For example: "Closes #1234" --> ## Checks - [x] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [x] I've run `scripts/format.sh` to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [x] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [x] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: Arthur Leung <[email protected]> Co-authored-by: Arthur Leung <[email protected]> Signed-off-by: Future-Outlier <[email protected]>
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.
Why are these changes needed?
Required by

https://docs.google.com/document/d/1KtMUDz1O3koihG6eh-QcUqudZjNAX3NsqqOMYh3BoWA/edit?tab=t.0#heading=h.jo7hyr9zpyw
Allows each replica to call a method
record_autoscaling_statsand sends the resultant custom metrics to the controller.Related issue number
Checks
git commit -s) in this PR.scripts/format.shto lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/under thecorresponding
.rstfile.