Repository navigation
feat: Show running PPL queries in Live Queries - #699
KishoreKicha14 merged 2 commits into
Conversation
A PPL query runs as a cluster:admin/opensearch/ppl task whose searches are its child tasks. Live Queries listed only search tasks, so the PPL task was filtered out, each of its searches became a separate top-level row, and the query itself was invisible between searches. List the PPL task alongside searches and report it as one live query: its child searches and their shard tasks are its shard_tasks and add to its totals, and its latency is the PPL task's running time. A PPL task has no workload group or captured identity of its own, so both come from its first local child search that has one. No model or wire change: coordinator_task.action tells PPL rows apart. Signed-off-by: Kishore Kumaar Natarajan <kkumaarn@amazon.com>
PR Reviewer Guide 🔍(Review updated until commit 14b90c8)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #699 +/- ##
============================================
- Coverage 77.98% 76.80% -1.18%
- Complexity 952 1051 +99
============================================
Files 87 93 +6
Lines 3630 4006 +376
Branches 411 493 +82
============================================
+ Hits 2831 3077 +246
- Misses 607 720 +113
- Partials 192 209 +17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| String wlmGroupId = localWorkloadGroupId(coordinatorInfo); | ||
| for (int i = 0; wlmGroupId == null && i < childSearches.size(); i++) { | ||
| wlmGroupId = localWorkloadGroupId(childSearches.get(i)); | ||
| } |
There was a problem hiding this comment.
WLM doesn't manage the PPL task itself (PPLQueryTask isn't a WorkloadGroupTask). It only manages the searches the PPL query runs, so the PPL row shouldn't show a WLM group. Copying the first child search's group can also be wrong, because one PPL query can run searches in different groups.
Suggest leaving wlm_group_id empty on PPL rows and showing the group on each child search instead. How should ?wlmGroupId= filter PPL rows then? For example, include the row if any of its searches is in that group?
There was a problem hiding this comment.
With the update, a PPL query's row has no WLM group anywhere. WLM only tags searches, so the PPL task itself never gets a group, and each child search is tagged separately.
There was a problem hiding this comment.
?wlmGroupId=X keeps the PPL row while at least one of its running searches is in group X, and hides it between searches.
WLM manages the searches a PPL query runs, not the query itself: the PPL task is not a WorkloadGroupTask, and WLM tags each search on its own, so one query can run searches in several groups. Copying the first search's group onto the PPL row could show the wrong group, and the row showed none between searches. Leave wlm_group_id off PPL rows. ?wlmGroupId= keeps a PPL row while any of its running searches is in that group, so between searches the filter hides it. Also note in the class javadoc that an async PPL query still running when its wait time passes has its later searches listed as separate live queries, since its PPL task has ended. The main PPL test now gives the PPL task usage of its own, as the SQL plugin tracks the PPL engine's threads on it (opensearch-project/sql#5760). Signed-off-by: Kishore Kumaar Natarajan <kkumaarn@amazon.com>
|
Persistent review updated to latest commit 14b90c8 |
f4f5545
into
opensearch-project:main
Live Queries leaves wlm_group_id off PPL rows as of opensearch-project/query-insights#699: WLM manages the searches a PPL query runs, not the query, so a PPL row has no group of its own. Remove it from the PPL row in stub_live_queries_ppl.json so the fixture matches what the API returns. Signed-off-by: Kishore Kumaar Natarajan <kkumaarn@amazon.com>
Live Queries leaves wlm_group_id off PPL rows as of opensearch-project/query-insights#699: WLM manages the searches a PPL query runs, not the query, so a PPL row has no group of its own. Remove it from the PPL row in stub_live_queries_ppl.json so the fixture matches what the API returns. Signed-off-by: Kishore Kumaar Natarajan <kkumaarn@amazon.com>
Description
A PPL query runs as a
cluster:admin/opensearch/ppltask, and the searches it runs are its child tasks. Live Queries listed only search tasks, so the PPL task was filtered out: each of its searches showed up as a separate row, and between searches the query wasn't listed at all.This lists the PPL task alongside searches and reports each PPL query as one live query:
coordinator_taskis the PPL task. Its child searches and their shard tasks are itsshard_tasks, and their CPU and memory add to the row's totals.total_latency_millisis the PPL task's running time.wlm_group_id. WLM manages the searches a PPL query runs, not the query (PPLQueryTaskisn't aWorkloadGroupTask), and one query can run searches in several groups.?wlmGroupId=keeps a PPL row while any of its running searches is in that group.There is no model or wire change: a PPL row is one whose
coordinator_task.actioniscluster:admin/opensearch/ppl.The searches nest under the PPL task because the SQL plugin makes them its children (opensearch-project/sql#5888, merged). The PPL task's own CPU and memory, from the PPL engine's threads, show once opensearch-project/sql#5760 merges; until then a PPL row's totals cover its searches only. The dashboards side is opensearch-project/query-insights-dashboards#612.
Known limitations
wait_for_completion_timeoutorkeep_alive): a query still running when its wait time passes ends its PPL task, so the searches it runs after that show as separate rows, as before this PR.Follow-ups
use_finished_cache=true) still lists a finished PPL query as its separate searches, each under its search task id. A follow-up will record it under the PPL task's id (nodeId:pplTaskId), so the dashboards can follow a row from live to finished.Testing
TransportLiveQueriesActionTests: a PPL query with its searches, a PPL query between searches, a search whose parent isn't listed, the user taken from a child search,filter_by_mode=username, and WLM filtering across searches in different groups. All 658 unit tests pass.?wlmGroupId=DEFAULT_WORKLOAD_GROUPkept it only while a search was running, and the DSL row was unchanged.Issues Resolved
None filed.
Related: #647 (draft) took an earlier approach to Live Queries, with a query source attribute on the record; this PR doesn't need it. #650 changes the same part of
TransportLiveQueriesAction, so whichever merges second needs a rebase.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.