Rate limiting strategies

September 25th, 2020 • By Gabriella Papp

At Rollbar, we offer different plans, with varying volumes of events included. Most likely, you chose the one you thought fit your needs the best. However, bugs can happen, and an unexpected amount of events can start to pour in on your projects. Running over your event limits is no fun, especially when you are trying to work on quickly and efficiently fixing issues. Exceeding your plan limit can result in extra costs or missing information on bug occurrences that can seriously affect your business and ruin the end-user experience for your customers.

We offer some easy tips to make sure you avoid on-demand events and bring the most out of using Rollbar. Keep an eye on how many occurrences are saved and processed for your projects to gain control over how many events count towards your monthly billing.

In this article, we will cover:

  • Access token rate limiting
  • Disabling on-demand events
  • Enabling high occurrence rate notifications

So let's get started!

Access Token Rate Limiting

Access tokens are used to read and write data via the Rollbar API. Each token has a set of scopes that determine which operations can be performed with the token. There are project access tokens available from the project settings and account access tokens available from the account Settings.

You can impose a rate limit on your project access token to set a cap on the number of occurrences you log in a specified time frame. The default rate limit per access token is 5,000 calls (or occurrences) per 1 minute, which can be modified to any number of calls in any time frame up to 1 month. What happens when the cap is reached? We will drop all occurrences until the rate limit window resets. It is essential to know that the rate limit window does not start at an exact time every day; it starts whenever the first occurrence is logged for that time frame.

Here is a practical example:

  • If your first occurrence is logged at 3:27 PM and the frame is one hour, the window will reset at 4:27 PM.
  • To expand on the above, if the window resets at 4:27 PM, but you do not log another occurrence until 5:03 PM, the new rate limit window will be 5:03 PM - 6:03 PM.

So to sum up, the window may not always be at the same time every day, as it depends on the time the limit is reached and the 'first' call occurring after the rate limit window resets.

Another important thing to note is that if you use up all of your occurrences at the beginning of your rate limit window, you won't log anything until the next rate limit window is reset.

  • Your rate limit is 500 calls in 1 hour. The rate limit window starts at 3:00 PM. At 3:10 PM, you log the 500th occurrence, and your access token is rate limited. Any occurrences that are triggered between 3:11 PM - 4:00 PM will be dropped.

Disable On-Demand Events

If you are on a strict budget and don't mind missing some errors, then you can choose to disable on-demand events in Account Settings -> Billing info. If on-demand events are disabled and you reach your plan limit, we will not process new errors until your next billing cycle begins. This will prevent you from having to pay for on-demand events.

Please note: Similar to the issue with Access Token Rate Limiting, if you use up your occurrence quota early in the month, you will not log any additional occurrences for the rest of the month. If on-demand events are regular for your project, it might be economical to consider upgrading to a different monthly or annual plan.

Enable High Occurrence Rate Notifications

Most of the time, you can avoid running over your limits by setting up the appropriate notification channels that can alert you before you exceed your rate limits.

  • You can set up a rule to notify you when an item occurs more than a given number of times within a given window.
  • You can customize the number of occurrences and the time window to any values that you want it to be.

Good to know: Currently, this is only available for Email and Slack notification rules. Also, it is worth noting that this only informs you when a single item has a high occurrence rate. There isn't currently a way to notify you if your access token has a high occurrence rate.

Want to learn more?

Check out our docs on Rate limits and learn how to configure them.

Get the latest updates delivered to your inbox.