Page views with JS errors NRQL query

Hi, we are looking for an equivalent NRQL query for our “Page views with JS errors > 5% for at lease 5 mins” alert.

We came up with the following but the graph is not the same
SELECT count(errorMessage) / count(*) FROM JavaScriptError, PageView WHERE appName = ‘appname’

Any help is appreciated.

1 Like

This is not a perfect match, but it is what we use and is generally close enough. Note: I like making eventType()explicit, although you may be able to leave it out if you are using a field that is only available in one of the events (e.g. firstErrorInSession).

SELECT (
  filter(count(*), WHERE
    firstErrorInSession IS TRUE AND eventType() = 'JavaScriptError'
  )
  / filter(count(*), WHERE eventType() = 'PageView')
) * 100 as '%'
FROM JavaScriptError, PageView WHERE appName = 'appname'
3 Likes

@rraposa1 Thank you for sharing that work around!

@Subadhra.Raja Does that help you out?