Files
Christian HaudumandGitHub 4bbb89047b Upgrade Cortex to v1.10.1-0.20211104100946-3f329a21cad4 (#1100)
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]>
2021-11-05 13:17:17 -04:00

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},
}),
}
}