Skip to content

[Serve] Propagate tracing context in gRPC inter-deployment mode - #61089

Merged
abrarsheikh merged 2 commits into
ray-project:masterfrom
petern48:trace_serve
Feb 21, 2026
Merged

abrarsheikh merged 2 commits into
ray-project:masterfrom
petern48:trace_serve

Conversation

@petern48

Copy link
Copy Markdown
Contributor

Description

Previously in ba5cd1c, trace context propagation was extended to Ray Serve. However, it missed the case for propagating the context through the gRPC path. #60209 applied a test skip for the gRPC case as a short-term solution for passing CI until support was properly extended to gRPC.

This PR extends context propagation support to gRPC by serializing the trace context into the request.

Related issues

Fixes #60223

Additional information

The implementation uses an existing Ray helper function that calls opentelemetry inject.

class _DictPropagator:
def inject_current_context() -> Dict[Any, Any]:
"""Inject trace context into otel propagator."""
context_dict: Dict[Any, Any] = {}
_opentelemetry.propagate.inject(context_dict)
return context_dict

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request correctly extends tracing context propagation to Ray Serve's gRPC inter-deployment mode. The change involves manually injecting the trace context into the request kwargs for gRPC calls, as they bypass the standard Ray actor RPC mechanism. The implementation is clean, uses existing helpers, and is well-commented. The corresponding test case is also correctly enabled by removing the skipif decorator, ensuring the fix is validated. The changes look good and I have no further suggestions.

@petern48
petern48 marked this pull request as ready for review February 17, 2026 00:23
@petern48
petern48 requested a review from a team as a code owner February 17, 2026 00:23
@ray-gardener ray-gardener Bot added the community-contribution Contributed by the community label Feb 17, 2026

@harshit-anyscale harshit-anyscale left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm, thanks for contributing!

@harshit-anyscale harshit-anyscale added the go add ONLY when ready to merge, run all tests label Feb 17, 2026
@petern48

Copy link
Copy Markdown
Contributor Author

@abrarsheikh Would you want to take a quick look, given you authored the original commit?

@abrarsheikh
abrarsheikh merged commit c7944e6 into ray-project:master Feb 21, 2026
2 checks passed
@petern48
petern48 deleted the trace_serve branch February 21, 2026 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Serve] Tracing context not propagated in gRPC inter-deployment mode

3 participants