technical capabilities to detect pauses (e.g. 1 h) when API consumer does not send any API call

Dearest Community!

Are there any technical capabilities in Apigee (Hybrid) to detect pauses (e.g. 1 h) when the API consumer (user) does not send any API calls to the API endpoints?

BR, Optimism

2 REPLIES 2

Apigee doesnt have this type of capability, however you could use alerts in Cloud Monitoring to try create an alert if an API is not receiving traffic for a period of time. To do this based on consumer, you would probably need to send additional metrics to cloud logging, and I'm guessing your alerts would be consumer specific which may not be very scalable/manageable depending on the use case.

Another solution to send alerts if a proxy has not received traffic from a specific consumer over a certain period of time is to utilize Apigee APIs. The organizations.environments.optimizedStats.get API is capable of getting aggregated data on the usage of specific proxies and you can filter the results by time frames, a specific API key, a developer's email, ect.

Here is an example curl command to get the sum of API calls to all proxies within the eval environment for a specific time frame and filtered by a specific client_id (api key):

curl 'https://apigee.googleapis.com/v1/organizations/[YOUR_APIGEE_ORG]/environments/eval/optimizedStats/apiproxy?filter=client_id%20eq%20%[FILTER_API_KEY]&select=sum(message_count)&timeRange=08%2F01%2F2022%2000%3A00~08%2F15%2F2022%2000%3A00&key=[YOUR_API_KEY]' \
  --header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
  --header 'Accept: application/json' \
  --compressed

You could utilize this API call within a serverless application like Cloud Run or App Engine to find proxies that aren't being hit within a certain timeframe and send out alerts. You could then schedule this application to run every hour/day/month using Cloud Scheduler CRON jobs. This solution requires time spent in implementation, but offers a lot of flexibility in the data you request and what you do with it afterwards.