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.
Related
I am working on developing integration with Google Calendar using Rest API. I got to know Google applies both rateLimit and usageLimit on API calls - 403_calendar_usage_limits_exceeded
In case I breach the limits, I want to wait for a defined period of time before I retry the request again. Is there any way to know if there is something like Retry-After header returned by Google.
I checked documentation but not able to find anything related - errors
You can see your quota in google developer console under libary search for google calendar and then click the manage button. Under the quota tab you will see something like this.
There are two types of quota user based quota denoted by the "per user" and project based quotas.
Each user running my application can make a max of 600 requests per minute. if they make to many then i will get a quota exception.
My application can make a max of 10000 request per minute in total. if it makes more then that then again i will get a quota exception.
You may want to read though Manage quotas this explains a lot about quota usage and the google calendar api.
For the most part if you just implement exponential backoff you should be able to avoid to many of these errors.
try request if fails
wait 10 seconds
try again if fails
wait 20 seconds
try again if fails
wait 30 seconds
try again
.......
I recently applied to have the limit the Google Analytics API increased. This was approved and I received an email saying it was completed. When I went to check the increase it still showed the original value. I navigated across from the Developer Console to the GCP console and saw a message saying that Quota cannot not be increased when still using the Free Credits. So I changed the account to a paid one, hoping that the increase would then show. But alas, I am still stuck with the lower quota. Is there anything I can do?
This was resolved internally with Google
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.
My company's product depends on the Google Analytics API, and our quota was suddenly drastically reduced. Does anybody know who to contact at Google to get this fixed quickly? I've re-submitted our application for a higher quota, but if this does not get resolved ASAP, I'm going to have a bunch of angry customers.
If someone went into your project on Developer console and turned on and off the Google Analytics API it will reset the quota to the default, removing any increase you previously where granted. (Just a guess you are going to have to wait for them to re-increase you again)
Side note I should send in a feature request: It should either not reset it or it should pop up asking if you really really really want to turn it on and off.
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.