Class TraceContextInterceptor (6.83.0)

public class TraceContextInterceptor implements ClientInterceptor

Intercepts all gRPC calls and injects trace context related headers to propagate trace context to Spanner. This class takes reference from OpenTelemetry's JAVA instrumentation library for gRPC. https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/9ecf7965aa455d41ea8cc0761b6c6b6eeb106324/instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/TracingClientInterceptor.java#L27

Inheritance

java.lang.Object > TraceContextInterceptor

Implements

io.grpc.ClientInterceptor

Constructors

TraceContextInterceptor(OpenTelemetry openTelemetry)

public TraceContextInterceptor(OpenTelemetry openTelemetry)
Parameter
Name Description
openTelemetry io.opentelemetry.api.OpenTelemetry

Methods

<ReqT,RespT>interceptCall(MethodDescriptor<ReqT,RespT> method, CallOptions callOptions, Channel next)

public ClientCall<ReqT,RespT> <ReqT,RespT>interceptCall(MethodDescriptor<ReqT,RespT> method, CallOptions callOptions, Channel next)
Parameters
Name Description
method io.grpc.MethodDescriptor<ReqT,RespT>
callOptions io.grpc.CallOptions
next io.grpc.Channel
Returns
Type Description
io.grpc.ClientCall<ReqT,RespT>