Skip to content

Commit

Permalink
fixing Refresh client_golang examples #1652
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelgrant123 committed Feb 16, 2025
1 parent 2510146 commit 42a833b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions examples/random/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 42a833b

Please sign in to comment.