Fetching more than 1000 unique app ids from insight?

Usual questions

  • There are many ways to achieve a goal in Insights, tell us a bit about your end goal. What insights are you hoping to gain?

I am trying to prune out some of our applications registered per each account. To do that, I need to know which ones have recently reported and which ones are outside our range of “valid” accounts. I have a previous question on discuss that got me to this new question.

I have the complete list of applications from the v2 api. I have the ability to get some of the currently reporting applications, until I hit a wall at 1000 records. See my query below.

  • Please include the URL to the Insights dashboard that needs addressing:

N/A?

  • Let us know which NRQL queries you have tried so far:

In this query, I am passing in $daysBack as a parameter and the final NRQL is being generated as a string. I include this to demonstrate that this is a potentially variable condition for my team.

SELECT uniques(apmAppId) FROM NrDailyUsage SINCE $daysBack days ago LIMIT MAX

This is great, except we have way more than 1000 applications active in this environment. We prefer to do this this way for dashboards and reporting/comparisons instead of trying to work across accounts.

Actual request:

How do I get more than 1000 unique application IDs?
I’m going to have to resort to polling for any applications after the 1000th one one-by-one to the API I guess? Can I do an order-by and a from-id on this?

other stuff

So, I realize that this is sort of the 100th repeat of the 1000 unique limit. There are two reasons for posting this question even knowing that:

  1. The more data points that you have that people want to do stuff, the better you can make the product
  2. Maybe in this particular case there’s a better way to do things.

Helpful Resources:

Hi @cole.brand, I have some great news to share – you can actually return up to ten thousand unique values of an attribute per query.

uniques() defines its limit not in the LIMIT statement, but in the function itself. The syntax is uniques(attribute, limit) so your query might look like the following:

SELECT uniques(apmAppId, 10000) FROM NrDailyUsage SINCE $daysBack days ago LIMIT MAX

Here’s our documentation on that function:

https://docs.newrelic.com/docs/query-data/nrql-new-relic-query-language/getting-started/nrql-syntax-clauses-functions#func-uniques

Let me know if that does the trick!

2 Likes

Oh sweet, that did it.