newrelicnewrelic-platformnrql

NRQL query to fetch highest error rate & slowest average response time


enter image description here

enter image description here

Attached two images with highest error rate and slowest average response time. I need an NRQL query to find each transaction in the "slowest average response time" and if any one of the transaction is above 3 minutes I need to get an email alert along with transaction name details which is causing the alert.

Required one more NRQL query for "Highest error rate" and if any one of the transaction is above 80% I need to get an email alert along with transaction name details which is causing the alert


Solution

  • I need an NRQL query to find each transaction in the "slowest average response time" and if any one of the transaction is above 3 minutes I need to get an email alert along with transaction name details which is causing the alert.

    FROM Transaction SELECT count(*) where duration >= 120 facet name 
    

    Above will give you the count of transactions where duration > 120 seconds, grouped by transaction name. If you set this as an alert, you can set the threshold to >0 to generate incidents any time this occurs.

    Required one more NRQL query for "Highest error rate" and if any one of the transaction is above 80% I need to get an email alert along with transaction name details which is causing the alert

    FROM Transaction SELECT percentage(count(*), where error is true or httpResponseCode like '5%' or httpResponseCode like '4%') facet name
    

    Above will give the error % per transaction - This can be tweaked to remove specific errors or response codes as well.