export target details via applications rest api#51767
Merged
Conversation
Signed-off-by: Abrar Sheikh <abrar@anyscale.com>
Signed-off-by: Abrar Sheikh <abrar@anyscale.com>
Signed-off-by: Abrar Sheikh <abrar@anyscale.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates the Serve API response to include target details (IP and ports) for both HTTP and gRPC protocols, facilitating easier ALB configuration in cloud environments.
- Introduces new models (Target and TargetInfo) in the schema.
- Updates ProxyState and Controller to compute and return target details.
- Enhances tests to validate the target details in both the controller and dashboard endpoints.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| python/ray/serve/tests/unit/test_proxy_state.py | Adds tests for new get_target_info functionality. |
| python/ray/serve/tests/test_controller.py | Updates expected JSON response with target_details. |
| python/ray/serve/schema.py | Adds Target and TargetInfo models and integrates target_details in ServeInstanceDetails. |
| python/ray/serve/_private/utils.py | Introduces is_grpc_enabled helper for gRPC configuration checks. |
| python/ray/serve/_private/proxy_state.py | Implements get_target_info method to collect proxy target details. |
| python/ray/serve/_private/proxy.py | Refactors gRPC enabled check using is_grpc_enabled. |
| python/ray/serve/_private/controller.py | Adds get_target_details to include target information in instance details. |
| python/ray/dashboard/modules/serve/tests/test_serve_dashboard.py | Enhances tests to validate target_details in dashboard responses. |
Comments suppressed due to low confidence (1)
python/ray/dashboard/modules/serve/tests/test_serve_dashboard.py:479
- There is a potential inconsistency in the expected HTTP port between tests: test_controller expects port 8000 while this dashboard test asserts 8005. Please verify and consolidate the configuration to ensure consistent port values across endpoints.
assert target.port == 8005
Signed-off-by: Abrar Sheikh <abrar@anyscale.com>
Signed-off-by: Abrar Sheikh <abrar@anyscale.com>
Signed-off-by: Abrar Sheikh <abrar@anyscale.com>
zcin
approved these changes
Apr 10, 2025
Contributor
zcin
left a comment
There was a problem hiding this comment.
Nice! could you update the PR description with the new schema?
han-steve
pushed a commit
to han-steve/ray
that referenced
this pull request
Apr 11, 2025
change the response from `/API/serve/applications` to include target details. See the sample output for reference Request: `curl --location '127.0.0.1:8265/api/serve/applications/'` Response: https://gist.github.com/abrarsheikh/282078d3fc6c06f9455bc0fcf74dcf4e Why Include Target Details? By exposing the IP and ports of all proxies, we can simplify the configuration of an ALB in GCP/AWS. This update includes both HTTP and gRPC ports, as these are the two protocols supported by Serve. Why Is prefix_route Always Set to /? In the current Ray Serve architecture, all requests first reach the proxy, which then routes them to the appropriate replica. Since the ALB only needs to forward requests to any available proxy, it does not require knowledge of the exact prefix route. Hence, prefix_route is always set to /. --------- Signed-off-by: Abrar Sheikh <abrar@anyscale.com> Signed-off-by: abrar <abrar@anyscale.com> Co-authored-by: Cindy Zhang <cindyzyx9@gmail.com> Signed-off-by: Steve Han <stevehan2001@gmail.com>
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.
change the response from
/API/serve/applicationsto include target details. See the sample output for referenceRequest:
curl --location '127.0.0.1:8265/api/serve/applications/'Response: https://gist.github.com/abrarsheikh/282078d3fc6c06f9455bc0fcf74dcf4e
Why Include Target Details?
By exposing the IP and ports of all proxies, we can simplify the configuration of an ALB in GCP/AWS. This update includes both HTTP and gRPC ports, as these are the two protocols supported by Serve.
Why Is prefix_route Always Set to /?
In the current Ray Serve architecture, all requests first reach the proxy, which then routes them to the appropriate replica. Since the ALB only needs to forward requests to any available proxy, it does not require knowledge of the exact prefix route. Hence, prefix_route is always set to /.