Skip to main content

Module forensic

Module forensic 

Source
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 true if the callsite is currently allowed to emit; the macro silently drops the call when this returns false.

Type Aliases§

ForensicLimiter
Concrete rate-limiter type used per callsite.