open-telemetry / opentelemetry-go-contrib

Collection of extensions for OpenTelemetry-Go.
https://opentelemetry.io/
Apache License 2.0
1.14k stars 542 forks source link

Add metrics instrumentation for google.golang.org/grpc #2840

Open fatsheep9146 opened 1 year ago

fatsheep9146 commented 1 year ago

Background

google.golang.org/grpc is already instrumented with library go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc, but this library only covers trace.

So this issue will try to complete all the metrics for google.golang.org/grpc which are already defined in https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/semantic_conventions/rpc-metrics.md

Metrics

Instruments

Server

Client

Tasks

dmathieu commented 1 year ago

Related: #2782.

fatsheep9146 commented 1 year ago

I think this issue is now blocked by #197

Sovietaced commented 12 months ago

Anyone mind if I add a metrics implementation to the client interceptors?

ash2k commented 12 months ago

I think interceptors are going to be deprecated soon and then removed. https://github.com/open-telemetry/opentelemetry-go-contrib/issues/4318, https://github.com/open-telemetry/opentelemetry-go-contrib/issues/4319. Stats handlers are better - it's hard to do metrics with streaming RPCs as that would require wrapping the stream. It's very clean with stats handlers as gRPC just calls its methods.

Sovietaced commented 12 months ago

I think interceptors are going to be deprecated soon and then removed. #4318, #4319. Stats handlers are better - it's hard to do metrics with streaming RPCs as that would require wrapping the stream. It's very clean with stats handlers as gRPC just calls its methods.

Makes sense, thanks.