mirror of
https://github.com/prometheus/alertmanager
synced 2024-12-29 09:32:16 +00:00
add metric of alertmanager position in mesh (#1024)
This commit is contained in:
parent
d47f8b908c
commit
620fff4e4f
@ -51,6 +51,10 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
peerPosition = prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Name: "alertmanager_peer_position",
|
||||
Help: "Position the Alertmanager instance believes it's in. The position determines a peer's behavior in the cluster.",
|
||||
})
|
||||
configHash = prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Name: "alertmanager_config_hash",
|
||||
Help: "Hash of the currently loaded alertmanager configuration.",
|
||||
@ -68,6 +72,7 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
prometheus.MustRegister(peerPosition)
|
||||
prometheus.MustRegister(configSuccess)
|
||||
prometheus.MustRegister(configSuccessTime)
|
||||
prometheus.MustRegister(configHash)
|
||||
@ -383,7 +388,7 @@ func meshWait(r *mesh.Router, timeout time.Duration) func() time.Duration {
|
||||
}
|
||||
k++
|
||||
}
|
||||
// TODO(fabxc): add metric exposing the "position" from AM's own view.
|
||||
peerPosition.Set(float64(k))
|
||||
return time.Duration(k) * timeout
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user