@@ -45,44 +45,44 @@ func NewConnectMetrics() *ConnectMetrics {
45
45
ServerRequestsStarted : prometheus .NewCounterVec (prometheus.CounterOpts {
46
46
Name : "connect_server_started_total" ,
47
47
Help : "Counter of server connect (gRPC/HTTP) requests started" ,
48
- }, []string {"service " , "call" , "call_type" }),
48
+ }, []string {"package " , "call" , "call_type" }),
49
49
ServerRequestsHandled : prometheus .NewHistogramVec (prometheus.HistogramOpts {
50
50
Name : "connect_server_handled_seconds" ,
51
51
Help : "Histogram of server connect (gRPC/HTTP) requests completed" ,
52
- }, []string {"service " , "call" , "call_type" , "code" }),
52
+ }, []string {"package " , "call" , "call_type" , "code" }),
53
53
54
54
ClientRequestsStarted : prometheus .NewCounterVec (prometheus.CounterOpts {
55
55
Name : "connect_client_started_total" ,
56
56
Help : "Counter of client connect (gRPC/HTTP) requests started" ,
57
- }, []string {"service " , "call" , "call_type" }),
57
+ }, []string {"package " , "call" , "call_type" }),
58
58
ClientRequestsHandled : prometheus .NewHistogramVec (prometheus.HistogramOpts {
59
59
Name : "connect_client_handled_seconds" ,
60
60
Help : "Histogram of client connect (gRPC/HTTP) requests completed" ,
61
- }, []string {"service " , "call" , "call_type" , "code" }),
61
+ }, []string {"package " , "call" , "call_type" , "code" }),
62
62
}
63
63
}
64
64
65
65
func NewMetricsInterceptor (metrics * ConnectMetrics ) connect.UnaryInterceptorFunc {
66
66
interceptor := func (next connect.UnaryFunc ) connect.UnaryFunc {
67
67
return connect .UnaryFunc (func (ctx context.Context , req connect.AnyRequest ) (connect.AnyResponse , error ) {
68
68
now := time .Now ()
69
- service , call := splitServiceCall (req .Spec ().Procedure )
69
+ callPackage , callName := splitServiceCall (req .Spec ().Procedure )
70
70
callType := streamType (req .Spec ().StreamType )
71
71
isClient := req .Spec ().IsClient
72
72
73
73
if isClient {
74
- metrics .ClientRequestsStarted .WithLabelValues (service , call , callType )
74
+ metrics .ClientRequestsStarted .WithLabelValues (callPackage , callName , callType )
75
75
} else {
76
- metrics .ServerRequestsStarted .WithLabelValues (service , call , callType )
76
+ metrics .ServerRequestsStarted .WithLabelValues (callPackage , callName , callType )
77
77
}
78
78
79
79
resp , err := next (ctx , req )
80
80
81
81
code := codeOf (err )
82
82
if isClient {
83
- metrics .ClientRequestsHandled .WithLabelValues (service , call , callType , code ).Observe (time .Since (now ).Seconds ())
83
+ metrics .ClientRequestsHandled .WithLabelValues (callPackage , callName , callType , code ).Observe (time .Since (now ).Seconds ())
84
84
} else {
85
- metrics .ServerRequestsHandled .WithLabelValues (service , call , callType , code ).Observe (time .Since (now ).Seconds ())
85
+ metrics .ServerRequestsHandled .WithLabelValues (callPackage , callName , callType , code ).Observe (time .Since (now ).Seconds ())
86
86
}
87
87
88
88
return resp , err
0 commit comments