Name log fields, metrics and the Core Rule Set package for what they are (closes #192)
check / check (push) Failing after 5m32s
check / check (push) Failing after 5m32s
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:
1 parent
aede434f6a
commit
9e6abf8496
58 files changed
+743
-691
No files matched your search
@@ -156,9 +156,9 @@ func wantBareLine(t *testing.T, line logLine) {
|
||||
|
||||
// withTimings returns want with the timings of line.
|
||||
func withTimings(line logLine, want requestlog.Line) requestlog.Line {
|
||||
want.DurationTotal = line.DurationTotal
|
||||
want.DurationChecks = line.DurationChecks
|
||||
want.DurationUpstreamTotal = line.DurationUpstreamTotal
|
||||
want.DurationTotalMS = line.DurationTotalMS
|
||||
want.DurationChecksMS = line.DurationChecksMS
|
||||
want.DurationUpstreamTotalMS = line.DurationUpstreamTotalMS
|
||||
|
||||
return want
|
||||
}
|
||||
@@ -226,10 +226,10 @@ func TestTimingsAreInOrder(t *testing.T) {
|
||||
|
||||
// A request passed to the app has every timing; one refused, none of
|
||||
// the app's; the health check, which runs no check, only the total.
|
||||
wantTimings(t, forwarded, "duration_total", "duration_checks",
|
||||
"duration_upstream_total")
|
||||
wantTimings(t, refused, "duration_total", "duration_checks")
|
||||
wantTimings(t, health, "duration_total")
|
||||
wantTimings(t, forwarded, "duration_total_ms", "duration_checks_ms",
|
||||
"duration_upstream_total_ms")
|
||||
wantTimings(t, refused, "duration_total_ms", "duration_checks_ms")
|
||||
wantTimings(t, health, "duration_total_ms")
|
||||
|
||||
if t.Failed() {
|
||||
return
|
||||
@@ -237,9 +237,9 @@ func TestTimingsAreInOrder(t *testing.T) {
|
||||
|
||||
// In whole microseconds, as they are logged, so that the sum below is
|
||||
// exact.
|
||||
total := microseconds(forwarded.DurationTotal)
|
||||
checks := microseconds(*forwarded.DurationChecks)
|
||||
upstream := microseconds(*forwarded.DurationUpstreamTotal)
|
||||
total := microseconds(forwarded.DurationTotalMS)
|
||||
checks := microseconds(*forwarded.DurationChecksMS)
|
||||
upstream := microseconds(*forwarded.DurationUpstreamTotalMS)
|
||||
|
||||
// The checks end before the request is handed to the app.
|
||||
if checks+upstream > total {
|
||||
@@ -247,9 +247,9 @@ func TestTimingsAreInOrder(t *testing.T) {
|
||||
total, checks, upstream)
|
||||
}
|
||||
|
||||
if *refused.DurationChecks > refused.DurationTotal {
|
||||
if *refused.DurationChecksMS > refused.DurationTotalMS {
|
||||
t.Errorf("refused request's checks took %v of %v milliseconds",
|
||||
*refused.DurationChecks, refused.DurationTotal)
|
||||
*refused.DurationChecksMS, refused.DurationTotalMS)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user