Skip to content

metrics: migrate TiFlash Summary dashboard generation to grafanalib (#11027) - #11033

Merged
ti-chi-bot[bot] merged 2 commits into
pingcap:release-nextgen-202603from
ti-chi-bot:cherry-pick-11027-to-release-nextgen-202603
Aug 11, 2026
Merged

metrics: migrate TiFlash Summary dashboard generation to grafanalib (#11027)#11033
ti-chi-bot[bot] merged 2 commits into
pingcap:release-nextgen-202603from
ti-chi-bot:cherry-pick-11027-to-release-nextgen-202603

Conversation

@ti-chi-bot

Copy link
Copy Markdown
Member

This is an automated cherry-pick of #11027

What problem does this PR solve?

Issue Number: close #11025, close #11028

Problem Summary:

TiFlash Summary Grafana dashboard was maintained as a large hand-edited JSON
blob, which made panel authoring, PromQL consistency, and review hard. This PR
migrates generation to grafanalib (same pattern as TiKV: common.py +
*.dashboard.py), so the dashboard source is Python and tiflash_summary.json
is a generated artifact. We deliberately prefer Python/uv over introducing a
Go/jsonnet toolchain into TiFlash’s developer workflow and CI.

Design: docs/design/2026-08-08-grafanalib-dashboard-generation.md

What is changed and how it works?

metrics: migrate TiFlash Summary dashboard generation to grafanalib

Replace hand-maintained TiFlash Summary JSON with a grafanalib pipeline
(`common.py` + `tiflash_summary.dashboard.py`), shared PromQL/panel helpers,
and `generate_dashboard.sh` to produce `tiflash_summary.json`.
  • Add metrics/grafana/common.py: PromQL builders (expr_*), graph_panel /
    yaxes / Layout, and L3 helpers (ops_panel, duration_panel,
    cpu_with_limit_panel, heatmap / hit-ratio helpers).
  • Add tiflash_summary.dashboard.py as the editable source of truth for
    TiFlash Summary.
  • Regenerate tiflash_summary.json (+ .sha256) via generate_dashboard.sh
    (uv + grafanalib 0.7.1).
  • Document authoring / generation in metrics/grafana/README.md.
  • Add design doc docs/design/2026-08-08-grafanalib-dashboard-generation.md.
  • Notable dashboard behavior alignments during migration:
    • Prefer [$__rate_interval] over fixed ranges like [1m] / [30s].
    • Hide unused right Y-axes; omit redundant right_format on single-axis panels.
    • Enforce IEC byte units in yaxis() (Threads IO: BpsbinBps).
    • Threads CPU: use cpu_with_limit_panel and include $proxy_instance.
    • Split Columnar Meta Cache Gauge into Entries + Weighted Size (3-panel row).

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Manual test:

  1. cd metrics/grafana && ./generate_dashboard.sh
  2. Confirm tiflash_summary.json / .sha256 are updated and review the diff.
  3. Import the generated JSON into a test Grafana and spot-check key rows:
    Server, Threads CPU, Threads, Coprocessor, Columnar Storage, Raft.
  4. During migration review we used scripts/compare_dashboards.py for semantic
    JSON compare against a legacy baseline. After verification that helper was
    removed from tree; it can be restored from git history if needed, e.g.
    git show <commit>:metrics/grafana/scripts/compare_dashboards.py.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Notes: Generated dashboard JSON may differ cosmetically from the previous export
(schema metadata, hidden right-axis defaults, rate interval variable). PromQL /
panel coverage is intended to stay equivalent aside from the intentional
alignments listed above. tiflash_proxy_summary.json /
tiflash_proxy_details.json remain hand-maintained.

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

Summary by CodeRabbit

  • Documentation

    • Updated the DMFile V3 design with file-merging behavior, compatibility requirements, and downgrade guidance.
    • Added a proposal for generating TiFlash Summary Grafana dashboards from Python.
    • Documented dashboard generation, authoring conventions, PromQL guidance, and validation steps.
  • New Features

    • Added tooling to generate and format dashboard definitions consistently.
    • Added reusable dashboard and query-building capabilities for TiFlash metrics.
    • Added checksum validation for generated dashboard artifacts.

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot Bot added the release-note-none Denotes a PR that doesn't merit a release note. label Aug 10, 2026
@ti-chi-bot ti-chi-bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. type/cherry-pick-for-release-nextgen-202603 labels Aug 10, 2026
@ti-chi-bot

Copy link
Copy Markdown
Member Author

@JaySon-Huang This PR has conflicts, I have hold it.
Please resolve them or ask others to resolve them, then comment /unhold to remove the hold label.

@ti-chi-bot

ti-chi-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

@ti-chi-bot: ## If you want to know how to resolve it, please read the guide in TiDB Dev Guide.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (3)
  • release-8.5
  • release-7.5
  • release-8.1

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9e72cb99-8ef8-4b13-908a-670c172a6d64

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread tests/docker/next-gen-columnar-config/tidb.toml Outdated
Comment thread tests/docker/next-gen-columnar-config/tidb.toml Outdated
Comment thread tests/docker/next-gen-config/tidb.toml Outdated
Comment thread tests/docker/next-gen-config/tidb.toml Outdated
Co-authored-by: JaySon <tshent@qq.com>
@ti-chi-bot

Copy link
Copy Markdown
Member Author

Cherry-pick conflicts appear resolved; removing the do-not-merge/hold label.

@ti-chi-bot ti-chi-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 10, 2026
@ti-chi-bot ti-chi-bot Bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Aug 10, 2026
@JaySon-Huang
JaySon-Huang requested a review from yongman August 10, 2026 14:05
@JaySon-Huang

Copy link
Copy Markdown
Contributor

/retest

@ti-chi-bot

ti-chi-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JaySon-Huang, yongman

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:
  • OWNERS [JaySon-Huang,yongman]

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 lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 11, 2026
@ti-chi-bot

ti-chi-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

[LGTM Timeline notifier]

Timeline:

  • 2026-08-10 14:05:35.718135595 +0000 UTC m=+3055321.754230661: ☑️ agreed by JaySon-Huang.
  • 2026-08-11 02:44:42.039151093 +0000 UTC m=+3100868.075246139: ☑️ agreed by yongman.

@ti-chi-bot
ti-chi-bot Bot merged commit cb338f8 into pingcap:release-nextgen-202603 Aug 11, 2026
6 checks passed
@ti-chi-bot
ti-chi-bot Bot deleted the cherry-pick-11027-to-release-nextgen-202603 branch August 11, 2026 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. type/cherry-pick-for-release-nextgen-202603

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants