-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stats/opentelemetry: separate out interceptors for tracing and metrics #8063
base: master
Are you sure you want to change the base?
stats/opentelemetry: separate out interceptors for tracing and metrics #8063
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8063 +/- ##
==========================================
- Coverage 82.25% 81.93% -0.33%
==========================================
Files 393 410 +17
Lines 39143 40300 +1157
==========================================
+ Hits 32197 33019 +822
- Misses 5616 5901 +285
- Partials 1330 1380 +50
🚀 New features to boost your workflow:
|
69df069
to
71804b4
Compare
@janardhanvissa its not clear what is the intention of this refactor. The follow up from opentelemetry tracing API PR was to create separate interceptors for metrics and traces. Right now, single interceptor is handling both trace and metrics options. Once we have separate unary and stream interceptor each for tracing and metrics, we don't have to check for options disabled/enabled everytime. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see this discussion https://github.com/grpc/grpc-go/pull/7852/files#r1909469701 and modify accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider the same comments for server metrics and tracing as well.
method := info.FullMethodName | ||
if h.options.MetricsOptions.MethodAttributeFilter != nil { | ||
if !h.options.MetricsOptions.MethodAttributeFilter(method) { | ||
method = "other" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are you changing this? This is suppose to be other if the method is part of the filtered list. Please revert and don't make unnecessary changes
} | ||
} | ||
server := internal.ServerFromContext.(func(context.Context) *grpc.Server)(ctx) | ||
if server == nil { // Shouldn't happen, defensive programming. | ||
logger.Error("ctx passed into server side stats handler has no grpc server ref") | ||
method = "other" | ||
method = methodName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same. Please revert
} else { | ||
isRegisteredMethod := internal.IsRegisteredMethod.(func(*grpc.Server, string) bool) | ||
if !isRegisteredMethod(server, method) { | ||
method = "other" | ||
method = methodName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert
func (h *serverStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context { | ||
ri := getRPCInfo(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 185-191 should be down where you are removing attemptInfo stuff. Don't move it at the start. As i mentioned in the office hours, we follow convention of declaring the identifier right before its needed.
} | ||
|
||
// HandleRPC implements per RPC tracing and stats implementation. | ||
// HandleRPC handles per RPC attempt stats for server-side metrics collection. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// HandleRPC handles per RPC attempt stats for server-side metrics collection. | |
// HandleRPC handles per RPC stats implementation. |
func (h *clientStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context { | ||
ri := getRPCInfo(ctx) | ||
var ai *attemptInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same. Please move this entire thing down where you are removing attemptInfo stuff.
|
||
// HandleRPC handles per-RPC attempt stats events for tracing. | ||
func (h *clientTracingHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) { | ||
// Fetch the rpcInfo set by a previously registered stats handler. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need of this comment
) | ||
|
||
const methodName = "other" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again. Why this unnecessary change? Please revert
@@ -44,3 +80,22 @@ func (h *serverStatsHandler) traceTagRPC(ctx context.Context, ai *attemptInfo) ( | |||
ai.traceSpan = span | |||
return ctx, ai | |||
} | |||
|
|||
// HandleRPC handles per-RPC attempt stats events for tracing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// HandleRPC handles per-RPC attempt stats events for tracing. | |
// HandleRPC handles per RPC tracing implementation. |
|
||
// HandleRPC handles per-RPC attempt stats events for tracing. | ||
func (h *serverTracingHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) { | ||
// Fetch the rpcInfo set by a previously registered stats handler. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need of this comment.
RELEASE NOTES: None