aboutsummaryrefslogtreecommitdiff
path: root/internal/metrics
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
commit8406a82803344fcf1284d72300cf69f54d5b5925 (patch)
treec86a303fb388d5f32723e80b3f6b57c51409429a /internal/metrics
parentb6bf2fdfd6fb9f4a2894c2a4dbfad3a82b75fdea (diff)
prometheus: Add drafty error counter
Needs tuning, too noisy right now.
Diffstat (limited to 'internal/metrics')
-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 113d28c..17e9cce 100644
--- a/internal/metrics/metrics.go
+++ b/internal/metrics/metrics.go
@@ -11,6 +11,7 @@ type Metrics struct {
logIndex *prometheus.GaugeVec
logTimestamp *prometheus.GaugeVec
certificateAlert *prometheus.GaugeVec
+ errorCounter prometheus.Counter
}
func NewMetrics(registry *prometheus.Registry) *Metrics {
@@ -43,9 +44,15 @@ func NewMetrics(registry *prometheus.Registry) *Metrics {
},
[]string{"stored_at"},
),
+ errorCounter: prometheus.NewCounter(
+ prometheus.CounterOpts{
+ Name: "silentct_error_counter",
+ Help: "The number of errors propagated to the main loop.",
+ },
+ ),
}
- registry.MustRegister(m.logSize, m.logIndex, m.logTimestamp, m.certificateAlert)
+ registry.MustRegister(m.logSize, m.logIndex, m.logTimestamp, m.certificateAlert, m.errorCounter)
return m
}
@@ -69,3 +76,7 @@ func (m *Metrics) CertificateAlert(alerts []index.CertificateInfo) {
m.certificateAlert.WithLabelValues(alert.StoredAt).Set(float64(alert.ObservedAt.Unix()))
}
}
+
+func (m *Metrics) CountError() {
+ m.errorCounter.Inc()
+}