@@ -33,6 +33,8 @@ import (
3333type metrics struct {
3434 rpcDurations * prometheus.SummaryVec
3535 rpcDurationsHistogram prometheus.Histogram
36+ rpcRequests * prometheus.CounterVec
37+ activeRpcs * prometheus.GaugeVec
3638}
3739
3840func NewMetrics (reg prometheus.Registerer , normMean , normDomain float64 ) * metrics {
@@ -65,9 +67,32 @@ func NewMetrics(reg prometheus.Registerer, normMean, normDomain float64) *metric
6567 Buckets : prometheus .LinearBuckets (normMean - 5 * normDomain , .5 * normDomain , 20 ),
6668 NativeHistogramBucketFactor : 1.1 ,
6769 }),
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+ ),
6888 }
89+
6990 reg .MustRegister (m .rpcDurations )
7091 reg .MustRegister (m .rpcDurationsHistogram )
92+ //Registering the counter vec
93+ reg .MustRegister (m .rpcRequests )
94+ //Registing the gauge vec
95+ reg .MustRegister (m .activeRpcs )
7196 return m
7297}
7398
0 commit comments