opentelemetry-go-contrib icon indicating copy to clipboard operation
opentelemetry-go-contrib copied to clipboard

Implement `grpc.StatsHandler` for grpc instrumentation

Open bogdandrutu opened this issue 5 years ago • 2 comments

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(""))))

bogdandrutu avatar Jul 31 '20 21:07 bogdandrutu

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.

dackroyd avatar Aug 04 '20 04:08 dackroyd

I quickly implemented https://github.com/bakins/otel-grpc-statshandler as I ran into similar issues. Needs more testing, etc.

bakins avatar Sep 15 '22 12:09 bakins

@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.

fatsheep9146 avatar Nov 09 '22 04:11 fatsheep9146

any news ?

vtolstov avatar Sep 06 '23 19:09 vtolstov

any news ?

@vtolstov #3002 is waiting to be merged to solve this issue

fatsheep9146 avatar Sep 06 '23 22:09 fatsheep9146