Chapter 04
Reduce noise
Twig is growing, and the engineers are starting to notice issues that are noisy, but they'll never fix. For example:
- Exceptions from their own laptops during local development.
ResizeObserver looperrors the browser or React throws, which guests never notice.- One browser stuck in a loop, sending the same exception 15,000 times in an hour.
- Errors from browser extensions, in code Twig doesn't own.
- A flood of exceptions during an outage.
PostHog bills by events ingested, so these noisy events also cost money.
Here are the tools Twig's engineers use to silence noisy exceptions.
Skip local development with production builds
Twig only starts PostHog in production builds. Local development builds don't capture events or exceptions:
Local development environments are especially noisy, and many of the exceptions that happen in local development don't manifest in production at all.
Drop browser errors with before_send
The engineers drop the browser's ResizeObserver loop errors in Twig with the SDK's before_send hook, which runs before the SDK sends anything. It returns null to drop an exception, or edits its properties to redact sensitive data:
Nothing dropped here reaches PostHog, so it's the cheapest place to filter.
The web,
Node.js,
React Native,
iOS,
Android,
Flutter,
Kotlin,
Python,
Ruby, and
Roblox SDKs all have a similar hook, and some name it beforeSend. Suppressing exceptions shows it for web and React Native.
Stop looping browsers with burst protection
Burst protection in the web and
Node.js SDKs keeps a bug that loops in one guest's browser from flooding the project. It's on by default.
Burst protection only runs in those two SDKs, in the client. To cap volume from every SDK, the engineers use rate limits.
Drop extension errors with a suppression rule
The engineers add a suppression rule in Error Tracking settings for errors from guests' browser extensions. It drops future exceptions that match its filters, like the exception type or message Fig. 1. PostHog applies rules at ingestion, and some SDKs apply them in the app too.
Cap outages with rate limits
Rate limits cap how many exceptions PostHog ingests during an outage. The engineers set a per-issue limit, so one noisy issue can't use up the whole project's limit. A project-wide limit caps the project's total volume.
Bypass rules let critical exceptions skip both limits. PostHog still bills the exceptions they let through.
Triage noisy issues
When an issue gets noisy, Twig's engineers decide what to do with it like this:
We turned this into a skill for you to triage your noisy issues Fig. 2. It asks for approval before it changes anything.





