From 8a31fb55ef76714f617f079b67a573906f9cea77 Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Sat, 4 Jan 2025 14:22:20 +0100 Subject: prometheus: Add silentct_need_restart --- internal/metrics/metrics.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'internal/metrics') 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)) +} -- cgit v1.2.3