@@ -63,7 +63,7 @@ func (h *clientStatsHandler) initializeMetrics() {
63
63
64
64
func (h * clientStatsHandler ) unaryInterceptor (ctx context.Context , method string , req , reply any , cc * grpc.ClientConn , invoker grpc.UnaryInvoker , opts ... grpc.CallOption ) error {
65
65
ci := & callInfo {
66
- target : h . determineTarget ( cc ),
66
+ target : cc . CanonicalTarget ( ),
67
67
method : h .determineMethod (method , opts ... ),
68
68
}
69
69
ctx = setCallInfo (ctx , ci )
@@ -83,17 +83,6 @@ func (h *clientStatsHandler) unaryInterceptor(ctx context.Context, method string
83
83
return err
84
84
}
85
85
86
- // determineTarget determines the target to record attributes with. This will be
87
- // "other" if target filter is set and specifies, the target name as is
88
- // otherwise.
89
- func (h * clientStatsHandler ) determineTarget (cc * grpc.ClientConn ) string {
90
- target := cc .CanonicalTarget ()
91
- if f := h .options .MetricsOptions .TargetAttributeFilter ; f != nil && ! f (target ) {
92
- target = "other"
93
- }
94
- return target
95
- }
96
-
97
86
// determineMethod determines the method to record attributes with. This will be
98
87
// "other" if StaticMethod isn't specified or if method filter is set and
99
88
// specifies, the method name as is otherwise.
@@ -108,7 +97,7 @@ func (h *clientStatsHandler) determineMethod(method string, opts ...grpc.CallOpt
108
97
109
98
func (h * clientStatsHandler ) streamInterceptor (ctx context.Context , desc * grpc.StreamDesc , cc * grpc.ClientConn , method string , streamer grpc.Streamer , opts ... grpc.CallOption ) (grpc.ClientStream , error ) {
110
99
ci := & callInfo {
111
- target : h . determineTarget ( cc ),
100
+ target : cc . CanonicalTarget ( ),
112
101
method : h .determineMethod (method , opts ... ),
113
102
}
114
103
ctx = setCallInfo (ctx , ci )
0 commit comments