lens.contrib.ray
Ray context propagation helpers.
Provides utilities for propagating OTel trace context across Ray remote calls, enabling distributed traces that span driver -> worker boundaries.
Module Contents
Functions
API
Extract trace context from a Ray carrier.
Call this on the worker side to resume the trace.
Parameters:
Dict with W3C trace context headers. If None, returns an empty context.
Returns:
An OTel Context.
Create a carrier dict with the current trace context for Ray.
Call this on the driver side before dispatching a remote call.
Returns: dict
A dict containing W3C trace context headers.
Dispatch a Ray remote call with trace context injection.
Parameters:
The Ray remote function/method reference.
Positional arguments for the remote call.
Pre-built carrier (if None, injects current context).
Keyword arguments for the remote call.
Returns:
The Ray ObjectRef from the remote call.
Wrapper for Ray remote methods that auto-injects/extracts trace context.
Apply to worker methods to automatically propagate traces across Ray remote boundaries.
Parameters:
The function to wrap.
OTel tracer. Defaults to the global tracer.
Returns: Callable
Wrapped function that accepts _otel_carrier kwarg.