Silence noisy warnings
log.warning("cache miss high") fires 300 times per minute. Your chat turns into a slot machine.
The problem
Every naive alerting integration forwards every record. The fix is either a hand-rolled debouncer, a log-level bump that hides the signal, or a broker with dedup that you now have to operate. snitchbot’s sidecar already dedups on fingerprint in a 5-minute sliding window — the first hit goes through, the rest pile into a × N counter on the same message.
The recipe
# app.py — dedup is on by default, nothing to enable
import logging
import snitchbot
snitchbot.init("checkout")
snitchbot.setup_logging() # WARNING+ -> Telegram
log = logging.getLogger("myapp")
for _ in range(300):
log.warning("cache miss rate too high")
What you see
🟠 log.warning · checkout · 8f2a91 × 300
cache miss rate too high
Details
first 17:02:11 UTC
last 17:03:04 UTC
pid 42
Notes
- Dedup window is 5 minutes, per service, per fingerprint. After that a new alert fires and the counter resets.
- Want the warning gone entirely for an hour? Click through to the alert and send
/mute 8f2a91 1hin the chat — or/mute 8f2a91 forever. - Want it dropped at the source?
snitchbot.setup_logging(level=logging.ERROR)filters WARNINGs before they reach the handler. Infos are never forwarded. - See
setup_logging()for the full rules. snitchbot dedupes by fingerprint over a 5-minute sliding window; identical records collapse into× Non the original message.