Contents

Rate limit is exceeded in Application Insights REST API

Contents

When looking into the capabilities of the Application Insights REST API, I came across the following error returned when attempting to get a list of events.

{
  "error": {
    "message": "Rate limit is exceeded",
    "code": "ThrottledError",
    "innererror": {
      "code": "ThrottledError",
      "message": "Rate limit of 0 per day is exceeded.",
      "limitValue": 0,
      "moreInfo": "https://aka.ms/api-limits"
    }
  }
}

I was initially looking for a list of exceptions, but as it turned out it was for any events I was trying to return. Using the demo instance in the API Explorer gave me no issues but when I tried to use the API access tokens from Azure I would hit the throttling issue shown above. When looking at the link provided in the error message, I am told the following:

No more than 15 requests can be made in a minute across all API paths (/metrics, /events and /query)

Even if I did somehow magically exceed this value on my first request (not sixteenth), the error message does not match what I had received:

Rate limit of 0 per day is exceeded.

As further testing, I created a brand new Application Insights instance, threw in some dummy exceptions, and gave a call against this new instance. I got the results back without any error. So what was different? Turns out at the Connect() conference, Microsoft announced Application Insights General Availability along with a new pricing model. It is this new pricing model that dictates the API limits available to you. As of now, all newly established Application Insights instances are on the new pricing model, and subsequently allow you to access events in the REST API; but any older instances are still on the old pricing model and you are throttled to 0 requests. To confirm which pricing model you are on, check the Application Insights blade for “Features and pricing”, that will indicate you are on the new pricing model, if you only see “Quota and pricing”, then you are on the old model.

/media/2016/12/2016-12-05_23-41-53.png

So if you are on the old pricing model, how do you swap over to the new pricing model to make use of the full REST API? According to the Application Insights Pricing page you have two options:

If you’re willing to wait until February 1st, 2017, we will handle the transition automatically for you, and this will be the best option for most customers. Under this approach, we will transition your application to Application Insights Basic in most cases. (Applications using continuous export or the Connector for OMS Log Analytics will be transitioned to Application Insights Enterprise.) However, if you prefer to use one of the new pricing options immediately, you can also do this. It involves choosing to stop billing for your existing plan (Standard or Premium), then creating a new Application Insights resource within the Azure portal, choosing the pricing option you prefer, and then updating the Instrumentation Key within your application. One downside of doing this is that you will lose the continuity of reporting because you will have the old Instrumentation Key for your application under the Preview plan, and a new Instrumentation Key for your application under the new pricing model.

So unless you don’t care about the data already sitting in you Application Insights instance, which I am sure you are considering you want to run queries against it, you are boned until February 1 (or thereabouts).