pingcap / pingcap/tidb

metrics: improve Resource Control RU granularity and instance-level client visibility

Open
#70,972 0 comments 0 reactions 0 assignees View on GitHub
component/metrics type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement

The Resource Control Grafana dashboards use `rate(...[1m])` for RU consumption, which smooths short-lived workload peaks and valleys. Their Client sections also lack an instance-level view of current request RU consumption.

Improve both the standard and KeyspaceName dashboard variants:

- Use `irate(...[30s])` for RU consumption graphs and avoid the default 2x query interval multiplier to expose short-lived changes.
- Add a Client RU panel based on `resource_manager_client_request_ru_total`, aggregated by TiDB instance and honoring the existing cluster, instance, and resource-group selectors.
- Calculate net request RU as consumption minus refunds. The metric stores both directions as positive counters; instances without a refund series must remain visible.
- Preserve existing panel IDs, TP/AP visibility, and per-query average semantics, and regenerate dashboard JSON from Jsonnet sources.

The 30-second lookback requires at least two scrapes within that window. Client request accounting is distinct from the server-reported RU totals and can temporarily be negative when earlier consumption is refunded.

Contributor guide

Open the contributing guide

Research direction

Start with the Jsonnet sources for the standard and KeyspaceName Resource Control Grafana dashboards, then inspect their RU graphs and Client sections. Verify the query interval, instance aggregation, selectors, refund handling, panel IDs, TP/AP visibility, and per-query averages; regenerate the dashboard JSON and confirm both variants retain the requested behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
grafana
Domain
databases, observability-sre
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.