List pending queries

247 views
Skip to first unread message

Adam Lloyd

unread,
Mar 31, 2021, 11:46:08 AM3/31/21
to Druid User
Hi all,

I am looking for a way to list any pending/running queries inside Druid. It seems that there may have been a way in the past (segment/scan/pending) but this looks to be old info as the endpoint is no longer listed i the API docs.Ā 

Is there any way to do this currently?

Thanks,
A

Itai Yaffe

unread,
Apr 1, 2021, 7:14:02 AM4/1/21
to druid...@googlegroups.com
Hey Adam,
I believeĀ you are referring to this thread (https://groups.google.com/g/druid-user/c/zuWn83moIIU) w.r.t segment/scan/pending, but in fact, this is a metric Druid emits (either from Historicals or real-time tasks), that shows the number of segments waiting to be scanned (in order to serve queries), seeĀ https://druid.apache.org/docs/latest/operations/metrics.html#historicalĀ andĀ https://druid.apache.org/docs/latest/operations/metrics.html#real-time.

There is a way to see the numberĀ of queries that were executed/succeeded/failed/interrupted, if you include the QueryCountStatsMonitor (seeĀ https://druid.apache.org/docs/latest/operations/metrics.html#historical).

TBH, I'm not sure if there's a way to list the queries that are currentlyĀ running.

Ā  Ā  Ā  Itai

--
You received this message because you are subscribed to the Google Groups "Druid User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to druid-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/druid-user/ee9c3c42-7237-40d1-a509-d07558da4ae1n%40googlegroups.com.

Adam Lloyd

unread,
Apr 1, 2021, 7:28:22 AM4/1/21
to Druid User

Hi Itai,

Thanks for taking the time to reply.

That makes alot of sense. I think the QueryCountStatsmonitor may be something for me to try but I suspect it might not have the info I need. I'm basically trying to check that the correct queryId is being attached to the queries such that they can be cancelled using DELETE/:queryId. This is an issue because that endpoint returns 202 regardless of a valid query ID so, for all I know its doing nothing if the correct query IDs are not being associated with the quereies.

Adam

Itai Yaffe

unread,
Apr 1, 2021, 7:46:53 AM4/1/21
to druid...@googlegroups.com
I see.
So there are 2 partial solutions I can think of:
  1. You can set the query ID yourself, on the query context ("sqlQueryId" for SQL queries, and perhaps "queryId" for native queries). That way, you know the query ID to use for the DELETE API.
  2. I saw this (rather old) answer from Gian, saying that you can set a timeout on the query context, to cancel long queries (https://www.druidforum.org/t/how-to-use-query-cancellation/690).
Anyway, let's see if anyone else has a better answer for you.
Good luck, I hope you'll find what you need šŸ™‚

Adam Lloyd

unread,
Apr 1, 2021, 8:02:26 AM4/1/21
to Druid User
I am setting the query ID on the query context (i think) but i'd like to know for sure if the code is useless or not that's cancelling it.Ā 

Thanks again for all the input Itai

Reply all
Reply to author
Forward
0 new messages