Report of median error count during a user's session

I’d like to build a report to display the median error count of all our user sessions (how many errors does a user see in a session).

I have the current query which will show me counts for individual sessions:

SELECT count(*) from JavaScriptError where appName = '<app name>' FACET . browserInteractionId TIMESERIES 1 week SINCE 4 weeks ago

but I’m not sure if new relic supports using those counts in aggregate. Is there a query I can use to meet what I am looking for?

Hey @gdaunton - We do have a median() function in NRQL - but I’m really struggling to think of an attribute to set that on - as you can’t run median(count(*)), since NRQL doesn’t support nested functions.

Alternatively, there is the percentile() function, where the 50th percentile would equate to the median, but again I’m struggling to think of the attribute to run the query on.

Are there any other visualisations of browser errors that could work for you?

The query below could show you the percentage of page views that result in a JS Error event:

SELECT (filter(count(*), WHERE eventType() = 'JavaScriptError') / filter(count(*), where eventType() = 'PageView')) * 100 as '% of errors' FROM JavaScriptError, PageView SINCE 2 weeks ago 

Which may be helpful for you too.

Thanks for the response!
Yep it looks like I would need nested query support in order to create this report.
Thanks for page views that result in js errors suggestion, it’s pretty useful and I have something similar to your query on my dashboard.

I made sure to submit my vote on the subquery/nested query feature thread


Fantastic! Thanks for voting :smiley: