Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

CM API: Maximum number of requests

avatar
Contributor

 

Hello,

 

I was using the CM API and I think that I reached the maximum number of requests. ¿What is the maximum of requests and how can I increase this value?

 

/api/v7/clusters/cluster/services/impala/impalaQueries?from=2018-05-31T0%3A0%3A0
{ "queries" : [ ], "warnings" : [ "Impala query scan limit reached. Last end time considered is 2018-05-31T16:21:46.409Z" ] }

 

 

Regards,

Joaquin

14 REPLIES 14

avatar
Contributor

I'm using this one:

 

/api/v18/clusters/cluster/services/impala/impalaQueries?from=2018-05-31T0%3A0%3A0&filter=(user=userX)"

 

Also, I solved this issue by restarting the Monitoring Service.

 

Regards,

avatar
Contributor

Thanks so . but unfortunately from and to clause doesn't help either 😞

 

https://hostname:7183/api/v18/clusters/cluster_name/services/impala/impalaQueries?from=2018-07-09T12:59:32.776Z&to=2018-07-09T17:04:32.776Z

 

Returns queries and ends with warning :

warnings" : [ "Impala query scan limit reached. Last end time considered is 2018-07-09T12:59:32.776Z" ]

 

Now as mentioned I use this timestamp for next query

 

 https://hostname:7183/api/v18/clusters/cluster_name/services/impala/impalaQueries?from=2018-07-09T12:59:32.776Z&to=2018-07-10

 

Returns queries and ends with warning:

  "warnings" : [ "Impala query scan limit reached. Last end time considered is 2018-07-09T17:04:32.776Z" ]

 

back to square one where it keeps showing that as the final timestamp, so I can't really use this warning message time stamp and as a measure to get all queries from sometime until current date. After just one loop it hits this timestamp and enters a never ending loop.

 

I'm not using any other filter for ex: User because I need to fetch all the queries and feed it to a dashboard. 

avatar
Master Guru

@Prav,

 

I am still a tad confused about how this works, but...

 

- Queries are returned from most recent to least recent

- default result limit is 100

- default offset is 0

 

It seems that if the number of queries in that partition is greater than the "limit" value + offset, then you will get the warning.

 

I suggest playing a bit more with the limit and offset values.

 

For example:

 

https://hostname:7183/api/v18/clusters/cluster_name/services/impala/impalaQueries?from=2018-07-09T12:59:32.776Z&to=2018-07-09T17:04:32.776Z&limit=1000

 

Check the number of results returned and the warning.  If you do hit a partition, use it as the "to" value for the next query.

Since the queries are listed from most recent, going back in time, the partition date will be come the "to" value once you have exhausted all results in the partition.

 

It is more or less this:


Return queries

  If num queries == limit value

    offset = limit + offset

  if num_queries == 0 && warning shows "Impala query scan limit reached"

    set "from" date to the value in the warning

  continue querying for results as shown above until 0 queries are returned.

 

I ran out of time today to write this out... play a bit with limit and offset and see if it makes sense.

Let us know your progress.

  

 

avatar
Contributor

@bgooley

 

here is the observation:

 

https://hostname:7183/api/v17/clusters/cluster/services/impala/impalaQueries?from=2018-07-09T12:59:32.776Z&to=2018-07-10&limit=1000 , Returns 1000 queries and ends with warning timestamp --> 2018-07-10T01:16:17.434Z

 

Use this timestamp in next query in to clause and it goes back in time


https://hostname:7183/api/v17/clusters/cluster/services/impala/impalaQueries?from=2018-07-09T12:59:32.776Z&to=2018-07-10T01:16:17.434Z&limit=1000 , Returns 1000 queries and ends with warning timestamp --> 2018-07-09T21:26:17.434Z

 

use timestamp from output warning from first attempt and put it in from clause alone and it moves ahead:


https://hostname:7183/api/v17/clusters/cluster/services/impala/impalaQueries?from=2018-07-10T01:16:17.434Z&limit=1000 , Returns 1000 queries and ends with warning timestamp --> 2018-07-10T13:56:17.434Z

 

Use timestamp from output warning and again put it in from clause and this time it just stays at the same timestamp in warning message:


https://hostname:7183/api/v17/clusters/cluster/services/impala/impalaQueries?from=2018-07-10T13:56:17.434Z&limit=1000 , Returns 1000 queries and ends with warning timestamp -->  2018-07-10T13:56:17.434Z

 

Use timestamp from output warning and again put it in to clause this time and it now hits warning with empty timestamp - Assuming this to be the most recent output?


https://hostname:7183/api/v17/clusters/cluster/services/impala/impalaQueries?to=2018-07-10T13:56:17.434Z&limit=1000 , Returns 1000 queries and ends with warning timestamp --> []

 

 

Does above check out with your assumption?

avatar
Master Guru

@Prav,

 

More or less, I think we are on the same page.  One thing to keep in mind, too is the offset so that you can make sure you are seeing all the results in the timeperiod.

 

For example:

 

Return the first 1000 queries starting from most recent:

 

https://hostname:7183/api/v17/clusters/cluster/services/impala/impalaQueries?from=2018-07-09T12:59:32.776Z&to=2018-07-10&limit=1000

 

Retrun the next 1000 queries:

 

https://hostname:7183/api/v17/clusters/cluster/services/impala/impalaQueries?from=2018-07-09T12:59:32.776Z&to=2018-07-10&limit=1000&offset=1000

 

Return the next 1000:

 

https://hostname:7183/api/v17/clusters/cluster/services/impala/impalaQueries?from=2018-07-09T12:59:32.776Z&to=2018-07-10&limit=1000&offset=2000

 

(Keep doing this until you get 0 results)

If you get 0 results AND you also have a warning, that means you have another partition to traverse.

In that case, you would use the date/time in the warning to populate the "to" parameter in the next query (assuming the warnings show the date time 2018-07-10T01:16:17.434Z):

 

https://hostname:7183/api/v17/clusters/cluster/services/impala/impalaQueries?from=2018-07-09T12:59:32.776Z&to=2018-07-10T01:16:17.434Z&limit=1000

 

If the number of queries is equal to the limit, increment the offset to return the next 1000:

 

https://hostname:7183/api/v17/clusters/cluster/services/impala/impalaQueries?from=2018-07-09T12:59:32.776Z&to=2018-07-10T01:16:17.434Z&limit=1000&offset=1000

 

and repeat until you get 0 queries returned.

 

If you get another warnings date/time, replace the "to" parameter value with it and repeat.

If you get 0 results and 0 warnings, there are no more queries to retrieve.

 

NOTE:  While you are doing all these queries, running queries may complete, so it is a good idea to specify an initial "to" date that is a little bit in the past if you want consistent results.