mirror of
https://github.com/prometheus/alertmanager
synced 2025-01-01 02:52:06 +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 (
|
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{
|
configHash = prometheus.NewGauge(prometheus.GaugeOpts{
|
||||||
Name: "alertmanager_config_hash",
|
Name: "alertmanager_config_hash",
|
||||||
Help: "Hash of the currently loaded alertmanager configuration.",
|
Help: "Hash of the currently loaded alertmanager configuration.",
|
||||||
@ -68,6 +72,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
prometheus.MustRegister(peerPosition)
|
||||||
prometheus.MustRegister(configSuccess)
|
prometheus.MustRegister(configSuccess)
|
||||||
prometheus.MustRegister(configSuccessTime)
|
prometheus.MustRegister(configSuccessTime)
|
||||||
prometheus.MustRegister(configHash)
|
prometheus.MustRegister(configHash)
|
||||||
@ -383,7 +388,7 @@ func meshWait(r *mesh.Router, timeout time.Duration) func() time.Duration {
|
|||||||
}
|
}
|
||||||
k++
|
k++
|
||||||
}
|
}
|
||||||
// TODO(fabxc): add metric exposing the "position" from AM's own view.
|
peerPosition.Set(float64(k))
|
||||||
return time.Duration(k) * timeout
|
return time.Duration(k) * timeout
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user