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

feature(core): enhance heartbeat message to include connection pool info reporting

Open Oscarcheng0312 opened this issue 3 months ago • 0 comments

Ⅰ. 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 sequenceNumber and ConnectionPoolInfo fields to HeartbeatMessage
  • Introduced createHeartbeatMessage() in AbstractNettyRemotingClient for extensible heartbeat construction
  • Updated RmNettyRemotingClient to report connection pool metrics every 30 seconds
  • Updated ServerHeartbeatProcessor to 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

  1. Start Seata server and a sample RM application (e.g., Seata-sample).
  2. Observe heartbeat packets via debug log:
    • Client periodically sends HeartbeatMessage containing ConnectionPoolInfo.
    • Server receives and logs updated metrics in ServerHeartbeatProcessor.
  3. 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.

Oscarcheng0312 avatar Oct 13 '25 02:10 Oscarcheng0312