Oscarcheng0312 opened a new issue, #7575:
URL: https://github.com/apache/incubator-seata/issues/7575

   ### Check Ahead
   
   - [x] I have searched the [issues](https://github.com/seata/seata/issues) of 
this repository and believe that this is not a duplicate.
   
   - [x] I am willing to try to implement this feature myself.
   
   
   ### Why you need it?
   
   Seata currently lacks a REST-based controller and service layer for 
connection-pool monitoring. Without these, the Console UI cannot:
   
   - The Console UI cannot fetch live pool metrics (active, idle, total 
connections).  
   - There is no way to view or update pool configuration (maxPoolSize, 
minIdle, timeouts) at runtime.  
   - Time-series data (e.g. pool size trends, SQL execution histograms) cannot 
be streamed to the Console.  
   
   This makes it impossible to monitor and dynamically tune connection pools 
from the Seata Console, limiting operational visibility and runtime adjustments.
   
   ### How it could be?
   
   1. **ConnectionPoolController** (`/api/v1/connection-pool`)  
      - **GET /health** → `{ status: "UP" | "DOWN", registeredServices: <int>, 
timestamp: <ms> }`  
      - **GET /services** → `{ services: [String], count: <int> }`  
      - **GET /metrics** → `List<ConnectionPoolMetrics>` (all services)  
      - **GET 
/metrics/{serviceName}?includeTransactionChart={bool}&includeSqlChart={bool}** 
→ detailed JSON with common metrics + optional histograms & slow-SQL list  
      - **GET /config** → `List<ConnectionPoolConfig>`  
      - **GET /config/{serviceName}** → single `ConnectionPoolConfig`  
      - **PUT /config/{serviceName}** → accept `ConnectionPoolConfig` JSON to 
update settings  
      - **GET /info/{serviceName}** → combined `{ serviceName, metrics, config, 
timestamp }`
   
   2. **ConnectionPoolService**  
      - `getMetrics(String serviceName): ConnectionPoolMetrics`  
      - `getAllMetrics(): List<ConnectionPoolMetrics>`  
      - `getConfig(String serviceName): ConnectionPoolConfig`  
      - `updateConfig(String serviceName, ConnectionPoolConfig cfg)`  
      - `getAllServiceNames(): List<String>`  
      - `isServiceRegistered(String serviceName): boolean`  
      - `getRegisteredServiceCount(): int`
   
   3. **ConnectionPoolChartService**  
      - `isDruidMetrics(ConnectionPoolMetrics m): boolean`  
      - `generateTransactionHistogram(long[] ranges, long[] values): 
Map<String,Long>`  
      - `generateSqlExecutionHistogram(List<SqlExecutionEntry> records): 
Map<String,Integer>`
   
   These endpoints and services will allow the Console to poll metrics, render 
dynamic charts, and push configuration updates back to the connected 
microservices.
   
   ### Other related information
   
   - Builds on the common-module and rm-datasource models from [PR #7556 ]:  
     - `ConnectionPoolConfig`, `ConnectionPoolMetrics`, `PoolManager` 
interfaces  
     - `SqlExecutionEntry`, `SqlMonitor` for SQL event collection 
     - Use reflection to implement the connection-pool


-- 
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: notifications-unsubscr...@seata.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org
For additional commands, e-mail: notifications-h...@seata.apache.org

Reply via email to