opentelemetry-go-contrib
opentelemetry-go-contrib copied to clipboard
Implement `grpc.StatsHandler` for grpc instrumentation
See OpenCensus https://godoc.org/go.opencensus.io/plugin/ocgrpc
Much easier to use and implement, now:
s := grpc.NewServer(
grpc.UnaryInterceptor(grpctrace.UnaryServerInterceptor(global.Tracer(""))),
grpc.StreamInterceptor(grpctrace.StreamServerInterceptor(global.Tracer(""))),
)
After:
s := grpc.NewServer(grpc.StatsHandler(&grpctrace.NewServerHandler(global.Tracer(""))))
The stats handler approach also allows cases to be captured that the interceptors do not, like a failure to decode the message. We ran into that case with OpenTracing using interceptors where a mismatching proto definition was used between the client and server. There was no indication in metrics, traces or logs that a request had even reached the server, making the issue more difficult to diagnose.
I quickly implemented https://github.com/bakins/otel-grpc-statshandler as I ran into similar issues. Needs more testing, etc.
@MrAlias Could you assign this to me, if you do not have enough bandwidth? Since I think #2840 now is slightly blocked by this issue, I think it is a proper time to solve this problem for now and then enrich more metric for grpc.
any news ?
any news ?
@vtolstov #3002 is waiting to be merged to solve this issue