I'm using the google-api-python-client
to create a Cloud Function that make one request to the Google Analytics Realtime API every minute. It's running fine for a long time.
This is the code used:
from googleapiclient.discovery import build
service = build('analytics', 'v3', credentials=credentials)
service.data().realtime().get(
ids=f'ga:{view_id}',
metrics='rt:pageviews',
dimensions='rt:deviceCategory,rt:minutesAgo',
quotaUser='my-function'
).execute(num_retries=3)
Today since 10AM UTC-3 I'm facing this error:
Quota Error: Number of recent failed reporting API requests is too high, please implement exponential back off.
According to the docs the limit is:
- 50,000 requests per project per day, which can be increased.
- 10 queries per second (QPS) per IP address
In the developer console, the Google Analytics API metrics has 25k requests in the last 7 days, an average of 0.05/s and a peak of 0.20/s when the error started.
The functions was deployed in us-east1
. I deployed other instance in us-east4
and worked well. So I think the limit is in the IP address used in the us-east1
, shared with other users.
There a way to isolate the quota for my project? I tried the quotaUser
parameter, but seems has no effect.
Update:
The region us-east4
started to raises the same error, so I switched to us-central1
which is working fine for now.