Skip to content

feat: add RU V2 fields to slow query and statement for clinic cloud#1890

Merged
ti-chi-bot[bot] merged 1 commit into
masterfrom
feat/ru-v2-fields-for-clinic
May 22, 2026
Merged

feat: add RU V2 fields to slow query and statement for clinic cloud#1890
ti-chi-bot[bot] merged 1 commit into
masterfrom
feat/ru-v2-fields-for-clinic

Conversation

@StinsonZhao

@StinsonZhao StinsonZhao commented May 21, 2026

Copy link
Copy Markdown
Collaborator

What's Changed

Surface the RU V2 metrics that clinic backend (clinic#1415) added to slow query and statement responses. Visibility is gated by a new `ISlowQueryConfig.showRuV2` / `IStatementConfig.showRuV2` flag, enabled only in `tidb-dashboard-for-clinic-cloud`. Standalone TiDB dashboard (`for-op`) and clinic on-prem (`for-clinic-op`) are unaffected.

For pingcap-inc/clinic-ui#651.

Slow query

  • Optional `ru_v2` / `ru_v2_detail` columns added to the column selector (registered in `slowQueryColumns`; per-tier selectability comes from `/slow_query/available_fields` as usual).
  • Premium (schema declares only `ru_v2`): the value is rendered as one extra row in the existing Basic info tab.
  • Starter / Essential (schema declares all three): a dedicated RU V2 tab is inserted between `Transaction` and `Warnings`, with three sections:
    • RU V2 — single numeric value
    • RU V2 Detail — full text, wrap-friendly via `
      ` so long detail strings stay legible
    • RU V2 Metrics — name/value table (description column dropped) over the `RequestUnitV2Metrics` struct (22 sub-fields)

Per-tier routing is driven by the `available_fields` schema rather than the data value, so the Basic-tab row and the dedicated tab never appear together for the same row.

Statement

  • Optional `avg_ru_v2` / `sum_ru_v2` columns added to the column selector (matched up with existing `avg_ru` / `sum_ru`).
  • Detail Basic info tab adds `avg_ru_v2` / `sum_ru_v2` / `max_ru_v2` / `sum_ru` rows when the flag is on.

Types

  • New `ui/packages/tidb-dashboard-lib/src/client/clinic-extensions.d.ts` augments `SlowqueryModel` / `StatementModel` (and adds a new `RequestUnitV2Metrics` interface) via module augmentation on `@lib/client`. This keeps the generated `models.ts` untouched, so any future `make generate_swagger_spec` run will not overwrite our additions. The dashboard Go models are intentionally not modified (these fields are produced by clinic's NGM proxy, not by the dashboard's own backend).

Test Plan

  • On a Premium clinic-cloud cluster: SlowQuery list shows the optional `RU V2` column; opening a row's Detail shows the value on the Basic tab; no separate "RU V2" tab.
  • On a Starter / Essential clinic-cloud cluster: SlowQuery list shows `RU V2` and `RU V2 Detail` columns; opening a row's Detail shows the new RU V2 tab (after `Transaction`) with all three sections; `ru_v2` is not duplicated inside the Basic tab.
  • On standalone TiDB dashboard (`for-op`) and clinic on-prem (`for-clinic-op`): no behavioral change.
  • SQL Statement list shows the new `Mean RU V2` and `Total RU V2` columns; Statement Detail Basic tab shows the four added rows.

Issue: pingcap-inc/clinic-ui#651

Surface the RU V2 metrics that clinic backend (PR #1415) added to
slow query and statement responses. Visibility is gated by a new
ISlowQueryConfig.showRuV2 / IStatementConfig.showRuV2 flag enabled
only in tidb-dashboard-for-clinic-cloud, so standalone TiDB dashboard
and clinic-op are unaffected.

Slow query
- New "ru_v2" / "ru_v2_detail" optional columns in the column
  selector (selectability still gated by available_fields per tier).
- Premium: the ru_v2 value is added to the existing Basic info tab.
- Starter / Essential: a dedicated "RU V2" tab is inserted between
  Transaction and Warnings, with three sections:
    - RU V2: single numeric value
    - RU V2 Detail: full text, wrap-friendly via <Pre>
    - RU V2 Metrics: name/value table (no description column) over
      the RequestUnitV2Metrics struct (22 sub-fields).
  Per-tier routing is driven by available_fields schema, not data.

Statement
- New avg_ru_v2 / sum_ru_v2 columns and avg_ru_v2 / sum_ru_v2 /
  max_ru_v2 / sum_ru rows in the Basic info detail tab.

Types
- src/client/clinic-extensions.d.ts adds the new fields via module
  augmentation on @lib/client. This keeps the generated models.ts
  untouched, so a future `make generate_swagger_spec` run will not
  overwrite our additions. Dashboard Go models are intentionally
  unchanged.
@ti-chi-bot ti-chi-bot Bot requested a review from Renkai May 21, 2026 10:38
@ti-chi-bot ti-chi-bot Bot added the size/XL label May 21, 2026
@ti-chi-bot ti-chi-bot Bot added the lgtm label May 22, 2026
@ti-chi-bot

ti-chi-bot Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

[LGTM Timeline notifier]

Timeline:

  • 2026-05-22 03:32:38.672959303 +0000 UTC m=+94289.313816116: ☑️ agreed by shhdgit.

@ti-chi-bot

ti-chi-bot Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: shhdgit

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added the approved label May 22, 2026
@ti-chi-bot ti-chi-bot Bot merged commit 5d39d79 into master May 22, 2026
11 checks passed
@ti-chi-bot ti-chi-bot Bot deleted the feat/ru-v2-fields-for-clinic branch May 22, 2026 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants