fix: summarize heartbeat and system-message 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.62% 48.52% -0.11%
+ Complexity 13692 13663 -29
=============================================
Files 1381 1381
Lines 101464 101531 +67
Branches 13187 13196 +9
=============================================
- Hits 49337 49268 -69
- Misses 46142 46245 +103
- Partials 5985 6018 +33 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Reduces heartbeat sync log verbosity by introducing summary methods that aggregate per-group results into a single log line instead of logging each group individually. Good improvement for production environments with many consumer groups. Clean implementation with proper null/empty handling.
LGTM.
Automated review by github-manager-bot
🤖 Automated Review by RockteMQ-AIReview SummaryThe change correctly reduces log volume by replacing raw object/string logging with compact summaries while preserving diagnostic fields. It is backward compatible behaviorally; only log output changes. The new regression test verifies the main privacy goal. Findings🟡 Warning
🟢 Suggestion
VerdictNo critical issues. The PR is safe to merge after considering the log-format compatibility impact and optionally hardening null handling. Automated review. Please verify findings before acting on them. |
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Defensive fix with proper validation and test coverage. LGTM.
Automated review by github-manager-bot
faf8d9b to
5b0181f
Compare
|
Fixed the current compilation failure by removing the invalid |
Summary
Validation
mvn -q -pl proxy -am -Dtest=HeartbeatSyncerTest,AbstractSystemMessageSyncerTest -DfailIfNoTests=false testCloses #10804
Closes #10726
Closes #10760