coderbruis opened a new pull request, #11655:
URL: https://github.com/apache/rocketmq/pull/11655

   ### Which Issue(s) This PR Fixes
   
   - Fixes #11654
   
   ### 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.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

  • [PR] [ISSUE #11654] fix(broker)... coderbruis (via GitHub) via commits

Reply via email to