Skip to main content

Can I rate limit events based on the environment?

Issue

I want to configure a rate limit for my application based on the environment. For example, I want to receive 100 errors per hour from staging and apply no limit to production. I am looking for per-environment rate limits or quotas.

Applies To

  • All SaaS Customers

  • Rate Limits

Resolution

Sentry does not offer a Web UI rate limit that differs per environment directly. You can achieve per-environment limits with these approaches, ordered by effectiveness:

  • Send each environment to its own project or client key (DSN), then set a rate limit on that key under Settings. This applies server-side and caps the total events for that key, regardless of how many app instances you run. See the client key rate limit documentation.

  • Add a beforeSend callback that applies custom logic based on the environment and drops the events you do not want to send. This runs client-side, so it only limits events within the current runtime, not the total across all instances. See the filtering documentation.

Did this answer your question?