You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/06/27 02:24:25 UTC
[GitHub] [inlong] vernedeng commented on a diff in pull request #4778: [INLONG-4777][SortStandalone] Change ack policy from checking message count to checking every message
vernedeng commented on code in PR #4778:
URL: https://github.com/apache/inlong/pull/4778#discussion_r906922828
##########
inlong-sort-standalone/sort-standalone-source/src/main/java/org/apache/inlong/sort/standalone/sink/elasticsearch/EsSinkContext.java:
##########
@@ -228,28 +228,26 @@ public void addSendResultMetric(ProfileEvent currentRecord, String bid, boolean
fillInlongId(currentRecord, dimensions);
dimensions.put(SortMetricItem.KEY_SINK_ID, this.getSinkName());
dimensions.put(SortMetricItem.KEY_SINK_DATA_ID, bid);
+ final long currentTime = System.currentTimeMillis();
long msgTime = currentRecord.getRawLogTime();
long auditFormatTime = msgTime - msgTime % CommonPropertiesHolder.getAuditFormatInterval();
dimensions.put(SortMetricItem.KEY_MESSAGE_TIME, String.valueOf(auditFormatTime));
SortMetricItem metricItem = this.getMetricItemSet().findMetricItem(dimensions);
- long count = 1;
- long size = currentRecord.getBody().length;
if (result) {
- metricItem.sendSuccessCount.addAndGet(count);
- metricItem.sendSuccessSize.addAndGet(size);
+ metricItem.sendSuccessCount.addAndGet(1);
Review Comment:
It's better to use method _increatmentAndGet_ when add count is 1
--
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@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org