docs: add a guide for configuring slow query trigger rules (#23767) - #23873
ti-chi-bot wants to merge 1 commit into
Conversation
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
|
@qiancai This PR has conflicts, I have hold it. |
|
@ti-chi-bot: ## If you want to know how to resolve it, please read the guide in TiDB Dev Guide. DetailsInstructions 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@ti-chi-bot: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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 kubernetes-sigs/prow repository. I understand the commands that are listed here. |
📝 WalkthroughWalkthroughThe pull request adds a slow query trigger rule guide, updates related system-variable and Cloud documentation, adds TOC links, and introduces unresolved merge-conflict markers in several documentation files. ChangesSlow query trigger rules
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Other Suggested reviewers: Merge Risk: 🟡 Moderate · up to The documentation can publish conflict text, contradictory version details, and unsupported Starter instructions, so it should be corrected before merge. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Advanced
Run ID: 6d79697f-555d-46f9-9fcb-97708ef8c88b
📒 Files selected for processing (8)
TOC-tidb-cloud-essential.mdTOC-tidb-cloud-premium.mdTOC.mdconfig-slow-query-trigger-rules.mdidentify-slow-queries.mdreleases/release-8.5.6.mdsystem-variables.mdtidb-cloud/tune-performance.md
Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.
| - If the current session has any applicable `tidb_slow_log_rules` rules, slow query logging is determined by the rule matching results, and [`tidb_slow_log_threshold`](/system-variables.md#tidb_slow_log_threshold) is ignored. | ||
|
|
||
| </CustomContent> | ||
| <CustomContent platform="tidb-cloud"> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Call out the Starter limitation in the TiDB Cloud introduction.
The TiDB Cloud block is shown on the TiDB Cloud documentation site, and tidb_slow_log_rules is not supported on TiDB Cloud Starter. Its current text tells all Cloud users to modify the variable. Add the limitation before that instruction:
| <CustomContent platform="tidb-cloud"> | |
| <CustomContent platform="tidb-cloud"> | |
| TiDB Cloud Starter does not support [`tidb_slow_log_rules`](/system-variables.md#tidb_slow_log_rules). For TiDB Cloud Essential, Premium, and Dedicated, you can modify this system variable in the [TiDB Cloud console](https://tidbcloud.com/). | |
| In the [TiDB Cloud console](https://tidbcloud.com/), you can view slow queries on the [**Slow Query**](/tidb-cloud/tune-performance.md#slow-query) tab of the [**Diagnosis**](/tidb-cloud/tune-performance.md#view-the-diagnosis-page) page. | |
| By default, SQL queries that take more than 300 milliseconds are considered as slow queries. To configure the trigger rules for slow queries, you can modify the [`tidb_slow_log_rules`](/system-variables.md#tidb_slow_log_rules) system variable. | |
| [`tidb_slow_log_rules`](/system-variables.md#tidb_slow_log_rules) supports multi-dimensional metric combinations. It is suitable for "targeted sampling" and "problem reproduction" of slow queries, enabling you to filter target statements based on specific metric combinations. | |
| </CustomContent> |
Do not add a plan attribute to the system-variables.md block. It already states that the variable is unsupported on Starter, matching the repository pattern for other variables with plan limitations. The guide's shared syntax and examples are also intentionally reused across supported platforms, while the later plan-specific blocks distinguish the available scopes.
| SELECT /*+ WRITE_SLOW_LOG */ count(*) FROM t t1, t t2 WHERE t1.a = t2.b; | ||
| ``` | ||
|
|
||
| <<<<<<< HEAD |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- identify-slow-queries.md affected ranges ---'
sed -n '175,205p;305,345p' identify-slow-queries.md
printf '%s\n' '--- TOC-tidb-cloud-premium.md affected range ---'
sed -n '550,575p' TOC-tidb-cloud-premium.md
printf '%s\n' '--- canonical variable references ---'
rg -n -C 3 'tidb_slow_log_max_per_sec|tidb_slow_log_rules' system-variables.md identify-slow-queries.md config-slow-query-trigger-rules.md 2>/dev/null || true
printf '%s\n' '--- conflict markers in the two files ---'
rg -n '^(<<<<<<<|=======|>>>>>>>)' identify-slow-queries.md TOC-tidb-cloud-premium.md || trueRepository: pingcap/docs
Length of output: 34484
🤖 get_repo_knowledge executed:
get_repo_knowledge pingcap/docs /tmp/coderabbit-repo-knowledge/pingcap-docs-9c73f70c/learnings /tmp/coderabbit-repo-knowledge/pingcap-docs-9c73f70c/conventions
Length of output: 4069
Resolve all Git merge conflicts before publishing the documentation.
Both files contain unresolved conflict markers. These markers can publish as literal text and leave duplicate sections, inconsistent links, and conflicting version claims.
- In
identify-slow-queries.md, resolve both conflict blocks. Keep oneRelated system variablessection and onetidb_slow_log_max_per_secentry. Match the anchor and version label to the resolved definition insystem-variables.md. - In
TOC-tidb-cloud-premium.md, keep the intended entries and remove all conflict markers.
Committable replacement for the Premium TOC
-<<<<<<< HEAD
-=======
- [`ANALYZE` Embedded in DDL Statements](/ddl_embedded_analyze.md)
- [Configure Trigger Rules for Slow Queries](/config-slow-query-trigger-rules.md)
->>>>>>> 8876be1aaa (docs: add a guide for configuring slow query trigger rules (`#23767`))📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <<<<<<< HEAD | |
| - [`ANALYZE` Embedded in DDL Statements](/ddl_embedded_analyze.md) | |
| - [Configure Trigger Rules for Slow Queries](/config-slow-query-trigger-rules.md) |
📍 Affects 2 files
identify-slow-queries.md#L191-L191(this comment)identify-slow-queries.md#L318-L334TOC-tidb-cloud-premium.md#L564-L568
Sources: Path instructions, Linters/SAST tools
| > | ||
| > If the character check is skipped, TiDB might fail to detect invalid UTF-8 characters written by the application, cause decoding errors when `ANALYZE` is executed, and introduce other unknown encoding issues. If your application cannot guarantee the validity of the written string, it is not recommended to skip the character check. | ||
|
|
||
| <<<<<<< HEAD |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Resolve the merge-conflict markers before merging.
The file still contains conflict markers at lines 6109-6117, 6128-6136, and 6156-6170. The rendered documentation will contain unresolved text and competing headings, anchors, and platform descriptions. Merge the two versions and remove every marker.
This is an automated cherry-pick of #23767
What is changed, added or deleted? (Required)
Add a standalone guide for configuring slow query trigger rules so that users can find the supported fields, syntax constraints, matching behavior, and examples in one place.
The guide distinguishes the supported rule scopes and behavior for TiDB Self-Managed, TiDB Cloud Dedicated, and TiDB Cloud Essential/Premium. It also updates the related system variable documentation, TiDB Cloud performance guide, navigation entries, and cross-references.
Which TiDB version(s) do your changes apply to? (Required)
Tips for choosing the affected version(s):
By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.
For details, see tips for choosing the affected versions.
What is the related PR or file link(s)?
AI agent involvement
Do your changes match any of the following descriptions?
Summary by CodeRabbit
New Features
tidb_slow_log_rules.Documentation