# Spike protection

**Spike protection caps sudden bursts of exceptions** so a bad deploy or an error loop doesn't balloon your bill. When an application starts sending far more exceptions than usual, Better Stack temporarily keeps only a sample of them and turns sampling off automatically once the volume returns to normal.

Sampled-away exceptions are dropped before ingestion. They are never stored and you're never billed for them.

## Enable spike protection

1. Go to **Errors** → [Applications](https://errors.betterstack.com/team/0/applications/ ";_blank") → your application → **Advanced settings**.
2. In the **Spike protection** section, turn on **Spike protection**.
3. Keep the default **Baseline multiplier** of 10x, or adjust it to change the sensitivity. Lower values start sampling sooner, higher values allow bigger bursts before sampling kicks in.

## What happens during a spike

Better Stack continuously compares the application's incoming exception rate against the maximum expected volume calculated from its recent traffic. When the rate exceeds it:

* Incoming exceptions are **sampled uniformly at random**, keeping the ingested volume close to the expected maximum. As the spike grows or fades, the kept share adjusts automatically.
* Your team members are **notified** that sampling started.
* The **Advanced settings** page shows the share of exceptions currently being kept and since when.
* Sampling **stops within a few minutes** of the volume dropping back under the limit.

Because sampling is random, every error group keeps a proportional share of its occurrences. New errors still surface during a spike, and trend charts keep their shape.

[info]
#### How is the limit calculated?
Better Stack watches the application's exceptions over the last 7 days in 5-minute buckets.

* The limit is the weekly average plus the **Baseline multiplier** times the standard deviation.
* It never drops below 1.5 times the average, or below 125 exceptions per 5 minutes, so low-volume applications get generous headroom.
* Unusually high buckets are capped and previously sampled periods are excluded. A spike can't raise its own limit.
* Spike protection starts evaluating once the application has at least 4 hours of traffic.
[/info]

[info]
#### Preview the limit on your traffic
Click **View sampling history** next to the setting to chart your application's exceptions against the current limit over the last week and check whether normal traffic stays safely under it.
[/info]

## Need help?

Please let us know at hello@betterstack.com.  
We're happy to help! 🙏