ttrpc
ttrpc copied to clipboard
Add OpenTelemetry tracing instrumentation support
Provide client and server interceptors which instrument RPC requests with OpenTracing telemetry spans, based on the gRPC tracing module go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/[email protected]
.
The client sets the metadata on the request before calling the interceptor, and the method to set the metadata on the request is unexported, so interceptors cannot alter the request's metadata (other than by directly manipulating the request's Metadata []*KeyValue
field and possibly getting it wrong by appending duplicate keys). The otelttrpc client interceptor therefore cannot propagate the trace context using the same tools available to application code. One possible solution would be to move the metadata.setRequest
call into (*Client).dispatch
so that metadata can be manipulated by the interceptor in the same manner as google.golang.org/grpc
, but that would raise some hairy questions about the semantics of the Metadata
field on the request struct passed into the interceptor. If the migration away from gogo/protobuf is going to a breaking change, perhaps a breaking change to the UnaryClientInterceptor
type is in order to make those questions go away by not exposing the actual to-be-marshaled Request
value to the interceptor?
@corhere are you still working on this PR? I think this is useful to have and we have had a few requests to add ttrpc tracing in containerd.
@swagatbora90 no, I am not working on this PR. You are welcome to take it over.