ErrorReportThrottle

class ErrorReportThrottle(limit: Int = DEFAULT_LIMIT, windowMs: Long = DEFAULT_WINDOW_MS, maxKeys: Int = DEFAULT_MAX_KEYS, nowMs: () -> Long)(source)

Caps how often one repeating error signature is reported to Crashlytics and Datadog.

A retry loop whose failure is deterministic reports forever: a single MQTT subscribe rejection produced 121,003 Datadog RUM error events across 72 users in fourteen days, roughly 1,680 each, which is enough to bury every other signature in the same window. Rate is the signal here, not volume — the first few reports of a signature carry all the diagnostic value the hundredth does.

Suppressed events are counted, never silently discarded: the next report that gets through carries the number dropped since the previous one, so a throttled signature still shows its true scale.

Constructors

Link copied to clipboard
constructor(limit: Int = DEFAULT_LIMIT, windowMs: Long = DEFAULT_WINDOW_MS, maxKeys: Int = DEFAULT_MAX_KEYS, nowMs: () -> Long)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun acquire(key: String): Int?

Records one occurrence of key and decides whether it should be reported.