[ISSUE #10804] Summarize heartbeat sync logs - #10805
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates RocketMQ Proxy’s HeartbeatSyncer logging to avoid emitting full heartbeat payloads (including subscription expressions and raw channel/system message data), replacing them with compact summaries, and adds a regression test to ensure sensitive fields are not logged.
Changes:
- Replace several heartbeat-related debug/error logs to output summarized heartbeat/subscription/system-message fields instead of full objects/bodies.
- Add
summarizeHeartbeatData,summarizeSubscriptionDataSet, andsummarizeSystemMessagehelpers to centralize safe log formatting. - Add a unit test asserting subscription expressions and raw channel data are excluded from heartbeat log summaries.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| proxy/src/main/java/org/apache/rocketmq/proxy/service/sysmessage/HeartbeatSyncer.java | Switch heartbeat logs to safe summaries; add summary helper methods for heartbeat data, subscriptions, and system messages. |
| proxy/src/test/java/org/apache/rocketmq/proxy/service/sysmessage/HeartbeatSyncerTest.java | Add regression test ensuring heartbeat summaries don’t include subscription expressions or raw channel data. |
Suppressed comments (2)
proxy/src/main/java/org/apache/rocketmq/proxy/service/sysmessage/HeartbeatSyncer.java:178
summarizeHeartbeatData(data)is evaluated eagerly even when debug logging is disabled, which adds avoidable overhead on the hot path of consumer unregister. Guard this debug log withlog.isDebugEnabled()so the summary is only computed when debug is enabled.
log.debug("sync unregister heart beat. topic:{}, dataSummary:{}",
this.getBroadcastTopicName(), summarizeHeartbeatData(data));
this.sendSystemMessage(data);
proxy/src/main/java/org/apache/rocketmq/proxy/service/sysmessage/HeartbeatSyncer.java:214
summarizeHeartbeatData(data)is evaluated eagerly even when debug logging is disabled, which adds avoidable overhead in the message-consume loop. Guard this debug log withlog.isDebugEnabled()so the summary is only built when debug is enabled.
log.debug("start process remote channel. dataSummary:{}, clientChannelInfo:{}",
summarizeHeartbeatData(data), clientChannelInfo);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| log.debug("sync register heart beat. topic:{}, dataSummary:{}", | ||
| this.getBroadcastTopicName(), summarizeHeartbeatData(data)); | ||
| this.sendSystemMessage(data); |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #10805 +/- ##
=============================================
- Coverage 48.34% 48.23% -0.12%
+ Complexity 13527 13494 -33
=============================================
Files 1380 1380
Lines 101104 101188 +84
Branches 13107 13125 +18
=============================================
- Hits 48882 48808 -74
- Misses 46267 46381 +114
- Partials 5955 5999 +44 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: liuhy <liuhongyu@apache.org>
Summary
Tests
Closes #10804