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

[Misc] Respect trace headers in grpc server #49

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ronensc
Copy link
Contributor

@ronensc ronensc commented Jun 18, 2024

This PR updates the gRPC server to include the trace context of an incoming request in the reported trace.
It's a follow up on vllm-project/vllm#4687.

How to test this PR:

  1. Install OpenTelemetry packages:

    pip install \
        opentelemetry-sdk \
        opentelemetry-api \
        opentelemetry-exporter-otlp \
        opentelemetry-semantic-conventions-ai
    
  2. Start Jaeger in a docker container:

    # From: https://www.jaegertracing.io/docs/1.57/getting-started/
    docker run --rm --name jaeger \
        -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
        -p 6831:6831/udp \
        -p 6832:6832/udp \
        -p 5778:5778 \
        -p 16686:16686 \
        -p 4317:4317 \
        -p 4318:4318 \
        -p 14250:14250 \
        -p 14268:14268 \
        -p 14269:14269 \
        -p 9411:9411 \
        jaegertracing/all-in-one:1.57
    
  3. In a new shell, export Jaeger IP:

    export JAEGER_IP=$(docker inspect   --format '{{ .NetworkSettings.IPAddress }}' jaeger)
    export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=grpc://$JAEGER_IP:4317
    

    Then set vLLM's service name for OpenTelemetry, enable insecure connections to Jaeger and run vLLM with the grpc endpoint:

    export OTEL_SERVICE_NAME="vllm-server"
    export OTEL_EXPORTER_OTLP_TRACES_INSECURE=true
    python -m vllm.entrypoints.openai.api_server --model="facebook/opt-125m" --otlp-traces-endpoint="$OTEL_EXPORTER_OTLP_TRACES_ENDPOINT" --grpc-port 50051
    
  4. In a new shell, send requests with trace context from a dummy grpc client:

    export JAEGER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' jaeger)
    export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=grpc://$JAEGER_IP:4317
    export OTEL_EXPORTER_OTLP_TRACES_INSECURE=true
    export OTEL_SERVICE_NAME="client-service"
    python examples/production_monitoring/dummy_client_grpc.py
    
  5. Open Jaeger webui: http://localhost:16686/ and find two traces: one from the dummy client containing the prompt text and one from vLLM containing metadata about the request.

BEFORE SUBMITTING, PLEASE READ THE CHECKLIST BELOW AND FILL IN THE DESCRIPTION ABOVE


PR Checklist (Click to Expand)

Thank you for your contribution to vLLM! Before submitting the pull request, please ensure the PR meets the following criteria. This helps vLLM maintain the code quality and improve the efficiency of the review process.

PR Title and Classification

Only specific types of PRs will be reviewed. The PR title is prefixed appropriately to indicate the type of change. Please use one of the following:

  • [Bugfix] for bug fixes.
  • [CI/Build] for build or continuous integration improvements.
  • [Doc] for documentation fixes and improvements.
  • [Model] for adding a new model or improving an existing model. Model name should appear in the title.
  • [Frontend] For changes on the vLLM frontend (e.g., OpenAI API server, LLM class, etc.)
  • [Kernel] for changes affecting CUDA kernels or other compute kernels.
  • [Core] for changes in the core vLLM logic (e.g., LLMEngine, AsyncLLMEngine, Scheduler, etc.)
  • [Hardware][Vendor] for hardware-specific changes. Vendor name should appear in the prefix (e.g., [Hardware][AMD]).
  • [Misc] for PRs that do not fit the above categories. Please use this sparingly.

Note: If the PR spans more than one category, please include all relevant prefixes.

Code Quality

The PR need to meet the following code quality standards:

  • We adhere to Google Python style guide and Google C++ style guide.
  • Pass all linter checks. Please use format.sh to format your code.
  • The code need to be well-documented to ensure future contributors can easily understand the code.
  • Include sufficient tests to ensure the project to stay correct and robust. This includes both unit tests and integration tests.
  • Please add documentation to docs/source/ if the PR modifies the user-facing behaviors of vLLM. It helps vLLM user understand and utilize the new features or changes.

Notes for Large Changes

Please keep the changes as concise as possible. For major architectural changes (>500 LOC excluding kernel/data/config/test), we would expect a GitHub issue (RFC) discussing the technical design and justification. Otherwise, we will tag it with rfc-required and might not go through the PR.

What to Expect for the Reviews

The goal of the vLLM team is to be a transparent reviewing machine. We would like to make the review process transparent and efficient and make sure no contributor feel confused or frustrated. However, the vLLM team is small, so we need to prioritize some PRs over others. Here is what you can expect from the review process:

  • After the PR is submitted, the PR will be assigned to a reviewer. Every reviewer will pick up the PRs based on their expertise and availability.
  • After the PR is assigned, the reviewer will provide status update every 2-3 days. If the PR is not reviewed within 7 days, please feel free to ping the reviewer or the vLLM team.
  • After the review, the reviewer will put an action-required label on the PR if there are changes required. The contributor should address the comments and ping the reviewer to re-review the PR.
  • Please respond to all comments within a reasonable time frame. If a comment isn't clear or you disagree with a suggestion, feel free to ask for clarification or discuss the suggestion.

Thank You

Finally, thank you for taking the time to read these guidelines and for your interest in contributing to vLLM. Your contributions make vLLM a great tool for everyone!

@ronensc
Copy link
Contributor Author

ronensc commented Jun 19, 2024

Rebased the PR once main has rebased to include vllm-project/vllm#4687.

@ronensc
Copy link
Contributor Author

ronensc commented Jun 19, 2024

The failure in the Build / build (pull_request) check seems unrelated to this PR. It error occurs while building the UBI docker image:
https://github.com/IBM/vllm/actions/runs/9580069640/job/26413904119#step:10:3159

...
Dockerfile.ubi:294
--------------------
 293 |     # Install libsodium for Tensorizer encryption
 294 | >>> RUN --mount=type=bind,from=libsodium-builder,src=/usr/src/libsodium,target=/usr/src/libsodium \
 295 | >>>     cd /usr/src/libsodium \
 296 | >>>     && make install
 297 |     ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
--------------------
ERROR: failed to solve: process "/bin/sh -c cd /usr/src/libsodium     && make install" did not complete successfully: exit code: 2
Error: buildx failed with: ERROR: failed to solve: process "/bin/sh -c cd /usr/src/libsodium     && make install" did not complete successfully: exit code: 2

Would a rerun make it pass?

@joerunde
Copy link
Collaborator

Would a rerun make it pass?

I hope so!

I'll look into this more though

Signed-off-by: Ronen Schaffer <[email protected]>
Signed-off-by: Ronen Schaffer <[email protected]>
@ronensc
Copy link
Contributor Author

ronensc commented Jun 24, 2024

I rebased once again and added OTel dependencies to the docker image. To make it work, I had to upgrade the VLLM_WHEEL_VERSION to the latest version and remove the pinning grpcio-tools==1.63.0. Otherwise, I encoutered the following known error:

ERROR: Cannot install grpcio-tools==1.63.0 and opentelemetry-exporter-otlp-proto-grpc because these package versions have conflicting dependencies.
The conflict is caused by:
    grpcio-tools 1.63.0 depends on protobuf<6.0dev and >=5.26.1
    opentelemetry-proto 1.25.0 depends on protobuf<5.0 and >=3.19

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

Copy link
Collaborator

@joerunde joerunde left a comment

Choose a reason for hiding this comment

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

🌶️🌶️🌶️

@joerunde
Copy link
Collaborator

@prashantgupta24 one more for https://github.com/opendatahub-io/vllm-tgis-adapter

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.

3 participants