Search code examples
wordpressgoogle-analyticsgoogle-apigoogle-analytics-apiquota

What is the reason for the error "RESOURCE_EXHAUSTED"?


I have a wordpress blog. When I logged in to the dashboard, the following exception was highlighted at the top:

[Ga_Lib_Api_Request_Exception] There was an error while contacting Google API: {
"error": { "code": 429, "message": "Insufficient tokens for quota group and limit
'AnalyticsDefaultGroupCLIENT_PROJECT-1d' of service 'analyticsreporting.googleapis.com',
using the limit by ID '123******456'.", "status": "RESOURCE_EXHAUSTED",
"details": [ { "@type": "type.googleapis.com/google.rpc.Help",
"links": [ { "description": "Google developer console API key",
"url": "https://console.developers.google.com/project/207216681371/apiui/credential"}]}]}}

From the exception message I could infer that it is something related to Google Analytics and its API.

However, I'm curious to know what could have caused this exception. Also, what steps can I take in order to avoid such exceptions?


Solution

  • Manoj gave you the technical information I am going to give you a bit of extra info and answer the following part of your question.

    However, I'm curious to know what could have caused this exception. Also, what steps can I take in order to avoid such exceptions?

    When we as developers want to access Google APIs we need to register our application with Google. Each API has a different quota that the developers need to keep track of.

    a quota is the number of requests you can make to an API.

    For example: Considering the Google analytics by default each user of an application can make a maximum of 10 requests a second this is to prevent flooding the servers. You can also make a maximum of 10000 requests to each Google analytics View per day. Most of the quotas are user based however there is one that is project based. RESOURCE_EXHAUSTED is one such quota.

    By default the project based quota for google analytics is 50000 requests. If you have a large number of users all making requests you can quickly run out of quota. The quota on my application for example is 500000 my users run though about 70% of that each day. Once you hit this quota there is nothing that can be done the application is locked out until the quota is reset at midnight west cost USA time.

    What can be done to avoid it. First off the author of the plugin needs to request an additional quota so that they can service their users better they should also be checking this periodically so that there users never see it. Its probably going to take them a month to get approved for additional quota. As a user you can help by only making requests that you need to make there by not using to much of the daily quota up.

    As Manoj stated there is nothing you can do personally to fix this you will need to contact the author of the plugin.