feat: support wm state columns and client info in running queries#3742
Conversation
There was a problem hiding this comment.
Pull request overview
Surfaces Workload Manager (WM) state tracking fields from .sys/query_sessions in the Running Queries UI to help diagnose query queueing vs execution.
Changes:
- Extend the running-queries backend SQL to select
WmPoolId,WmState,WmEnterTime, andWmExitTime. - Add new Running Queries table columns (with defaults, titles, and sort-field mappings) and render WM fields in the query details drawer.
- Add i18n strings for the new WM columns.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/store/reducers/executeTopQueries/executeTopQueries.ts | Adds WM fields to the .sys/query_sessions SELECT for running queries. |
| src/containers/Tenant/Diagnostics/TopQueries/utils.ts | Renders WM fields in the query details drawer when present. |
| src/containers/Tenant/Diagnostics/TopQueries/columns/i18n/en.json | Adds English i18n labels for WM columns. |
| src/containers/Tenant/Diagnostics/TopQueries/columns/constants.ts | Defines WM column IDs/titles, default visibility, and running-queries sort field mappings. |
| src/containers/Tenant/Diagnostics/TopQueries/columns/columns.tsx | Implements WM table column renderers and includes them in running queries columns. |
|
@copilot avoid specifying exact columns in sql query - some versions may not support all of them. select * and act accordingly to response. |
Changed to |
|
@copilot lets add to the drawer list of query properties the following properties:
|
Added all 4 client properties to the drawer in |
|
@copilot address review comments |
… parentheses, normalizeQueryText nullish check Agent-Logs-Url: https://github.com/ydb-platform/ydb-embedded-ui/sessions/08189414-41d3-403e-b9ad-56181f13ca78
Addressed in
|
- Select only the 12 columns actually used by the table and drawer - Alias `Query as QueryText` directly in SQL, eliminating the need for the normalizeQueryResult helper - Remove normalizeQueryToQueryText and normalizeQueryResult functions and their tests (no longer needed) Agent-Logs-Url: https://github.com/ydb-platform/ydb-embedded-ui/sessions/bceebd7e-4ca5-4e85-a499-f6f4cb44eb61
All resolved review comments were addressed in |
|
@copilot it appears we use this pattern in codebase widely like row.WmPoolId !== null && row.WmPoolId !== undefined && row.WmPoolId !== '' maybe this could be extracted to some helper and reused? |
Done in |
|
@copilot as I told you before, not every backend version supports all the columns possible. it's reasonable to make query using "select *" and then decide which columns to display or not |
Done in |
SELECT *with JS normalization layer (normalizeQueryResult) for backward compatibility with older backend versions that may lack WM/client columnsgetRunningQueriesCount(SQL aggregation)normalizeQueryResulthelper (12 tests) andcreateQueryInfoItemshelper (24 tests)isNonEmptyValueutility helper (src/utils) for the repeated!== null && !== undefined && !== ''pattern, and use it in columns and drawer logicgetRunningQueriesText()— parenthesized OR filterwmPoolIdColumn/wmStateColumn— useisNonEmptyValuefor falsy-but-valid value handlingwmEnterTimeColumn/wmExitTimeColumn— guard against empty strings beforenew Date()createQueryInfoItems— add empty-string guards for WM/client string fieldsSELECT *for backward compatibility with older backends (per @adameat)Greptile Summary
This PR adds Workload Manager (WM) state columns (
WmPoolId,WmState,WmEnterTime,WmExitTime) to the running queries table and client info fields (ClientAddress,ClientPID,ClientUserAgent,ClientSdkBuildInfo) to the query drawer, along with a SQL OR-precedence fix, consistent empty-string guards via the newisNonEmptyValuehelper, and aQuery→QueryTextnormalisation layer that handles the backend column naming difference introduced by switching toSELECT *.Confidence Score: 5/5
Safe to merge — all previous review concerns addressed, new functionality is well-guarded and well-tested
All remaining findings are P2: a PR description inaccuracy and a minor style suggestion about preserving the Query key. No runtime bugs, no data-loss risk, and the SQL OR-precedence fix and empty-string guards are correct. Test coverage for all new helpers is thorough.
No files require special attention; executeTopQueries.ts and utils.ts are the core logic files and both look correct
Important Files Changed
Sequence Diagram
sequenceDiagram participant YDB as .sys/query_sessions participant API as sendQuery() participant Parse as parseQueryAPIResponse() participant Norm as normalizeQueryResult() participant Table as RunningQueriesTable participant Drawer as QueryDrawer YDB->>API: SELECT * (Query, WmPoolId, WmState,<br/>WmEnterTime, WmExitTime,<br/>ClientAddress, ClientPID, ...) API->>Parse: raw HTTP response Parse->>Norm: IQueryResult {rows with Query field} Note over Norm: row.Query → row.QueryText<br/>when QueryText absent/null/"" Norm->>Table: IQueryResult {rows with QueryText field} Table->>Table: getRunningQueriesColumns()<br/>QueryHash | UserSID | QueryStartAt | QueryText<br/>ApplicationName | WmPoolId | WmState (default)<br/>WmEnterTime | WmExitTime (optional) Table->>Drawer: row click → KeyValueRow Drawer->>Drawer: createQueryInfoItems(row)<br/>Adds: WmPoolId, WmState, WmEnterTime, WmExitTime<br/>ClientAddress, ClientPID,<br/>ClientUserAgent, ClientSdkBuildInfoPrompt To Fix All With AI
Reviews (20): Last reviewed commit: "fix: use explicit nullish checks in norm..." | Re-trigger Greptile
CI Results
Test Status: ✅ PASSED
📊 Full Report
😟 No changes in tests. 😕
Bundle Size: 🔺
Current: 63.27 MB | Main: 63.26 MB
Diff: +0.01 MB (0.02%)
ℹ️ CI Information