@@ -63,7 +63,7 @@ func (h *clientStatsHandler) initializeMetrics() {
6363
6464func (h * clientStatsHandler ) unaryInterceptor (ctx context.Context , method string , req , reply any , cc * grpc.ClientConn , invoker grpc.UnaryInvoker , opts ... grpc.CallOption ) error {
6565 ci := & callInfo {
66- target : h . determineTarget ( cc ),
66+ target : cc . CanonicalTarget ( ),
6767 method : h .determineMethod (method , opts ... ),
6868 }
6969 ctx = setCallInfo (ctx , ci )
@@ -83,17 +83,6 @@ func (h *clientStatsHandler) unaryInterceptor(ctx context.Context, method string
8383 return err
8484}
8585
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-
9786// determineMethod determines the method to record attributes with. This will be
9887// "other" if StaticMethod isn't specified or if method filter is set and
9988// specifies, the method name as is otherwise.
@@ -108,7 +97,7 @@ func (h *clientStatsHandler) determineMethod(method string, opts ...grpc.CallOpt
10897
10998func (h * clientStatsHandler ) streamInterceptor (ctx context.Context , desc * grpc.StreamDesc , cc * grpc.ClientConn , method string , streamer grpc.Streamer , opts ... grpc.CallOption ) (grpc.ClientStream , error ) {
11099 ci := & callInfo {
111- target : h . determineTarget ( cc ),
100+ target : cc . CanonicalTarget ( ),
112101 method : h .determineMethod (method , opts ... ),
113102 }
114103 ctx = setCallInfo (ctx , ci )
0 commit comments