feat: remove grpc_opentracing interceptors, migrate to OTEL stats handler#25
feat: remove grpc_opentracing interceptors, migrate to OTEL stats handler#25
Conversation
…dler Remove grpc_opentracing unary/stream server/client interceptors from the interceptor chain. gRPC tracing is now handled by otelgrpc stats handlers configured at the server/client level in core. - Remove grpc-ecosystem/go-grpc-middleware/tracing/opentracing dependency - Deprecate GRPCClientInterceptor (now returns no-op) - Simplify option handling in DefaultClientInterceptors/StreamInterceptors
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe pull request deprecates the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Removes legacy OpenTracing-based gRPC interceptors from this library and aligns tracing responsibilities with OpenTelemetry otelgrpc stats handlers configured at the gRPC server/client level (in core), while keeping a deprecated shim for the old GRPCClientInterceptor API surface.
Changes:
- Removed
grpc_opentracingunary/stream interceptors from default server/client interceptor chains and stopped filtering opentracing options fromDefaultClient*Interceptors. - Deprecated
GRPCClientInterceptorand changed it to a no-op interceptor for compatibility. - Dropped the
go-grpc-middleware/tracing/opentracingdependency and updated module metadata (go.mod/go.sum), including OTEL-related indirects.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| interceptors.go | Removes OpenTracing interceptors from default chains; deprecates GRPCClientInterceptor as a no-op. |
| go.mod | Removes github.com/grpc-ecosystem/go-grpc-middleware v1 requirement and adds OTEL indirects. |
| go.sum | Cleans up sums after dependency removals/upgrades (incl. OTEL version bump). |
| README.md | Regenerates docs to reflect updated API signatures/line references. |
Comments suppressed due to low confidence (1)
interceptors.go:316
DefaultClientStreamInterceptorsstill acceptsdefaultOpts ...interface{}but no longer uses it after removing the opentracing option filtering. This means callers can keep passing options that will now be silently ignored, which is easy to miss. Consider documenting thatdefaultOptsis intentionally ignored (or renaming the parameter to_), and/or planning to remove this parameter in the next major version.
func DefaultClientStreamInterceptors(defaultOpts ...interface{}) []grpc.StreamClientInterceptor {
ints := []grpc.StreamClientInterceptor{}
if len(streamClientInterceptors) > 0 {
ints = append(ints, streamClientInterceptors...)
}
if useCBClientInterceptors {
ints = append(ints,
nrgrpc.StreamClientInterceptor,
getClientMetrics().StreamClientInterceptor(),
)
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| func GRPCClientInterceptor(options ...interface{}) grpc.UnaryClientInterceptor { | ||
| return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { | ||
| return invoker(ctx, method, req, reply, cc, opts...) | ||
| } |
There was a problem hiding this comment.
No test coverage was added for the new no-op behavior of GRPCClientInterceptor. Since this function is kept for compatibility, it’d be valuable to add a small unit test asserting the returned interceptor calls invoker exactly once and propagates its returned error unchanged (and does not mutate the context/opts).
There was a problem hiding this comment.
Added in e7af476 — TestGRPCClientInterceptorNoOp verifies the returned interceptor calls the invoker exactly once and propagates no error.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Deprecated: GRPCClientInterceptor is no longer needed. gRPC tracing is now handled | ||
| // by otelgrpc.NewClientHandler stats handler configured at the client level. | ||
| // This function is retained for backwards compatibility but returns a no-op interceptor. | ||
| func GRPCClientInterceptor(options ...interface{}) grpc.UnaryClientInterceptor { |
There was a problem hiding this comment.
GRPCClientInterceptor's options parameter is intentionally unused, and it currently shadows the imported options package name within this function scope. Consider making the variadic argument unnamed or _ (e.g., _ ...interface{}) to signal it is ignored and avoid identifier shadowing.
| func GRPCClientInterceptor(options ...interface{}) grpc.UnaryClientInterceptor { | |
| func GRPCClientInterceptor(_ ...interface{}) grpc.UnaryClientInterceptor { |
There was a problem hiding this comment.
Fixed in 2dd8f6f — changed to _ ...interface{} to signal the param is intentionally unused and avoid shadowing the options package.
Summary
Remove grpc_opentracing interceptors from the chain. gRPC tracing is now handled by
otelgrpc.NewServerHandler()/NewClientHandler()stats handlers configured at the server/client level in core.Changes
grpc_opentracing.UnaryServerInterceptorfrom server chaingrpc_opentracing.StreamServerInterceptorfrom server stream chaingrpc_opentracing.StreamClientInterceptorfrom client stream chainDefaultClientInterceptors/DefaultClientStreamInterceptorsGRPCClientInterceptor(returns no-op, kept for backwards compat)grpc-ecosystem/go-grpc-middleware/tracing/opentracingdependencyDepends on
otelgrpc.NewServerHandler()/NewClientHandler()stats handlersTest plan
go test -race ./...— passesmake lint— 0 issuesSummary by CodeRabbit
Release Notes
Deprecated
Chores