metrics: build from one Params in place of seven Add calls (closes #438)
check / check (push) Failing after 6m17s
check / check (push) Failing after 6m17s
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:
1 parent
809d2664d7
commit
7697162a6a
7 files changed
+612
-314
No files matched your search
@@ -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(),
|
||||
|
||||
Reference in new issue
Block a user