Skip to content

[ISSUE #10804] Summarize heartbeat sync logs - #10805

Open
Aias00 wants to merge 3 commits into
apache:developfrom
Aias00:fix/proxy-heartbeat-log-summary-10804
Open

[ISSUE #10804] Summarize heartbeat sync logs#10805
Aias00 wants to merge 3 commits into
apache:developfrom
Aias00:fix/proxy-heartbeat-log-summary-10804

Conversation

@Aias00

@Aias00 Aias00 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace raw HeartbeatSyncerData/subscription/system-message logging with compact summaries
  • keep diagnostic fields such as heartbeat type, group, client metadata, subscription count, topic names, and channel-data presence
  • add regression coverage that ensures subscription expressions and raw channel data are not included in heartbeat log summaries

Tests

  • mvn -pl proxy -DskipITs -DskipCheckStyle -Dtest=HeartbeatSyncerTest test
    • Result: BUILD SUCCESS; 5 HeartbeatSyncerTest tests passed
    • Note: the local Java runtime emits existing Jacoco instrumentation warnings for Java 17 classes, but the Maven run completes successfully
  • git diff --check

Closes #10804

Copilot AI review requested due to automatic review settings August 3, 2026 23:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and summarizeSystemMessage helpers 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 with log.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 with log.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.

Comment on lines 136 to 138
log.debug("sync register heart beat. topic:{}, dataSummary:{}",
this.getBroadcastTopicName(), summarizeHeartbeatData(data));
this.sendSystemMessage(data);
@codecov-commenter

codecov-commenter commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 36.66667% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.23%. Comparing base (eddb235) to head (faf8d9b).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
...etmq/proxy/service/sysmessage/HeartbeatSyncer.java 41.50% 25 Missing and 6 partials ⚠️
...ervice/sysmessage/AbstractSystemMessageSyncer.java 0.00% 7 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: liuhy <liuhongyu@apache.org>
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.

[Bug] Proxy heartbeat sync logs full subscription data

3 participants