Did you know that the family of Google Maps Platform (GMP) services—Maps, Roads and Places—can be managed inside Cloud Console just like the compute, storage, big data and artificial intelligence services? It’s true, and with it comes many benefits.
Here are just some of the things you can do from inside Cloud Console:
- Enable/disable service
- Create and manage security credentials like API keys
- View usage metrics and billing reports
- Set budget alerts and daily quotas
- Monitor and set service-level alerts
It’s this last one, monitoring and setting service level alerts, that can provide timely insight into daily usage and enable you to control costs proactively.
Help me control costs!
Consider the following scenario: James, a Woolpert client, comes to us with the question, “How can I cap our Maps service usage to keep costs under control?” We recommend that James sets daily quotas to create a cost ceiling.
James’ next question, “Now that I’ve set my cap, how can I be made aware if I am approaching the limit throughout the day?” requires a little cloud operations finesse. One advantage of Maps services living within the cloud platform is that they can be monitored by Operations Suite Monitoring (OSM, formerly Stackdriver). OSM gives you many ways to measure what’s activity and notify you of the events you care about so that you can react in a way that makes the most sense for your business. Let’s explore how we can help James keep track of his Maps service usage.
OSM alerts keep you in the know
Here you can see James’ geocoding service setup and alert targets:
- Service: Geocoding API (web service calls over http)
- Daily quota: 1,000 requests
- Alert level: 80% or 800 requests
We will build our alert based on the Consumed API monitored resource.
What to know
We need to know the service name and method name.
- Service name: Find the service name from the marketplace, on geocoding-backend.googleapis.com or directions-backend.googleapis.com.
- Method name: See the available methods for an API from the metrics page (google.places.geocoding.Http or google.places.geocoding.javascript).
Set up an alert for Geocoding API
The following steps walk through the process of setting up an alert for geocoding requests. We closely follow the steps laid out in Google documentation and do our best to fill in the geocoding service-specific parts below.
- Log in to Cloud Console for your project and go to Monitoring.
- Select Alerting.
- Click Create Policy. Name your policy.
- Set Notification channels. The currently available options are Mobile Device, PagerDuty, Slack, Webhooks, Email and SMS.
- Add Condition. Here are the details for the geocoding web service. The same settings for resource type, metric and filter are used for monitoring charts also.
Resource type Consumed API Metric Request count Filter Service = geocoding-backend.googleapis.com Method = google.places.geocoding.http Aggregator sum
Note: Some resources have quota metrics like quota/allocation/usage, quota/exceeded, quota/limit or quota/rate/net_usage. Unfortunately, the Consumed API resource type does not include quota metrics. We use request count instead.
- Add Condition. Here are the details for the geocoding web service. The same settings for resource type, metric and filter are used for monitoring charts also.
- Create a Trigger. Set the trigger value to the level that makes sense based on your quota. For this example, we want an alert when usage reaches 80% of our daily geocoding quota of 1,000, so we set the threshold to 800.
- Now that the alert policy is created, return to the Monitoring Overview and click Add Chart to plot the request count. Use the same target settings as you did for the alert.
Once the request count exceeds 800 for one minute, you will receive an alert through the notification channels.
You’re ready for scaling
James is prepared. He has a quota set to manage his cost and an alert to let him know when that usage is nearing the daily quota. It’s a Wednesday, business is growing and customers are flooding his website. The heavy geocoding usage triggers the alert and sends James an email.
He is now aware of the risk of hitting the cap and can make a business decision to relax the quota or leave the default behavior in place and provide a friendly message that this capability is temporarily disabled. He logs into Cloud Console later that day and finds the open incident created when the alert was triggered.
He can acknowledge the incident at his convenience to dismiss it.
Wrap Up
Maps platform services like geocoding and directions can be monitored and alerted on just like the other cloud platform services. We’ve only touched on what’s possible with the Operations Dashboard. Explore on your own by building a dashboard of various service metrics. Metrics Explorer is a good place to start.
Comments
0 comments
Please sign in to leave a comment.