forked from TrueCloudLab/frostfs-node
[#1614] metrics: Add health metrics
Also, rename metrics structure since it collects not only storage metrics now. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
2455b72844
commit
581a9901c9
4 changed files with 40 additions and 7 deletions
28
pkg/metrics/state.go
Normal file
28
pkg/metrics/state.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
package metrics
|
||||
|
||||
import "github.com/prometheus/client_golang/prometheus"
|
||||
|
||||
const stateSubsystem = "state"
|
||||
|
||||
type stateMetrics struct {
|
||||
healthCheck prometheus.Gauge
|
||||
}
|
||||
|
||||
func newStateMetrics() stateMetrics {
|
||||
return stateMetrics{
|
||||
healthCheck: prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Namespace: namespace,
|
||||
Subsystem: stateSubsystem,
|
||||
Name: "health",
|
||||
Help: "Current Node state",
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
func (m stateMetrics) register() {
|
||||
prometheus.MustRegister(m.healthCheck)
|
||||
}
|
||||
|
||||
func (m stateMetrics) SetHealth(s int32) {
|
||||
m.healthCheck.Set(float64(s))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue