metrics: build from one Params in place of seven Add calls (closes #438)
check / check (push) Failing after 1m57s

metrics.New takes a Params holding every part at once, each behind a
small interface declared in metrics beside the metrics it reads. A part
that is off is left nil and adds no metric. The rule-match and
reputation-hit counters are made in New, so no metric field is nil and
no call order is needed. metrics no longer imports remotelog or rules.

Model: opus-5-5
This commit is contained in:
clawbot authored and clawbot committed 2026-11-19 19:24:47 +00:00
1 parent 419ee1c441
commit 8e7b495b28
7 files changed
+614 -316

No files matched your search

+1 -1
View File
@@ -2426,7 +2426,7 @@ func midnight() time.Time {
// counts, with thresholds fill does not reach.
func newParams(dir string) state.Params {
discard := slog.New(slog.DiscardHandler)
m := metrics.New(1, "app")
m := metrics.New(metrics.Params{BusiestCount: 1, InstanceName: "app"})
queue := alerts.New(alerts.Params{
WebhookURL: &url.URL{Scheme: "https", Host: "alerts.example"},
Events: alerts.Events(),