-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
topsql: refactor reporter and add reporting part of stmtstats #30954
Conversation
Signed-off-by: mornyx <mornyx.z@gmail.com>
Signed-off-by: mornyx <mornyx.z@gmail.com>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Signed-off-by: mornyx <mornyx.z@gmail.com>
/run-all-tests |
PTAL, Thanks~ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current design is mixing the architecture and the business metrics. Could you make them isolated? A good design should be some architecture that, when we want to add a new metrics, reporter/* does not need any changes. Could you design for this direction?
Signed-off-by: mornyx <mornyx.z@gmail.com>
I have refactored the entire |
Signed-off-by: mornyx <mornyx.z@gmail.com>
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/114e53be775bc0e739cfc12e90891beab61cbb83 |
Signed-off-by: mornyx <mornyx.z@gmail.com>
/run-check_dev_2 |
Signed-off-by: mornyx <mornyx.z@gmail.com>
Signed-off-by: mornyx <mornyx.z@gmail.com>
rest LGTM |
Signed-off-by: mornyx <mornyx.z@gmail.com>
Signed-off-by: mornyx <mornyx.z@gmail.com>
@zhongzc: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments. In response to this: 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. |
r.tsIndex[timestamp] = len(r.tsItems) | ||
r.tsItems = append(r.tsItems, newItem) | ||
} | ||
r.totalCPUTimeMs += uint64(cpuTimeMs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This calculation may be incorrect when duplicated ts is met, as you will replace the value instead of add the value in branch L183.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replacement occurs only when the original value is zero
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still prefer to do a correct calculation here, since this function is indeed calculated incorrectly, it's just the caller has not entered this path yet. The overall result is fine only because the bug is not triggered, but the bug exists.
You have two ways to make this function correct:
- It only accepts the call and update the total when current value=0. For other cases, the array is not overwritten, and total is not updated.
- It accepts all calls and always update the total according to a delta of the current value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your opinion is reasonable, I changed the "replace" behavior to "add/merge" behavior, so method names are changed back to appendXxx
.
Signed-off-by: mornyx <mornyx.z@gmail.com>
Signed-off-by: mornyx <mornyx.z@gmail.com>
Signed-off-by: mornyx <mornyx.z@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the rest LGTM
Signed-off-by: mornyx <mornyx.z@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/merge |
This pull request has been accepted and is ready to merge. Commit hash: c0524ef
|
/run-check_dev_2 |
1 similar comment
/run-check_dev_2 |
/run-mysql-test |
What is changed and how it works?
In this PR (#30277), we introduced the stmtstats framework, but the reporting part is missing. This PR completes this part by:
topsql/reporter
for flexibility.stmtstats.Collector
forreporter.RemoteTopSQLReporter
.reporter.RemoteTopSQLReporter
asstmtstats.Collector
.stmtstats
.Related PR
Check List
Tests
Release note