-
Notifications
You must be signed in to change notification settings - Fork 8.9k
feature: add SqlMonitor and SlowSqlEntry for SQL execution monitoring #7491
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
base: 2.x
Are you sure you want to change the base?
feature: add SqlMonitor and SlowSqlEntry for SQL execution monitoring #7491
Conversation
Hi @slievrly, this PR adds |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 2.x #7491 +/- ##
============================================
+ Coverage 60.34% 60.40% +0.05%
Complexity 658 658
============================================
Files 1284 1286 +2
Lines 48465 48527 +62
Branches 5694 5702 +8
============================================
+ Hits 29247 29311 +64
+ Misses 16600 16599 -1
+ Partials 2618 2617 -1
🚀 New features to boost your workflow:
|
@slievrly Hi, pls take a look when you are convenient. |
return new LinkedHashMap<>(holdHistogram); | ||
} | ||
|
||
private String chooseTxnBucket(long ms) { |
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 is not a formed partial function, so the significance of the review is not great. You can first merge it into your own repository for development or merge it into the GSoC-conn branch of this repository. The time slice defined here is too rigid. Statistical indicators should be calculated in the console. The client side only needs to report the original values; otherwise, it will lead to distortion of data accuracy.
Ⅰ. Describe what this PR did
This PR introduces a new SQL monitoring utility to the
seata-common
module:SqlMonitor
: a singleton class for collecting SQL execution statistics.maxSlowEntries
setSlowThreshold()
andsetMaxSlowEntries()
for future dynamic configurationSlowSqlEntry
: a simple immutable model class holding slow SQL info (text, exec time, timestamp)Ⅱ. Does this pull request fix one issue?
No. This is a new feature and the first step in the SQL monitoring implementation plan.
Ⅲ. Why don't you add test cases (unit test/integration test)?
Test cases are included:
SqlMonitorTest.java
covers:Ⅳ. Describe how to verify it
SqlMonitorTest
with JUnitⅤ. Special notes for reviews
seata-rm-datasource
(recording) andseata-server
(metrics exposure)application.yml
or dynamic configuration center