I am new to NQRL but very experience in SQL. I think that is causing me to make mistakes.
I have a Custom Value that I call SessionId. Service calls from my application add this value to the New Relic data for the call.
I use the following NRQL to get the total duration of all the calls in each SessionId:
SELECT sum(duration) from Transaction where http.SessionId is not null FACET http.SessionId
This works great. I get a list of the SessionIds and how long each one took.
I then want to know the average so I can put a single number on a dashboard. (To be able to show the average session time.)
I was expecting something like this to work:
SELECT average(SELECT sum(duration) from Transaction where http.SessionId is not null FACET http.SessionId)
But that gives the error “Unexpected Select”.
I can’t think I am the first person to go for an average of sums in Insights, but I don’t know how to get there from here.
What is the NRQL way to get an average of my total durations?