@@ -33,6 +33,8 @@ import (
33
33
type metrics struct {
34
34
rpcDurations * prometheus.SummaryVec
35
35
rpcDurationsHistogram prometheus.Histogram
36
+ rpcRequests * prometheus.CounterVec
37
+ activeRpcs * prometheus.GaugeVec
36
38
}
37
39
38
40
func NewMetrics (reg prometheus.Registerer , normMean , normDomain float64 ) * metrics {
@@ -65,9 +67,32 @@ func NewMetrics(reg prometheus.Registerer, normMean, normDomain float64) *metric
65
67
Buckets : prometheus .LinearBuckets (normMean - 5 * normDomain , .5 * normDomain , 20 ),
66
68
NativeHistogramBucketFactor : 1.1 ,
67
69
}),
70
+
71
+ //Adding the counter metric type
72
+ rpcRequests : prometheus .NewCounterVec (
73
+ prometheus.CounterOpts {
74
+ Name : "rpc_requests_total" ,
75
+ Help : "RPC request distributions." ,
76
+ },
77
+ []string {"service" },
78
+ ),
79
+
80
+ //Adding the gauge metric type
81
+ activeRpcs : prometheus .NewGaugeVec (
82
+ prometheus.GaugeOpts {
83
+ Name : "rpc_active_calls" ,
84
+ Help : "RPC call distributions." ,
85
+ },
86
+ []string {"service" },
87
+ ),
68
88
}
89
+
69
90
reg .MustRegister (m .rpcDurations )
70
91
reg .MustRegister (m .rpcDurationsHistogram )
92
+ //Registering the counter vec
93
+ reg .MustRegister (m .rpcRequests )
94
+ //Registing the gauge vec
95
+ reg .MustRegister (m .activeRpcs )
71
96
return m
72
97
}
73
98
0 commit comments