From 33075974cb9e79786274a93d1feaa5f6e0bad066 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Thu, 21 May 2026 10:37:47 +0200 Subject: [PATCH] chore(stcrashreceiver): metrics on ignore matches Signed-off-by: Jakob Borg --- cmd/infra/stcrashreceiver/main.go | 3 ++- cmd/infra/stcrashreceiver/metrics.go | 5 +++++ cmd/infra/stcrashreceiver/stcrashreceiver.go | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/infra/stcrashreceiver/main.go b/cmd/infra/stcrashreceiver/main.go index 30c834c2a..c2e7922ca 100644 --- a/cmd/infra/stcrashreceiver/main.go +++ b/cmd/infra/stcrashreceiver/main.go @@ -123,7 +123,8 @@ func handleFailureFn(dsn, failureDir string, ignore *ignorePatterns) func(w http return } - if _, ok := ignore.match(bs); ok { + if pat, ok := ignore.match(bs); ok { + metricIgnoreMatchesTotal.WithLabelValues(pat).Inc() result = "ignored" return } diff --git a/cmd/infra/stcrashreceiver/metrics.go b/cmd/infra/stcrashreceiver/metrics.go index c073c8c39..f716b12ca 100644 --- a/cmd/infra/stcrashreceiver/metrics.go +++ b/cmd/infra/stcrashreceiver/metrics.go @@ -42,4 +42,9 @@ var ( Subsystem: "crashreceiver", Name: "sentry_reports_total", }, []string{"result"}) + metricIgnoreMatchesTotal = promauto.NewCounterVec(prometheus.CounterOpts{ + Namespace: "syncthing", + Subsystem: "crashreceiver", + Name: "ignore_matches_total", + }, []string{"pattern"}) ) diff --git a/cmd/infra/stcrashreceiver/stcrashreceiver.go b/cmd/infra/stcrashreceiver/stcrashreceiver.go index 18776f338..0106efee5 100644 --- a/cmd/infra/stcrashreceiver/stcrashreceiver.go +++ b/cmd/infra/stcrashreceiver/stcrashreceiver.go @@ -90,6 +90,7 @@ func (r *crashReceiver) servePut(reportID string, w http.ResponseWriter, req *ht first := string(bytes.TrimSpace(bytes.Split(bs, []byte("\n"))[0])) if pat, ok := r.ignore.match(bs); ok { + metricIgnoreMatchesTotal.WithLabelValues(pat).Inc() result = "ignored" log.Printf("Ignored report %s, matched: %s (%s)", reportID[:8], pat, first) return