How to eliminate 0% from alert analysis

###Alerts Question Template

  • Please describe what are you seeing:
    I want to elimitate the case of 0% from the alert conditional, or a better way, eliminate the alarm NRQL analysis when I do not have any event. The reason is when we do not have any request the percentage should be analysed…

  • How does this differ from what were you expecting to see?

  • If you aren’t seeing expected alert or data, please provide a link to the incident or violation (policy, condition, data app etc.)

Helpful Resources
Relic Solution: The key to consistent alert notifications

Troubleshooting downtime document

Hi @roger15!

So, there are some circumstances in which the NRQL percentage() function will return a NULL instead of 0 – and as long as a query gives a NULL response, alert evaluation will stop completely (as desired).

Basically, alert evaluation stops when the denominator of your percentage equation is a 0. In this specific case, evaluation will stop so long as SELECT count(*) FROM Transaction WHERE transactionSubType = 'AccountCreated' matches zero events.

While the preview chart indicates a breach of the critical threshold, those charts may not always distinguish between NULL and 0. Knowing the behavior of percentage(), I wouldn’t expect this to open any real-live violations, despite that it’s shaded in red.


Although, looking at it further, I wouldn’t expect this query to ever return a non-zero value:

SELECT percentage(count(*), WHERE transactionSubType = 'ConductorCreated') FROM Transaction WHERE transactionSubType = 'AccountCreated'

As written, the numerator looks for the number of events where transactionSubType is equal to ConductorCreated, from a group of events where transactionSubType is equal to AccountCreated. This logic would never match any events, since a single event record can’t have two simultaneous values for a single attribute.


Let me know if all that information makes sense – NULLs are a tricky subject in particular. For further reading, here’s a guide I just wrote on that topic: Relic Solution: Evaluating an Absence of Data with a NRQL Alert Condition.

2 Likes

I changed to include both, Account Created and ConductorCreated in the denominator… But had to change the percentage expected

About the elimination of case zero, when we do not have any AccountCreated, I add more one conditional:

Should I removed it once the percentage as null will be not analysed as 0%?

@Roger15 - Can you further explain what you mean by

About the elimination of case zero, when we do not have any AccountCreated, I add more one conditional:

Conditions within a policy are not chained and are evaluated separately.

In regards to your edit to include both, AccountCreated and ConductorCreated, as long as there is a value that is not zero in the denominator you should be ok.