You can create alerting policies in Stackdriver Monitoring to monitor the number of Stackdriver Trace spans ingested per month, your quota usage, and your rate of span ingestion. If you have never created an alerting policy, see Managing alerting policies for detailed information on using the Stackdriver Monitoring console.
Creating a monthly span-usage alert
You can alert on your Trace usage in the same way you alert on other kinds of usage in Stackdriver. For details, go to Alerting on Stackdriver usage.
Creating an over-quota alert
The over-quota alert described in this section monitors resource exhausted error responses for your Stackdriver Trace API calls. When you have exceeded your daily spans ingested quota and when you have exceeded your API rate quota, your API calls will fail with resource exhausted errors. The HTTP response code for this error is 429.
To create an over-quota alerting policy, do the following:
Go to Monitoring:
From Alerting, select Create a Policy.
Click Add Condition.
Select Consumed API for the resource type and Request Count for the metric.
Add the filter
service = cloudtrace.googleapis.comand the filter
response_code = 429:
Aggregate your individual time series into a single time series:
- Set the Aligner field to sum.
- Set the Reducer field to sum.
Set the Configuration fields and then select Save.
For example, if you want to be notified that a resource exhausted error response was received in a one minute interval, set the Configuration to trigger if any time series is above zero for one minute:
You can alter the measurement interval or the number of responses received according to your needs.
Complete the alerting policy by filling in the Notification, Documentation and Name sections, and then selecting Save. For details, go to Creating an alerting policy.