Name log fields, metrics and the Core Rule Set package for what they are (closes #192)
check / check (push) Successful in 3m40s

Log field, metric, action and event names now say what they count
and, for timings, the unit. Package internal/waf is internal/coreruleset.

Model: opus-5-5
This commit is contained in:
sneak committed 2026-11-09 06:46:24 +00:00
1 parent aede434f6a
commit 92ed102595
52 files changed
+654 -607

No files matched your search

+1 -1
View File
@@ -891,7 +891,7 @@ func missingFromCounter(counter anomaly.Counter) string {
return "netblock"
case scope == anomaly.ScopeASN && counter.ASN == "":
return "asn"
case scope == anomaly.ScopeWatch && counter.Name == "":
case scope == anomaly.ScopeWatchedNet && counter.Name == "":
return "name"
case countsWithoutStart(counter.Minute):
return "minute.start"
+4 -4
View File
@@ -208,7 +208,7 @@ const filledAlertsJSON = `{
}
},
{
"scope": "watch",
"scope": "watched_net",
"netblock": "203.0.113.0/24",
"name": "office",
"hour": {
@@ -831,12 +831,12 @@ func TestAlertsJSONEntryWithoutAFieldItNeedsStopsTheStart(t *testing.T) {
{
"an anomaly counter of a named netblock without its name",
`{"version": 1, "anomaly_counters": [` +
`{"scope": "watch", "netblock": "203.0.113.0/24"}]}`,
`{"scope": "watched_net", "netblock": "203.0.113.0/24"}]}`,
`: anomaly_counters entry 1 has no "name"`,
},
{
"an anomaly counter of a named netblock without its netblock",
`{"version": 1, "anomaly_counters": [{"scope": "watch", "name": "office"}]}`,
`{"version": 1, "anomaly_counters": [{"scope": "watched_net", "name": "office"}]}`,
`: anomaly_counters entry 1 has no "netblock"`,
},
{
@@ -1729,7 +1729,7 @@ func newParams(dir string) state.Params {
Dir: dir,
WriteDelay: time.Hour,
CounterInterval: time.Hour,
Ledger: bans.New(bans.Rules{
Ledger: bans.New(bans.Params{
LimitBanDuration: time.Hour,
LimitBanRepeatWindow: 24 * time.Hour,
MaxBanDuration: 7 * 24 * time.Hour,