add metric of alertmanager position in mesh (#1024)

This commit is contained in:
Frederic Branczyk 2017-10-06 18:37:44 +02:00 committed by stuart nelson
parent d47f8b908c
commit 620fff4e4f

View File

@ -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
}
}