Skip to content

fix: summarize heartbeat and system-message sync logs - #10805

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

fix: summarize heartbeat and system-message sync logs#10805
Aias00 wants to merge 7 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 Heartbeat and system-message failure logs with bounded summaries.
  • Keep diagnostic fields such as topic, message ID, heartbeat type, group and subscription count without serializing bodies, subscription expressions or channel data.
  • Preserve summary coverage for both heartbeat consumption and outbound system-message failures.

Validation

mvn -q -pl proxy -am -Dtest=HeartbeatSyncerTest,AbstractSystemMessageSyncerTest -DfailIfNoTests=false test

Closes #10804
Closes #10726
Closes #10760

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 65.82278% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.52%. Comparing base (293f588) to head (a47740e).

Files with missing lines Patch % Lines
...etmq/proxy/service/sysmessage/HeartbeatSyncer.java 66.10% 15 Missing and 5 partials ⚠️
...ervice/sysmessage/AbstractSystemMessageSyncer.java 65.00% 4 Missing and 3 partials ⚠️
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.
📢 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.

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@RockteMQ-AI

Copy link
Copy Markdown
Contributor

🤖 Automated Review by RockteMQ-AI

Review Summary

The 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

  • proxy/.../AbstractSystemMessageSyncer.java:127 — Default summarizeSystemMessageData(Object) returns the raw object unchanged. Other AbstractSystemMessageSyncer subclasses will continue logging full payloads until they override the method.
  • proxy/.../HeartbeatSyncer.java:222 — Log field names changed (data:dataSummary:, subList:subscriptionSummary:) and raw subscription expressions / channel data are no longer emitted. This may break existing log parsers or alerts.
  • proxy/.../HeartbeatSyncer.java:154summarizeSubscriptionDataSet streams SubscriptionData::getTopic without null safety. A null topic or null element in the set will throw NPE. Consider hardening with filter(Objects::nonNull) or nullsFirst.

🟢 Suggestion

  • proxy/.../HeartbeatSyncer.java:164summarizeSystemMessage(MessageExt msg) is slightly misnamed; summarizeMessageExt would be clearer.
  • proxy/.../HeartbeatSyncerTest.java:218 — Add null-input tests for summarizeHeartbeatData(null), summarizeSubscriptionDataSet(null), and the non-HeartbeatSyncerData dispatch path in summarizeSystemMessageData.
  • proxy/.../HeartbeatSyncer.java:154 — Sorting topics adds O(n log n) overhead; if subscription sets can be large, consider skipping the sort.

Verdict

No 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 RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Summary

Defensive fix with proper validation and test coverage. LGTM.


Automated review by github-manager-bot

@Aias00 Aias00 changed the title [ISSUE #10804] Summarize heartbeat sync logs fix: summarize heartbeat and system-message sync logs Aug 15, 2026
@Aias00
Aias00 force-pushed the fix/proxy-heartbeat-log-summary-10804 branch from faf8d9b to 5b0181f Compare August 15, 2026 07:21
@Aias00

Aias00 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the current compilation failure by removing the invalid HeartbeatSyncer instance override of the static base summary method. The safe base-class summary remains the send-path behavior. Validated with mvn -pl proxy -Dtest=HeartbeatSyncerTest test.\n\nCommit: a47740e.

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

Labels

None yet

Projects

None yet

4 participants