Skip to content

export target details via applications rest api#51767

Merged
zcin merged 18 commits intomasterfrom
SERVE-615-sheikh-port
Apr 11, 2025
Merged

export target details via applications rest api#51767
zcin merged 18 commits intomasterfrom
SERVE-615-sheikh-port

Conversation

@abrarsheikh
Copy link
Copy Markdown
Contributor

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 Sheikh <abrar@anyscale.com>
Signed-off-by: Abrar Sheikh <abrar@anyscale.com>
Signed-off-by: Abrar Sheikh <abrar@anyscale.com>
Signed-off-by: Abrar Sheikh <abrar@anyscale.com>
Signed-off-by: Abrar Sheikh <abrar@anyscale.com>
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 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>
Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: abrar <abrar@anyscale.com>
Copy link
Copy Markdown
Contributor

@zcin zcin left a comment

Choose a reason for hiding this comment

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

Nice! could you update the PR description with the new schema?

@zcin zcin added the go add ONLY when ready to merge, run all tests label Apr 10, 2025
@zcin zcin merged commit ea9c303 into master Apr 11, 2025
5 checks passed
@zcin zcin deleted the SERVE-615-sheikh-port branch April 11, 2025 17:20
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-backlog go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants