Expand description
Per-callsite rate limiter used by the obs::forensic! macro.
Spec 11 § 6.3 / spec 13 § 8: forensic emits are an emergency
escape hatch; they bypass head sampling but must be capped
per-callsite so a single buggy caller cannot drown the LOG tier.
We use governor::DefaultDirectRateLimiter (token bucket; std
clock; default 1 emit/sec, burst 5).
Functions§
- default_
forensic_ quota - Default quota — 1 emit/sec with a burst of 5. Spec 11 § 6.3 lists “rate-limited per (file, line)” without precise numbers; this matches what observability vendors typically allow before paging.
- ensure_
limiter - Per-callsite limiter accessor. The macro expansion stores a
OnceLock<Arc<ForensicLimiter>>in a static; the first call constructs the limiter under the default quota. - try_
acquire_ forensic - Returns
trueif the callsite is currently allowed to emit; the macro silently drops the call when this returnsfalse.
Type Aliases§
- Forensic
Limiter - Concrete rate-limiter type used per callsite.