Skip to content

Conversation

@Oscarcheng0312
Copy link
Contributor

Ⅰ. Describe what this PR did

Implemented private-protocol-based connection pool metrics reporting and server-side REST APIs.

  • Client (RM) side:

    • Enhanced RmNettyRemotingClient to include ConnectionPoolInfo in heartbeat messages (HeartbeatMessage.PING).
    • Reports pool metrics periodically (default: 30s) through a private channel without exposing public HTTP endpoints.
  • Server (TC) side:

    • ServerHeartbeatProcessor parses and caches ConnectionPoolInfo from incoming heartbeat messages.
    • Added access methods in NettyRemotingServer to fetch all or per-client pool info.
  • REST endpoints:

    • Added ConnectionPoolController under /api/v1/connection-pool:
      • GET /info — Retrieve connection pool info of all clients.
      • GET /info/{clientAddress} — Retrieve connection pool info of a specific client.
      • GET /all — Retrieve locally collected data source pool metrics via DataSourceConnectionPoolCollector.
  • Server integration:

    • Registered NettyRemotingServer in Spring context and injected it into ConnectionPoolController for REST access.

Backward-compatible: older clients still send standard heartbeat messages, and the server responds normally.

Ⅱ. Does this pull request fix one issue?

Yes, it fixs #7575 .

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

  • The changes involve both network-level heartbeat communication and in-memory caching logic, which are more suitable for integration testing.
  • Test cases will be added.

Ⅳ. Describe how to verify it

  1. Start the Seata server.
  2. Run an RM client using this version of RmNettyRemotingClient.
  3. After ~30 seconds:
    • Access GET /api/v1/connection-pool/info to view all active client pool info.
    • Access GET /api/v1/connection-pool/info/{clientAddress} to query a specific client (use _ instead of : in path).
    • Access GET /api/v1/connection-pool/all to verify locally collected pool metrics.
  4. Verify that:
    • New clients report valid metrics.
    • Old clients work as before (no metrics available but heartbeat succeeds).

Ⅴ. Special notes for reviews

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant