Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

Getting a percentage out of errors and transactions in Alerts



I would like to setup a NRQL alert where I could set a threshold if a specific error occurs more than X% times within Y minutes.

For example, if ‘Provider validation’ errors are more than 2% of the total transactions within 5 minutes I would like to send an alert.

I made a query that looks like this:

select filter(count(*), WHERE `error.message` LIKE '%Provider Valudation%') * 100 / filter(count(*), WHERE duration is not null) FROM Transaction, TransactionError WHERE appName = 'pricing-api-aws-integration'

Now this query runs fine when I try this inside an insights dashboard. I get a number that represents the correct percentage.

When I use this same query when I create an alert I get a different result entirely. I get a graph where the x-axis represents the time and the y-axis represents binops. I would like to know how I can get a correct representation in percentages so that I can create an alert based of off this.

Kind regards,



Hi @jimmy.ruts - You cannot use filter inNRQL Alerts, but you can use percentage. If you change your query it should then work but I’m not certain that this is exactly the same as your query.

SELECT percentage(count(*), WHERE `error.message` LIKE '%Provider Valudation%')
FROM Transaction, TransactionError
WHERE duration is not null and appName = 'pricing-api-aws-integration'


Hey @jimmy.ruts, just wondering if @stefan_garnham’s suggestions were able to help you solve this or is there anything else you need? :slight_smile:


Hi @rdouglas ,

sorry for the late response.
@stefan_garnham his response was helpful! Not 100% what I needed but it put me in the right direction. It was just a matter of deep diving in to NRQL and getting experienced with it.

Kind regards,



Great @jimmy.ruts thanks for letting me know :slight_smile: