mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
Signed-off-by: Christian Haudum <[email protected]> Co-authored-by: Susana Ferreira <[email protected]> Fix duplicate metrics registration Signed-off-by: Christian Haudum <[email protected]> Add debug logs to hedge request test Signed-off-by: Christian Haudum <[email protected]> Fix e2e test metric names Remove prometheus/common replace in go.mod Signed-off-by: Christian Haudum <[email protected]>
33 lines
1.1 KiB
Go
33 lines
1.1 KiB
Go
package ring
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
|
)
|
|
|
|
type BasicLifecyclerMetrics struct {
|
|
heartbeats prometheus.Counter
|
|
tokensOwned prometheus.Gauge
|
|
tokensToOwn prometheus.Gauge
|
|
}
|
|
|
|
func NewBasicLifecyclerMetrics(ringName string, reg prometheus.Registerer) *BasicLifecyclerMetrics {
|
|
return &BasicLifecyclerMetrics{
|
|
heartbeats: promauto.With(reg).NewCounter(prometheus.CounterOpts{
|
|
Name: "ring_member_heartbeats_total",
|
|
Help: "The total number of heartbeats sent.",
|
|
ConstLabels: prometheus.Labels{"name": ringName},
|
|
}),
|
|
tokensOwned: promauto.With(reg).NewGauge(prometheus.GaugeOpts{
|
|
Name: "ring_member_tokens_owned",
|
|
Help: "The number of tokens owned in the ring.",
|
|
ConstLabels: prometheus.Labels{"name": ringName},
|
|
}),
|
|
tokensToOwn: promauto.With(reg).NewGauge(prometheus.GaugeOpts{
|
|
Name: "ring_member_tokens_to_own",
|
|
Help: "The number of tokens to own in the ring.",
|
|
ConstLabels: prometheus.Labels{"name": ringName},
|
|
}),
|
|
}
|
|
}
|