Repository navigation
feat(admin): make the Trino queries view readable at pool scale - #1257
Conversation
- Count every pre-execution state (QUEUED, WAITING_FOR_RESOURCES, DISPATCHING, PLANNING, STARTING) as waiting. Only QUEUED was counted, so a saturated cell reported 0 queued. - Lead each row with the statement verb and target table, with leading client comments (SQLMesh plan markers) stripped. Rows expand to the full SQL and execution detail (drivers, rows, network, spill, tag). - Per-org and per-pool-instance breakdowns; click one to filter. - State-bucket filter chips, sortable columns, a progress bar, and search over SQL text and query id as well as org and principal. - The pool observer stamps each query (list and detail) with the instance whose coordinator holds it. - The cell picker defaults to the first registered cell when the URL names none, instead of rendering an empty page. An explicit cell in the URL is never replaced. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nic9bR3LPTRLk56ntJ4M5Z
There was a problem hiding this comment.
Checked the cell-picker defaulting (against forCell requiring an explicit cell and handleCells sorting by ID, so "first cell" is deterministic), the waiting-state and bucket logic, trinoSqlSummary (the regexes are anchored and have disjoint alternations, so there's no catastrophic backtracking on large SQLMesh statements), grouping and sorting, the new table layout (the expanded row's colSpan matches 10 or 11 columns), Kill/copy click propagation, and the Go observer and e2e changes that stamp instance. The backend change is small, and the list and detail paths are both tested.
P2
orgPickandinstancePick(andbucket) are not reset when the cell picker changescell. A drill-down picked on cell-001 carries over to cell-002 and usually shows an empty list. The Clear chip does appear, though.- Rows expand only on a mouse click on the
<tr>, so keyboard users can't reach the full SQL or details. Also,aria-sortis set on the<button>, but it is only valid on the column header (TableHead/th). - The defaulting also applies on
TrinoCluster(it sharesTrinoCellPicker), so that page now lands on cell-001 with its recovery controls. That's probably intended, but the PR description only mentions the queries page.
Inline comments
controlplane/admin/ui/src/pages/TrinoQueries.tsx:258— P2:orgPick/instancePick(andbucket) survive a cell switch fromTrinoCellPicker, so a drill-down from one cell silently filters the next cell's list, usually to empty. Consider resetting them whencellchanges, e.g. key the page state oncell.controlplane/admin/ui/src/pages/TrinoQueries.tsx:489— P2: Expansion is mouse-only (anonClickon thetr, with no focusable control and noaria-expanded). Making the chevron cell a<button aria-expanded>would make it keyboard-accessible. Separately,aria-sortat line 147 belongs on theTableHead, not on the inner button.
— Robo Bill v2 (opus, high reasoning)
Test Impact PlanDeterministic summary of how this PR changes tests, CI runners, and coverage-risk signals. Summary
Signals
Coverage risk: neutral or increased No coverage-reduction warnings detected. |
Problem
Watching Portola's SQLMesh plan on
/trino/queries?cell=cell-001was hard:WAITING_FOR_RESOURCES./* SQLMESH_PLAN … */comment, so you couldn't tell which model a query was building.Changes
Cell default.
TrinoCellPickerfills an absentcellparameter with the first registered cell, using replace navigation so the back button is unaffected. An explicitcell=in the URL, even an unknown one, is never replaced. This reverses the "explicit selection even with one cell" behaviour from #1171/#1246, as requested.Waiting states. "Waiting" (formerly "Queued") counts QUEUED, WAITING_FOR_RESOURCES, DISPATCHING, PLANNING and STARTING. The same states get the
queuedflag and the warning badge colour.Readable rows.
trinoSqlSummarystrips leading comments and extracts the verb and target, for exampleINSERT INTO org_x.sqlmesh_trino.events__123. The comment is kept as the "client tag". Clicking a row expands it to show the full (still redacted) SQL plus query id, principal, source, resource group, drivers, rows read, network, spill, queued time and error.Breakdowns. There are "By org" and "By pool instance" tables showing running, waiting (with blocked), CPU, scanned, peak memory and longest query. Clicking a row filters the list. The headline cards and breakdowns follow the search box but not the drill-down filters, so they keep describing the whole cell.
Navigation.
Backend.
admin.TrinoQuerygainsinstance(omitempty).trinoPoolObserver.QueriesandQuerystamp it with the pool instance whose coordinator holds the query. A cell with a single coordinator leaves it empty, and the UI then hides the instance column and breakdown.Tests
lib/trino.test.ts: waiting states, SQL summary (SQLMesh comment, quoted identifiers, DDL kinds, WITH reads), grouping, sorting.TrinoQueries.test.tsx: waiting count, verb/target rendering, expand/collapse, sorting, state chips, org drill-down and clear, instance breakdown shown or hidden, SQL and query-id search, Kill not expanding the row.TrinoCellPicker.test.tsx: defaults with one cell and with several, keeps an explicit cell, no navigation before the list loads.trino_pool_observer_test.go: list and detail both carry the owning instance.tests/mw-dev/e2e/trino.sh: the live long-running query names one ofpool-test's instances in both the list and the detail.Results:
vitest279/279,typecheck,lint(no new warnings),build, andgo test -tags kubernetes ./controlplane/ -run 'TestTrinoPoolObserver|TestPooledCell'. LocallyTestAdminGetOrgPreloadsTrinoPostgresneeds docker-compose, which isn't installed here; it is unrelated.🤖 Generated with Claude Code
https://claude.ai/code/session_01Nic9bR3LPTRLk56ntJ4M5Z