A gRPC interceptor centralizes cross-cutting behavior around client or server calls, avoiding duplicated instrumentation and resilience logic across services. section 9.2.2 section 9.3.5
Use interceptors to:
- Collect gRPC metrics and telemetry from client calls, such as Order calling Payment. section 9.2.2
- Attach server-side tracing and metrics to every request reaching a gRPC service. section 9.3.5
- Handle retry operations centrally when building resilient systems. section 9.2.2
Instrumenting an Order-to-Payment call
Add otelgrpc.UnaryClientInterceptor() to the client's grpc.Dial options so requests from Order to Payment produce telemetry. On the Order server, add otelgrpc.UnaryServerInterceptor() to grpc.NewServer. Configure a tracing provider with a Jaeger exporter, batch collection, service metadata, and trace propagation so the complete cross-service flow appears in Jaeger. section 9.2.2 section 9.3.5
...
var opts []grpc.DialOption
opts = append(opts,
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithUnaryInterceptor(otelgrpc.UnaryClientInterceptor()), #1
)
conn, err := grpc.Dial(paymentServiceUrl, opts...)
...
Shows the client-side grpc.Dial configuration that installs an OpenTelemetry unary interceptor. section 9.2.2
import (
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
)
...
grpcServer := grpc.NewServer(
grpc.UnaryInterceptor(otelgrpc.UnaryServerInterceptor()),
)
...
Shows the server-side grpc.NewServer configuration that installs an OpenTelemetry unary interceptor. section 9.3.5

