Repository navigation
[Serve] Skip tracing test in gRPC mode - #60209
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
3bc85f9 to
457b6c1
Compare
For gRPC requests, _ray_trace_ctx is not injected into kwargs since there's no Ray actor call. This change: 1. Sets request_meta.tracing_context in the router when tracing is enabled 2. Falls back to request_metadata.tracing_context in _unpack_proxy_args when _ray_trace_ctx is not present in kwargs This ensures tracing context is properly propagated for gRPC inter-deployment communication. Signed-off-by: Seiji Eicher <[email protected]>
457b6c1 to
7f30d77
Compare
| # Add context to request meta to link | ||
| # traces collected in the replica. | ||
| if _is_tracing_enabled(): | ||
| request_meta.tracing_context = _DictPropagator.inject_current_context() | ||
| else: | ||
| request_meta.tracing_context = None |
There was a problem hiding this comment.
Let's revert this change since it's accessing private methods on core. We ca rethink this implementation more generally in the future.
There was a problem hiding this comment.
@abrarsheikh shall we skip the test in the meantime?
Reverts the fix that used private Ray core tracing APIs. Instead, skip the test in gRPC mode until a proper solution is implemented. The tracing context propagation for gRPC inter-deployment requests is tracked in: ray-project#60223 Signed-off-by: Seiji Eicher <[email protected]>
Per reviewer feedback, removes the router.py changes that used private Ray core APIs (_DictPropagator, _is_tracing_enabled) and the test skip. Keeps only the replica.py fallback logic that reads tracing context from request_metadata.tracing_context when _ray_trace_ctx is not in kwargs. Signed-off-by: Seiji Eicher <[email protected]>
| # We fall back to using that if _ray_trace_ctx is not in kwargs. | ||
| ray_trace_ctx = request_kwargs.pop("_ray_trace_ctx", None) | ||
| if ray_trace_ctx is None: | ||
| ray_trace_ctx = request_metadata.tracing_context |
There was a problem hiding this comment.
Fallback relies on field that is never populated
Medium Severity
The fallback to request_metadata.tracing_context will always return None because this field is never populated anywhere in the codebase. The tracing_context attribute in RequestMetadata has a default value of None and no code ever assigns a non-None value to it. This makes the fallback mechanism ineffective for gRPC tracing as described in the PR.
| ray_trace_ctx = request_kwargs.pop("_ray_trace_ctx", None) | ||
| if ray_trace_ctx is None: | ||
| ray_trace_ctx = getattr(request_metadata, "tracing_context", None) or {} |
There was a problem hiding this comment.
Empty dict fallback masks missing tracing context
Low Severity
The or {} fallback changes the semantics when neither _ray_trace_ctx nor request_metadata.tracing_context is present. Previously, ray_trace_ctx would be None (indicating no tracing), but now it becomes {} (empty dict). This could mask tracing configuration failures since tests checking _ray_trace_ctx is not None would incorrectly pass with an empty dict, hiding cases where tracing context wasn't properly propagated.
There was a problem hiding this comment.
@abrarsheikh request_metadata.tracing_context is not set either, btw, so or {} would be needed to pass the test. Not sure if you had something else in mind; I think this is basically equivalent to skipping the test.
(Until we decide a better way than accessing private Core APIs)
When _ray_trace_ctx is not in kwargs (gRPC path), fall back to request_metadata.tracing_context or an empty dict. This ensures the trace context is never None, which allows tracing-aware code to function without crashing in gRPC mode. Signed-off-by: Seiji Eicher <[email protected]>
43fd898 to
e1d4857
Compare
Tracing context propagation is not yet supported when RAY_SERVE_USE_GRPC_BY_DEFAULT=1 is enabled. Skip the test until a proper solution is implemented. Tracked in ray-project#60223 Signed-off-by: Seiji Eicher <[email protected]>
## 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. https://github.com/ray-project/ray/blob/8882b9045ab8cb3b1764f8b6dbc13aabb1113ff8/python/ray/util/tracing/tracing_helper.py#L165-L170 --------- Signed-off-by: Peter Nguyen <[email protected]>
Why are these changes needed?
When
RAY_SERVE_USE_GRPC_BY_DEFAULT=1, inter-deployment calls use gRPC instead of Ray actor calls. In this mode,_ray_trace_ctxis not injected into kwargs since gRPC calls bypass Ray's tracing decorators.Tracing context propagation for gRPC mode requires additional work to properly capture and forward the context. This PR skips the
test_deployment_remote_calls_with_tracingtest in gRPC mode until a proper solution is implemented.Related issue number
Tracking issue: #60223
Checks
git commit -s) in this PR.scripts/format.shto lint the changes in this PR.