langsmith-trace and optional baggage for metadata/tags).
Example client-server setup:
- Trace starts on client
- Continues on server
Distributed tracing in Python
TracingMiddleware.
The
TracingMiddleware class was added in langsmith==0.1.133.langsmith_extra:
tracing_context context manager. You can also directly specify the parent run context in the langsmith_extra parameter of a method wrapped with @traceable.
Distributed tracing in TypeScript
Distributed tracing in TypeScript requires
langsmith version >=0.1.31langsmith-trace and baggage header values, which we can pass to the server:
withRunTree helper, which will ensure the run tree is propagated within traceable invocations.
Distributed tracing in Java
Java supports distributed tracing using OpenTelemetry context propagation with the W3C Trace Context standard (traceparent header).
Java distributed tracing uses the W3C Trace Context standard (
traceparent and tracestate headers) via OpenTelemetry’s context propagation API. The trace context is automatically propagated across service boundaries when you inject and extract the context using GlobalOpenTelemetry.getPropagators().