Skip to main content

Module counters

Module counters 

Source
Expand description

Process-wide session accumulators.

Atomics rather than a lock, because every bump happens on a hot path and must cost nothing measurable. Every bump also happens at a call site, never inside a conditionally-entered handler: a counter sited above an early return is a landmine, and the natural future optimization — hoisting the guard to the caller — silently zeroes it for exactly the users who do not use that feature.

Structs§

SessionCounters
One session’s accumulated counts.

Enums§

Counter
Which counter to bump. A closed enum so a call site cannot invent a key.
ErrorCounter
Which error counter to bump.

Functions§

http_status_counter
Classify a provider HTTP status into the 4xx or 5xx counter, if either applies. Captured from status.as_u16() / 100 before the error is built — every LlmError variant carries the raw provider body verbatim.