Skip to main content

Module slow_log

Module slow_log 

Source
Expand description

The slow log: a command or door call that takes more than a second is one JSON line in <supercode home>/logs/slow.jsonl, so slowness reads as bug monitoring (the audit reads it every round). The Node packages write the same lines (@volter/supercode-harness-sdk/slow-log).

{ v: 1, at, kind: "command"|"door"|"call", name, args, ms, outcome, machine, pid, caller, slowest: { step, ms } }. slowest is the longest step the command noted. Writing never fails the command it measures.

Constants§

ROTATE_BYTES
The log’s size before it rotates: it and the one rotation before it are all that is kept.
SLOW_MS
Anything slower than this many milliseconds is written.

Functions§

note_step
A step of the running command took ms; the longest is the command’s slowest, and every step’s total is in its line’s steps.
path
Where the lines go.
record
One line, when ms is above the bound. caller is asked only then (resolving a caller reads the process table). Answers whether a line was written.
redact_args
The arguments as the log keeps them: secrets replaced, each at most 200 characters.
slowest_step
The longest step noted so far.
timed
Run f as the step step of the running command.