What is the reason for the error "RESOURCE_EXHAUSTED"? - wordpress

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?

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.

A quick search concluded that the analytics plugin used by your blog may be using more hits and quota that is permissible by google analytics api
You can find error description here and quota limits here. Please get in touch with plugin developer to get this sorted.

It was caused by a WordPress plugin you are using called "Google Analytics," which is one of many plugins you can use to easily insert analytics tracking code into your page's source. You might disable it and install another plugin that does this without causing errors.
In addition, if this plugin is synchronously pulling from Google's servers on each request, it is needlessly slowing down your page load times. There is no reason why the plugin needs to do this.

Related

"quotaExceeded: Calendar usage limits exceeded" when `sendNotifications` enabled

In my company we set up Google Calendar API to notify our providers when we have new missions to offer them and allow them to accept/refuse mission through the Google Calendar.
However, since last week we started getting quotaExceeded errors ("Calendar usage limits exceeded"). I checked quotas but figured out we are way below quotas (3,000 / 1,000,000 requests per day and 10 / 500 requests per 100 seconds).
HttpError: <HttpError 403 when requesting https://www.googleapis.com/calendar/v3/calendars/svbk5reui******l6h044qn3h4%40group.calendar.google.com/events/1meqllvk6******dt9poej9mk0?alt=json&sendNotifications=true returned "Calendar usage limits exceeded.">
After checking a bit further, I noticed there are also "hidden" quotas. I say "hidden" quotas beacause I can't find any feedback about the evolution of these quotas. I assumed we might have reached either "Send too many invitations to external guests" or "Email too many guests via Google Calendar events" quota. So I set sendNotifications=false where we used to set sendNotifications=true.
Since I made this change, we didn't experience the quotaExceeded error anymore. However, our providers are also not notified anymore when we offer them a new mission. So, I doubled the API calls with an e-mail sent to the providers including the link to the Google Calendar event.
Yet, now, some of them can't access the link, and the other can't answer if they will be attending the event or not.
How come setting sendNotifications=false disallows access or answering to the attendees? Can I check exactly what quotas are exceeded? And what are my solutions to notify our providers about new missions and allow them to see it in their calendar and answer it?

google cloud vision API error "Deadline expired before operation could complete."

I got the cloud vision API working, and I was having lots of fun tagging my images. I've only tested it on about 50 images. It was working yesterday. When I tried again today, I got an error. For the label annotation, the error is:
"Resource has been exhausted (e.g. check quota)."
For face detection, the error is:
"Deadline expired before operation could complete."
I don't think I have gone over the 1,000 monthly limit, but I can't figure out how to check. Does anyone know?
Or, does anyone have any ideas about why this would have happened if I am indeed below the 1,000 request limit (which I am pretty sure I am!)
Thanks for any help!
For future reference, you can check your quote using the API Manager in the Cloud Console.
On the left-nav, jump to API Manager Dashboard, then search for the Vision API.
The Vision API dashboard will have a "Quotas" tab that shows you how many requests have been made, etc.
You can also look at the Quotas page in the IAM & Admin section of the console, and filter by Service ("Google Cloud Vision API"):

Determine google application remaining global quota

In the google applications developer console I can see the global quota usage for a google API:
I would like to achieve the following:
Be able to programatically query the remaining quota, to ensure that important tasks can always be completed.
Receive some form of alert when we are approaching the quota limit.
So far I have tried configuring the 'Monitoring' section of the developer console, but all I can see are uptime checks. This question has also been asked in other areas of the interwebs but no-one has ever received an answer.
At this time there is no API for checking the quota on the Google Developer console.

Google Analytics "daily Limit Exceeded Quota error" & register application properly with gapi.class.php

I used gapi.class.php and have another analytics-dash.php template which I'm calling as an include on a page template in WP. This shows a chart and stats of analytics on the front end of WP to my admin and authors. This template is connected to my site's GA profile ID and all is well, it works and shows the stats. However, the first night after implementation we received the error "GDatadailyLimitExceededQuota" on the site. I have since removed the include script from my page template so the error will not show.
These are the steps I took to try and fix the problem:
I researched into the error "dailyLimitExceededQuota", which I researched and Google's API states the following:
"If quota is exceeded, Google Analytics API returns an error for additional requests:
HTTP status code 403 Forbidden and a message indicating that the specific account has insufficient quota to proceed...
50,000 requests per project per day
10 queries per second (QPS) per IP.
To get full quota, you must register your application in the Google Developers Console. When you register a new application, you are given a unique client ID to identify each application under that project."
Then I realized I needed to register with Google's Developer Console as the quota limit is very low for testing without registering.
I registered the application and turned on the Analytics API in the console. I'm not sure what else I am to do after registering the application.
I followed the instructions to increase the quota (Configuration and Reporting API Limits and Quotas)
by using this form:
Analytics API quota request
I went through the steps on the form to make sure I am setting this up correctly. On that form, it states the following:
"Quotas that CAN be increased:
Per project daily limit of 50,000 requests/day.
Per project daily limit of 500 uploads/day.
Quotas that CANNOT be increased:
Per profile (user) limit of 10,000 requests/day [403 Error with Message about Profile limit: dailyLimitExceeded]
Per profile (user) limit of 10 concurrent requests per profile [403 Error: quotaExceeded]
Per IP limits of 10 queries/second (QPS) [403 Error: userRateLimitExceeded]"
... proceed to check that we "Verify that the quota you are asking for can be increased. See the list above."
This is referring to the quotas that can and cannot be increased (above). Since we received error "dailyLimitExceed", and this is associated with "per profile (user) limit of 10,000 requests/day" - this is under the list that CANNOT be increased. However this was before registering the application with Google's Developer Console so I'm thinking now, since I registered it as an application/project, it can be considered to have a daily limit of 50,000 requests/day. Then if I enable it again on our website, I'm thinking the error would not show, however this I am unsure because I'm not sure if I setup the registration fully. Could it be that simple to register an application?
The next step on the form states:
"(4) Verify your API requests are properly registered with a Developers Console Project. Check the Reports Developers Console. If total requests in the traffic report is 0 then your API requests are not registered to your project ID and you are not currently getting your full quota."
However, it is going to show 0 currently because I removed the include script from our website! So I'm thinking the only way to test against this (#4 on form) is to put the script back in. Then if the error shows, that could mean that either it is not communicating with the registered application I just created, or it simply exceeds the limit. Therefore I would need to fill out this form, which I did, to ask for a quote increase. However, I'm hesitant to put the script back in to display the analytics chart until I hear back from Google (not sure how long it takes for them to respond to the increase quota request) because I don't want another dailyLimitExceeded error to be thrown and show on the front end.
Any thoughts? Thank you very much for your consideration in helping.

Google Analytics quota dayshift

I'm working on a solution where we need to request the Google Analytics API quite a lot. Now the issue is I want to allocate my requests because of the day quota limits. But right now it's quite unclear when Google makes it a new day and I have another 50.000 requests to make. From the developer console report I can get a detailed picture of the daily requests used.
Does anyone knows at what time of day and in which timezone the requests are reset?
You can request that Google Extend your 50,000 quota. Note: I am not sure if they charge for this or not. You can only do this though the old Apis console for your app. I have been unable to find this feature in the new cloud developers console. (I have sent in a feature request on it)
On the right you will find a link to Request more. But you need to make sure that you don't have to many errors returning from the API this will effect weather or not they will except your request to extend.
Note: Daily quotas refresh at midnight PST.

Resources