incubator-seata icon indicating copy to clipboard operation
incubator-seata copied to clipboard

feature(core): add core connection-pool monitoring (implementation, cache)

Open Oscarcheng0312 opened this issue 3 months ago • 0 comments


Ⅰ. Describe what this PR did

Add the core connection-pool monitoring implementation (transport-agnostic) for CPM backend.

Domain / Model

  • ConnectionPoolInfo: runtime snapshot DTO for pool metrics.

Providers

  • DruidConnectionPoolMetrics: collect metrics from Druid.
  • HikariConnectionPoolMetrics: collect metrics from HikariCP.

Collector

  • DataSourceConnectionPoolCollector: aggregate metrics from multiple providers.

Service

  • ConnectionPoolMonitor: periodic collection and read APIs.

Cache

  • ConnectionPoolInfoCache: in-memory storage for fast reads.

Integration Hook

  • DataSourceProxyEnhancer: lifecycle hook for automatic registration/unregistration of monitored DataSources.

This PR does not include any private protocol / networking code (Netty / gRPC).
Transport (Netty / gRPC / REST) will be integrated in a follow-up PR to keep layering clean.


Ⅱ. Does this pull request fix one issue?

No. It introduces the core capability for the connection-pool-monitor backend, independent of transport.


Ⅲ. Why don't you add test cases (unit test/integration test)?

Basic unit tests will be added with the follow-up PR.


Ⅳ. Describe how to verify it

This PR introduces transport-agnostic core logic only. Verification will be provided by follow-up unit tests that cover providers (Druid / Hikari), the collector, the monitor, and the cache.
Those tests will be sufficient to validate the functionality end-to-end without requiring a running console.


Ⅴ. Special notes for reviews

  • All new Java files include ASF headers.
  • No Netty / gRPC classes are included in this PR; those will live in a separate PR.
  • The design keeps providers → collector → monitor → cache → enhancer independent from transport for easy pluggability.
  • Package structure may be further refined after backend transport abstraction (e.g., gRPC integration) is finalized.

Oscarcheng0312 avatar Oct 13 '25 00:10 Oscarcheng0312