Sid
Sid

Reputation: 255

Creating alert policies in Error Reporting in Stackdriver

I have a requirement to create an alerting policies when there are 30 connection timeout exceptions.We are currently throwing exception when there is connection timeout during a web service call(consuming restful webservices) so i want to get alerts when there are like 30 connection timeout exceptions. Is there any way i can create such policies in Stakdriver.We are currently using java8, spring boot, google kubernetes engine, stackdriver logging. I've created the metric called SAX-Exception an When i'm trying to create the stackdriver alert policies for this metrics i don't see any option to aggregate the number of exception over a period of time.

                         This below image shows how the metrics is defined

enter image description here

Below images show how the alerts policies are defined enter image description here enter image description here enter image description here enter image description here

Upvotes: 1

Views: 617

Answers (1)

John Hanley
John Hanley

Reputation: 81464

For this answer I will assume that your connect errors are being logged to Stackdriver Logging with sufficient detail that can be parsed by Stackdriver.

Your software that is throwing the exception needs to record this using Stackdriver Logging if you want to use Stackdriver Alerting. Adding Stackdriver logging code is very easy in just about any language including Java.

Stackdriver Logging Client Libraries (Java).

Assuming that you have Stackdriver Logging logs with desired event details:

  • Go to Stackdriver Logging.
  • Create a metric based upon your desired error based upon content in your log entries.

Documentation: link.

Once you have a metric created, you can then create an alert based upon this metric. You can aggregate based upon number of events per period of time. In your case 30 events in one minute (or whatever you need as your failure indicator).

Documentation: link.

Upvotes: 1

Related Questions