Fix llm_request trace context propagation#38678
Open
will-deines wants to merge 3 commits intovllm-project:mainfrom
Open
Fix llm_request trace context propagation#38678will-deines wants to merge 3 commits intovllm-project:mainfrom
will-deines wants to merge 3 commits intovllm-project:mainfrom
Conversation
Assisted-by: OpenAI Codex Signed-off-by: Will Deines <will@garr.io>
Assisted-by: OpenAI Codex Signed-off-by: Will Deines <will@garr.io>
Co-authored-by: OpenAI Codex Signed-off-by: Will Deines <will@garr.io>
Contributor
There was a problem hiding this comment.
Code Review
This pull request enhances OpenTelemetry tracing by improving trace context propagation and header handling. Key changes include making trace header extraction case-insensitive, adding a mechanism to retrieve trace headers from the current OTel context when request headers are missing, and introducing a use_environment_context flag to control fallback behavior to environment variables. Additionally, trace headers are now normalized in the V1 engine input processor, and comprehensive tests have been added to verify these improvements. I have no feedback to provide.
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.
Summary
llm_requestinstead of falling back to ambient process environment state during final span emissionllm_requeststays in the parent distributed trace while receiving its own unique span idDuplicate-work check
llm_requestspan identity.vllm-project/vllm:main.Testing
./.venv/bin/python -m pytest tests/tracing/test_otel.py -v -s(5 passed)PRE_COMMIT_HOME=/tmp/pre-commit-vllm-upstream-tracing XDG_CACHE_HOME=/tmp/xdg-cache-vllm-upstream-tracing NPM_CONFIG_CACHE=/tmp/npm-cache-vllm-upstream-tracing ./.venv/bin/pre-commit run --files vllm/tracing/utils.py vllm/tracing/otel.py vllm/tracing/__init__.py vllm/entrypoints/openai/engine/serving.py vllm/entrypoints/pooling/base/serving.py vllm/v1/engine/input_processor.py vllm/v1/engine/output_processor.py tests/tracing/test_otel.py(passed)AI assistance
AI assistance was used to draft and implement this change. The submitter reviewed the final diff and validated the tests above.