From 42a833b679510f29f074164c04b30ed5b863264a Mon Sep 17 00:00:00 2001 From: samuelgrant123 Date: Sun, 16 Feb 2025 00:26:59 -0500 Subject: [PATCH] fixing Refresh client_golang examples #1652 --- examples/random/main.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/examples/random/main.go b/examples/random/main.go index 9192e94c2..96b19b66c 100644 --- a/examples/random/main.go +++ b/examples/random/main.go @@ -33,6 +33,8 @@ import ( type metrics struct { rpcDurations *prometheus.SummaryVec rpcDurationsHistogram prometheus.Histogram + rpcRequests *prometheus.CounterVec + activeRpcs *prometheus.GaugeVec } func NewMetrics(reg prometheus.Registerer, normMean, normDomain float64) *metrics { @@ -65,9 +67,32 @@ func NewMetrics(reg prometheus.Registerer, normMean, normDomain float64) *metric Buckets: prometheus.LinearBuckets(normMean-5*normDomain, .5*normDomain, 20), NativeHistogramBucketFactor: 1.1, }), + + //Adding the counter metric type + rpcRequests: prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "rpc_requests_total", + Help: "RPC request distributions.", + }, + []string{"service"}, + ), + + //Adding the gauge metric type + activeRpcs: prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Name: "rpc_active_calls", + Help: "RPC call distributions.", + }, + []string{"service"}, + ), } + reg.MustRegister(m.rpcDurations) reg.MustRegister(m.rpcDurationsHistogram) + //Registering the counter vec + reg.MustRegister(m.rpcRequests) + //Registing the gauge vec + reg.MustRegister(m.activeRpcs) return m }