- Notifications
You must be signed in to change notification settings - Fork 4k
Description
Hello,
we are writing OpenTelemetry based Java agent https://github.com/hypertrace/javaagent. The agent does bytecode manipulation via ByteBuddy however the implementation just installs gRPC interceptors - https://github.com/hypertrace/javaagent/blob/main/instrumentation/grpc-1.5/src/main/java/io/opentelemetry/instrumentation/hypertrace/grpc/v1_5/server/GrpcServerBodyInstrumentation.java#L60
In the interceptors we would like to capture HTTP2 headers - authority, method, scheme and path. However this are not propagated from the transport (e.g. netty) to the interceptors. Is there any supported way to access these headers in gRPC interceptors?
Currently our implementation uses hacks and it instruments io.grpc.netty.Utils#convertHeaders. The instrumentation adds HTTP2 headers into gRPC Metadata object. This works well for the server side, although we don't like that we store additional data to Metadata. For the client it does not work and we had to instrument io.grpc.netty.Utils#convertClientHeaders and put the HTTP2 headers directly to span object - accessed via thread local - this does not work for the first request when DelayedStream is used see hypertrace/javaagent#109 (comment).
Any hits are appreciated.