woofyzhao commented on code in PR #7195:
URL: https://github.com/apache/inlong/pull/7195#discussion_r1065439273


##########
inlong-dataproxy/dataproxy-source/src/main/java/org/apache/inlong/dataproxy/sink/mq/MessageQueueZoneSinkContext.java:
##########
@@ -268,4 +308,40 @@ public void processSendFail(BatchPackProfile 
currentRecord, String topic, long s
             currentRecord.fail();
         }
     }
+
+    private void appendIndex(Event event, boolean isSuccess) {
+        if (event == null) {
+            return;
+        }
+        if (mqConfig.getStatIntervalSec() <= 0) {
+            return;
+        }
+        // add monitor items base file storage
+        String topic = event.getHeaders().get(ConfigConstants.TOPIC_KEY);
+        String streamId = event.getHeaders().get(AttributeConstants.STREAM_ID);
+        String nodeIp = event.getHeaders().get(ConfigConstants.REMOTE_IP_KEY);
+        int intMsgCnt = Integer.parseInt(
+                event.getHeaders().get(ConfigConstants.MSG_COUNTER_KEY));
+        long dataTimeL = Long.parseLong(
+                event.getHeaders().get(AttributeConstants.DATA_TIME));
+        Pair<Boolean, String> evenProcType =
+                MessageUtils.getEventProcType(event);
+        // build statistic key
+        StringBuilder newBase = new StringBuilder(512)
+                .append(getSinkName()).append(SEP_HASHTAG).append(topic)
+                .append(SEP_HASHTAG).append(streamId).append(SEP_HASHTAG)
+                
.append(nodeIp).append(SEP_HASHTAG).append(NetworkUtils.getLocalIp())
+                
.append(SEP_HASHTAG).append(evenProcType.getRight()).append(SEP_HASHTAG)
+                .append(DateTimeUtils.ms2yyyyMMddHHmm(dataTimeL));
+        // count data
+        if (isSuccess) {
+            monitorIndex.addAndGet(newBase.toString(),
+                    intMsgCnt, 1, event.getBody().length, 0);
+            monitorIndexExt.incrementAndGet("PULSAR_SINK_SUCCESS");

Review Comment:
   Fixed



-- 
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-unsubscr...@inlong.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to