Skip to content

[ISSUE #11654] fix(broker): label DLQ metric with consumer group and origin topic in handleRetryAndDLQ - #11655

Open
coderbruis wants to merge 1 commit into
apache:developfrom
coderbruis:fix/dlq-metric-consumer-group-label
Open

coderbruis wants to merge 1 commit into
apache:developfrom
coderbruis:fix/dlq-metric-consumer-group-label

Conversation

@coderbruis

Copy link
Copy Markdown
Contributor

Which Issue(s) This PR Fixes

Brief Description

In SendMessageProcessor#handleRetryAndDLQ, the rocketmq_send_to_dlq_messages_total metric was labeled with requestHeader.getProducerGroup() and requestHeader.getTopic(). On this path they are CLIENT_INNER_PRODUCER and %RETRY%{group}.

This PR labels it the same way as AbstractSendMessageProcessor (the CONSUMER_SEND_MSG_BACK path):

  • consumer_group: the consumer group parsed from the retry topic (groupName, already used by the rest of this method).
  • topic: the original topic from PROPERTY_RETRY_TOPIC, falling back to the retry topic if the property is absent.
  • is_system: computed from the two values above.

Only the metric labels change. DLQ delivery logic is untouched.

Note: after this change, DLQ counts previously aggregated under consumer_group="CLIENT_INNER_PRODUCER" will appear under the real consumer groups.

How Did You Test This Change?

Added two cases to SendMessageProcessorTest, driven through processRequest with a retry message that exceeds maxReconsumeTimes:

  • testSendRetryMessageToDLQ_metricLabeledWithConsumerGroupAndOriginTopic: with PROPERTY_RETRY_TOPIC, the labels are the consumer group and the original topic.
  • testSendRetryMessageToDLQ_metricFallsBackToRetryTopicWithoutOriginTopic: without it, the topic label falls back to the retry topic.

Results:

  • Both fail without the fix (expected "FooBarGroup" but was "CLIENT_INNER_PRODUCER").
  • With the fix, all 22 tests in SendMessageProcessorTest pass.
  • mvn -pl broker -am checkstyle passes.

I also verified end to end with an embedded namesrv and broker. An orderly consumer with maxReconsumeTimes=1 produced consumer_group="CLIENT_INNER_PRODUCER" before the fix and consumer_group=<real group> after.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.33%. Comparing base (19352a2) to head (73a9de2).

Additional details and impacted files
@@            Coverage Diff             @@
##             develop   #11655   +/-   ##
==========================================
  Coverage      51.33%   51.33%           
- Complexity     15036    15038    +2     
==========================================
  Files           1391     1391           
  Lines         103942   103944    +2     
  Branches       13643    13644    +1     
==========================================
+ Hits           53354    53363    +9     
+ Misses         44329    44318   -11     
- Partials        6259     6263    +4     

☔ 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.

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] Label DLQ metric with consumer group and origin topic in handleRetryAndDLQ

2 participants