update dependencies (#6267)
Signed-off-by: hongming <coder.scala@gmail.com>
This commit is contained in:
23
vendor/sigs.k8s.io/controller-runtime/pkg/metrics/leaderelection.go
generated
vendored
23
vendor/sigs.k8s.io/controller-runtime/pkg/metrics/leaderelection.go
generated
vendored
@@ -14,6 +14,11 @@ var (
|
||||
Name: "leader_election_master_status",
|
||||
Help: "Gauge of if the reporting system is master of the relevant lease, 0 indicates backup, 1 indicates master. 'name' is the string used to identify the lease. Please make sure to group by name.",
|
||||
}, []string{"name"})
|
||||
|
||||
leaderSlowpathCounter = prometheus.NewCounterVec(prometheus.CounterOpts{
|
||||
Name: "leader_election_slowpath_total",
|
||||
Help: "Total number of slow path exercised in renewing leader leases. 'name' is the string used to identify the lease. Please make sure to group by name.",
|
||||
}, []string{"name"})
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -23,18 +28,20 @@ func init() {
|
||||
|
||||
type leaderelectionMetricsProvider struct{}
|
||||
|
||||
func (leaderelectionMetricsProvider) NewLeaderMetric() leaderelection.SwitchMetric {
|
||||
return &switchAdapter{gauge: leaderGauge}
|
||||
func (leaderelectionMetricsProvider) NewLeaderMetric() leaderelection.LeaderMetric {
|
||||
return leaderElectionPrometheusAdapter{}
|
||||
}
|
||||
|
||||
type switchAdapter struct {
|
||||
gauge *prometheus.GaugeVec
|
||||
type leaderElectionPrometheusAdapter struct{}
|
||||
|
||||
func (s leaderElectionPrometheusAdapter) On(name string) {
|
||||
leaderGauge.WithLabelValues(name).Set(1.0)
|
||||
}
|
||||
|
||||
func (s *switchAdapter) On(name string) {
|
||||
s.gauge.WithLabelValues(name).Set(1.0)
|
||||
func (s leaderElectionPrometheusAdapter) Off(name string) {
|
||||
leaderGauge.WithLabelValues(name).Set(0.0)
|
||||
}
|
||||
|
||||
func (s *switchAdapter) Off(name string) {
|
||||
s.gauge.WithLabelValues(name).Set(0.0)
|
||||
func (leaderElectionPrometheusAdapter) SlowpathExercised(name string) {
|
||||
leaderSlowpathCounter.WithLabelValues(name).Inc()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user