aboutsummaryrefslogtreecommitdiff
path: root/internal/metrics/metrics.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rgdd@glasklarteknik.se>2025-01-04 14:22:20 +0100
committerRasmus Dahlberg <rgdd@glasklarteknik.se>2025-01-04 14:22:20 +0100
commit8a31fb55ef76714f617f079b67a573906f9cea77 (patch)
tree8821e2b41c4e32502debb461558d10007fddf0cf /internal/metrics/metrics.go
parent2d4c4b7ac260958b73527c5df366ba4944f4cd13 (diff)
prometheus: Add silentct_need_restart
Diffstat (limited to 'internal/metrics/metrics.go')
-rw-r--r--internal/metrics/metrics.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/internal/metrics/metrics.go b/internal/metrics/metrics.go
index 17e9cce..c5ff0d6 100644
--- a/internal/metrics/metrics.go
+++ b/internal/metrics/metrics.go
@@ -12,6 +12,7 @@ type Metrics struct {
logTimestamp *prometheus.GaugeVec
certificateAlert *prometheus.GaugeVec
errorCounter prometheus.Counter
+ needRestart prometheus.Gauge
}
func NewMetrics(registry *prometheus.Registry) *Metrics {
@@ -50,9 +51,15 @@ func NewMetrics(registry *prometheus.Registry) *Metrics {
Help: "The number of errors propagated to the main loop.",
},
),
+ needRestart: prometheus.NewGauge(
+ prometheus.GaugeOpts{
+ Name: "silentct_need_restart",
+ Help: "A non-zero value if the monitor needs restarting.",
+ },
+ ),
}
- registry.MustRegister(m.logSize, m.logIndex, m.logTimestamp, m.certificateAlert, m.errorCounter)
+ registry.MustRegister(m.logSize, m.logIndex, m.logTimestamp, m.certificateAlert, m.errorCounter, m.needRestart)
return m
}
@@ -80,3 +87,7 @@ func (m *Metrics) CertificateAlert(alerts []index.CertificateInfo) {
func (m *Metrics) CountError() {
m.errorCounter.Inc()
}
+
+func (m *Metrics) NeedRestart() {
+ m.needRestart.Set(float64(1))
+}