incubator-seata
incubator-seata copied to clipboard
feature(core): enhance heartbeat message to include connection pool info reporting
- [x] I have read the CONTRIBUTING.md guidelines.
- [x] I have registered the PR changes.
Ⅰ. Describe what this PR did
Enhances the heartbeat mechanism to periodically report client-side connection pool information to the Seata server via Seata’s private network protocol (Netty RPC). This allows the TC to monitor HikariCP/Druid pool metrics in real time for observability and diagnostics.
Key changes include:
- Added
sequenceNumberandConnectionPoolInfofields toHeartbeatMessage - Introduced
createHeartbeatMessage()inAbstractNettyRemotingClientfor extensible heartbeat construction - Updated
RmNettyRemotingClientto report connection pool metrics every 30 seconds - Updated
ServerHeartbeatProcessorto receive and cache client pool info - Exposed retrieval APIs for monitoring via
ConnectionPoolInfoCache
Ⅱ. Does this pull request fix one issue?
No specific issue is closed, but this PR contributes to the ongoing connection-pool monitoring feature (GSoC).
Ⅲ. Why don't you add test cases (unit test/integration test)?
The functionality mainly extends the existing heartbeat mechanism and introduces a cache for runtime metrics. Follow-up PRs will include integration tests once frontend visualization and gRPC reporting are completed.
Ⅳ. Describe how to verify it
- Start Seata server and a sample RM application (e.g., Seata-sample).
- Observe heartbeat packets via debug log:
- Client periodically sends
HeartbeatMessagecontainingConnectionPoolInfo. - Server receives and logs updated metrics in
ServerHeartbeatProcessor.
- Client periodically sends
- Use
getAllPoolInfo()API to verify cached client pool information is updated correctly.
Ⅴ. Special notes for reviews
- This PR is part of GSoC 2025 Seata connection-pool monitoring and configuration project.
- Following PR will include the controller in seata-server.