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

Add metrics instrumentation for google.golang.org/grpc

Open fatsheep9146 opened this issue 3 years ago • 5 comments

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

  • [x] rpc.server.duration #2700
  • [ ] rpc.server.request.size
  • [ ] rpc.server.response.size
  • [ ] rpc.server.requests_per_rpc
  • [ ] rpc.server.responses_per_rpc

Client

  • [ ] rpc.client.duration
  • [ ] rpc.client.request.size
  • [ ] rpc.client.response.size
  • [ ] rpc.client.requests_per_rpc
  • [ ] rpc.client.responses_per_rpc

Tasks

  • Code complete:
    • [ ] Comprehensive unit tests.
    • [ ] End-to-end integration tests.
    • [ ] Tests all passing.
    • [ ] Instrumentation functionality verified.
  • Documented
  • Examples
    • [ ] Dockerfile file to build example application.
    • [ ] docker-compose.yml to run example in a docker environment to demonstrate instrumentation.

fatsheep9146 avatar Oct 07 '22 02:10 fatsheep9146

Related: #2782.

dmathieu avatar Oct 07 '22 07:10 dmathieu

I think this issue is now blocked by #197

fatsheep9146 avatar Nov 09 '22 04:11 fatsheep9146

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

Sovietaced avatar Sep 25 '23 22:09 Sovietaced

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.

ash2k avatar Sep 26 '23 02:09 ash2k

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.

Sovietaced avatar Sep 26 '23 03:09 Sovietaced