Oscarcheng0312 opened a new pull request, #7491:
URL: https://github.com/apache/incubator-seata/pull/7491

   <!--
       Licensed to the Apache Software Foundation (ASF) under one or more
       contributor license agreements.  See the NOTICE file distributed with
       this work for additional information regarding copyright ownership.
       The ASF licenses this file to You under the Apache License, Version 2.0
       (the "License"); you may not use this file except in compliance with
       the License.  You may obtain a copy of the License at
   
       http://www.apache.org/licenses/LICENSE-2.0
       
       Unless required by applicable law or agreed to in writing, software
       distributed under the License is distributed on an "AS IS" BASIS,
       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       See the License for the specific language governing permissions and
       limitations under the License.
   -->
   <!-- Please make sure you have read and understood the contributing 
guidelines -->
   
   - [ ] I have registered the PR [changes](../changes).
   
   ### Ⅰ. 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.
     - Tracks slow SQL (execution time > threshold), up to `maxSlowEntries`
     - Maintains histogram of transaction execution time
     - Maintains histogram of connection hold time
     - Thread-safe using concurrent data structures and explicit locking
     - Includes setters `setSlowThreshold()` and `setMaxSlowEntries()` for 
future dynamic configuration
   - `SlowSqlEntry`: a simple immutable model class holding slow SQL info 
(text, exec time, timestamp)
   
   ### Ⅱ. Does this pull request fix one issue?
   <!-- If that, add "fixes #xxx" below in the next line, for example, fixes 
#97. -->
   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:
     - Slow SQL recording and eviction behavior
     - Histogram bucket logic for transaction/hold times
     - Fast SQL skip logic
     - Queue size trimming
   
   ### Ⅳ. Describe how to verify it
   - Run `SqlMonitorTest` with JUnit 
   - Verify correctness of slow SQL detection, histogram aggregation, and 
bounded queue behavior
   
   ### Ⅴ. Special notes for reviews
   - This is **PR 1/3** in the SQL monitoring feature set
   - Follow-up PRs will integrate this utility with `seata-rm-datasource` 
(recording) and `seata-server` (metrics exposure)
   - Configuration injection will be addressed later via `application.yml` or 
dynamic configuration center
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to