Details
-
Task
-
Resolution: Fixed
-
Major
-
None
-
None
-
1
Description
Monitor runtime queries:
FTS allows you to supervise the active queries in the system. Furthermore, the user can get this information by hitting rest endpoints on any fts node, and the response would capture the results from all the nodes.
So, there is a scatter gather involved when you hit the query details endpoint
The users can use the /api/query/index/{indexName} endpoint to get the details of all the active queries for any given FTS index in the system. With this endpoint, the users can also use the longerThan argument to filter the queries running beyond the given span of time.
The longerThan duration string is a signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "20s", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
curl -XGET http://172.23.96.91:8094/api/query/index/travel -u Administrator:asdasd |
|
{
|
"status": "ok", |
"stats": { |
"total": 3, |
"successful": 3 |
},
|
"totalActiveQueryCount": 1, |
"filteredActiveQueries": { |
"indexName": "travel", |
"queryCount": 1, |
"queryMap": { |
"49764546ebad3543258b0bf67766e02d-3": { |
"QueryContext": { |
"query": { |
"query": "*" |
},
|
"size": 10, |
"from": 0, |
"timeout": 10000, |
"index": "travel" |
},
|
"executionTime": "932.126348ms" |
}
|
}
|
}
|
}
|
|
curl -XGET http://172.23.96.91:8094/api/query/index/travel\?longerThan\=5s -u Administrator:asdasd | jq |
{
|
"status": "ok", |
"stats": { |
"total": 3, |
"successful": 3 |
},
|
"totalActiveQueryCount": 1, |
"filteredActiveQueries": { |
"indexName": "travel", |
"longerThan": "5s", |
"queryCount": 1, |
"queryMap": { |
"49764546ebad3543258b0bf67766e02d-4": { |
"QueryContext": { |
"query": { |
"query": "*" |
},
|
"size": 10, |
"from": 0, |
"timeout": 10000, |
"index": "travel" |
},
|
"executionTime": "6.330014023s" |
}
|
}
|
}
|
}
|
“Stats” field indicates the scatter- gather specific information. That is to say, total indicates the number of fts nodes participating in the scatter gather, success means the number of nodes that returned successfully and failed indicates the number of nodes that returned with an error. In case of a failure from one or more nodes, the supervisor can return partial results even when there is a single node that returned successfully and the errors that caused the failure on certain nodes would be captured in the “errors” field with the failed nodes uuid as key and the error as value.
The totalActiveQueryCount talks about the number of active queries in the system irrespective of whether queries to a specific index were requested. The filteredActiveQueries are the query map entries after filtering out index specific queries and also the queries that are running longer than the longerThan value. Another important thing to note is the keys of the query map entries. Now, these are of the form shaVal-queryID, where shaVal is the uuid of the coordinator for that particular QueryContext which was run and queryID is the query’s local ID on the coordinator node.
So, using the uuid value a query can be canceled on the particular coordinator after which the query will just stop running and you won’t get the results of it.
curl -X POST -u Administrator:asdasd -H "Content-Type: application/json" http://172.23.96.91:8094/api/query/7/cancel -d '{ "uuid": "49764546ebad3543258b0bf67766e02d" }' | jq |
|
{
|
"status": "ok", |
"msg": "query with ID '7' on node '49764546ebad3543258b0bf67766e02d' was aborted!" |
}
|