You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "joeCarf (via GitHub)" <gi...@apache.org> on 2023/09/22 03:20:08 UTC
[GitHub] [rocketmq] joeCarf commented on a diff in pull request #7382: [ISSUE #7381] Fix the problem of inaccurate timer message metric
joeCarf commented on code in PR #7382:
URL: https://github.com/apache/rocketmq/pull/7382#discussion_r1333833169
##########
store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:
##########
@@ -599,7 +599,12 @@ public void addMetric(MessageExt msg, int value) {
if (null == msg || null == msg.getProperty(MessageConst.PROPERTY_REAL_TOPIC)) {
return;
}
- timerMetrics.addAndGet(msg.getProperty(MessageConst.PROPERTY_REAL_TOPIC), value);
+ if (msg.getProperty(TIMER_ENQUEUE_MS) != null
Review Comment:
NumberUtils.toLong() might be more clear
##########
store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:
##########
@@ -1452,9 +1458,14 @@ public void run() {
}
try {
perfCounterTicks.startTick(DEQUEUE_PUT);
- DefaultStoreMetricsManager.incTimerDequeueCount(getRealTopic(tr.getMsg()));
- addMetric(tr.getMsg(), -1);
- MessageExtBrokerInner msg = convert(tr.getMsg(), tr.getEnqueueTime(), needRoll(tr.getMagic()));
+ MessageExt msgExt = tr.getMsg();
+ DefaultStoreMetricsManager.incTimerDequeueCount(getRealTopic(msgExt));
+ if (tr.getEnqueueTime() == Long.MAX_VALUE) {
+ // never enqueue, mark it.
+ MessageAccessor.putProperty(msgExt, TIMER_ENQUEUE_MS, Long.MAX_VALUE+"");
Review Comment:
will `String.valueOF(Long.MAX_VALUE)` be more clear?
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org