Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes to get ray serve responding on REST API calls when distribute… #49730

Draft
wants to merge 2 commits into
base: releases/2.40.0
Choose a base branch
from

Conversation

venkatkalluru
Copy link

…d tracing is enabled

Why are these changes needed?

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • 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.
  • 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
    • Unit tests
    • Release tests
    • This PR is not tested :(

@@ -0,0 +1,364 @@
# from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
Copy link
Author

Choose a reason for hiding this comment

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

FastAPIInstrumentor instrumentation was not working and was throwing errors so I added to add this.
This is taken from https://github.com/anyscale/tracing-example/blob/main/fp.py



@serve.deployment(num_replicas=1, ray_actor_options={"num_cpus": 0.2, "num_gpus": 0})
@_inject_tracing_into_class
Copy link
Author

Choose a reason for hiding this comment

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

Also, we have to do this injection on all the serve deployments or else we get the same error described in the issue, where it complains with the following error.

TypeError: got an unexpected keyword argument '_ray_trace_ctx'

@@ -0,0 +1,33 @@
from starlette.requests import Request
Copy link
Author

@venkatkalluru venkatkalluru Jan 9, 2025

Choose a reason for hiding this comment

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

Added this example to show that on all the serve deployments we have to do tracing injection and see the comment below.

to deploy and test do the following..

ray start '--resources={"no_gpu": 100}' --head --port 7990 --tracing-startup-hook ray.util.tracing.setup_tempo_tracing:setup_tracing

and then

serve run test_tracing_with_deployment:translator_app

and send traffic as shown in the below example.

curl -X POST -H "Content-Type: application/json" -d '"Hello, how are you?"' http://127.0.0.1:8000/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant