Skip to content

Commit 355780f

Browse files
committed
[Cleanup] Inverted condition to improve readability
1 parent 4885bb3 commit 355780f

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

logstash-core/src/main/java/org/logstash/execution/QueueReadClientBatchMetrics.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,20 @@ public void updateBatchMetrics(QueueBatch batch) {
4343
return;
4444
}
4545

46-
if (batchMetricMode != QueueFactoryExt.BatchMetricMode.DISABLED) {
47-
boolean updateMetric = true;
48-
if (batchMetricMode == QueueFactoryExt.BatchMetricMode.MINIMAL) {
49-
// 1% chance to update metric
50-
updateMetric = random.nextInt(100) < 2;
51-
}
46+
if (batchMetricMode == QueueFactoryExt.BatchMetricMode.DISABLED) {
47+
return;
48+
}
5249

53-
if (updateMetric) {
54-
pipelineMetricBatchCount.increment();
55-
pipelineMetricBatchTotalEvents.increment(batch.filteredSize());
56-
updateBatchSizeMetric(batch);
57-
}
50+
boolean updateMetric = true;
51+
if (batchMetricMode == QueueFactoryExt.BatchMetricMode.MINIMAL) {
52+
// 1% chance to update metric
53+
updateMetric = random.nextInt(100) < 2;
54+
}
55+
56+
if (updateMetric) {
57+
pipelineMetricBatchCount.increment();
58+
pipelineMetricBatchTotalEvents.increment(batch.filteredSize());
59+
updateBatchSizeMetric(batch);
5860
}
5961
}
6062

0 commit comments

Comments
 (0)