ianking
ianking

Reputation: 75

New Relic - average page load time for ajax response body count?

I'm pretty new to New Relic & Insights and am having trouble coming up with the right query to benchmark my page. Here's an example situation: lets say I have a page that manages my library of books. Users can log in and go to a page that shows the list of books they have checked out (myfreelibrary.com/checkouts). When that page is loading, the list of books checked out by that user is retrieved by a JSON call to my back end (POST: mylibapi.com/books/{user-id}?format=json). Some users have a handful of books, some have 20-30, some have over 100.

I'm trying to create a New Relic dashboard that shows average page render times of the checkouts page, preferably with the users grouped by the number of books they have checked out. Ex: Avg pageRenderTime for users with <20 books, 21-50 books, 51-100 books, 100+ books.

I'd also like to be able to compare those times to the same metrics taken a week ago. The ultimate goal is to be able to see whether recent UI improvements have positively impacted page render times for the various buckets of users.

Thanks in advance for any info!

Upvotes: 0

Views: 567

Answers (1)

anothermh
anothermh

Reputation: 10546

You likely want to use FACET CASES with the results that you are receiving in Insights. For example, you could query your PageView data and FACET CASES into categories like less than 1 second, greater than 1 second, and greater than 20 seconds:

SELECT count(*) FROM PageView FACET CASES (WHERE duration > 1, WHERE duration < 1, WHERE duration > 20)

More information on how to use FACET and FACET CASES is available in the NRQL documentation.

This won't perfectly answer your question because New Relic by default does not collect the information that you want to facet by. You would need to collect custom attributes so that every transaction recorded by New Relic also includes the total number of elements in the result set. Then you can form a query in Insights like:

SELECT count(*) FROM PageView FACET CASES (WHERE book_count > 1, ...) COMPARE WITH 1 WEEK AGO

Upvotes: 1

Related Questions