warnings: Raise them when a call approaches its resource limits

A function call which is close to a limit gives no sign of it until the limit stops it, at which point the author gets an error and no idea how near they had been. Report four such conditions as warnings instead.

Z594 fires once as the call stack reaches four-fifths of the recursion depth limit; Z596 does the same for the per-request evaluator call limit; Z597 reports at the end of a top-level call which used most of its time. Each reports the threshold rather than the live reading, so the same warning in every frame deduplicates to one.

Z596 reads the EvaluatorGate count as the gate admits the call, not once the call returns. A function which fans out in parallel has moved the count past the threshold reading by the time the first request comes back, and the warning would then never fire.

Z595 covers a condition which is not a near miss at all: fullyRealize() passes the depth limit, logs 'continuing anyway' and carries on, so the result can be short of the parts below that depth and nothing in the response said so.

Only conditions which belong to the function call are reported, never ones which belong to the pod: WikiLambda caches the envelope, so a warning about one pod's bad minute would reach every later reader of that result. Heap, RSS and CPU load stay in Logstash for that reason, and Z597 stays quiet when the budget is already spent, where the caller gets a Z574 which says more.

Assisted-by: Claude Opus 5
Bug: T427112
Bug: T350715

Edited by Jforrester

Merge request reports

Loading