From d6c12d165abcbd8d371c04c1462be87c7f53c20e Mon Sep 17 00:00:00 2001 From: coderzc Date: Wed, 22 Mar 2023 20:25:44 +0800 Subject: [PATCH] use refresh instead of collect --- .../bookkeeper/mledger/util/StatsBuckets.java | 13 ------------- .../bucket/BucketDelayedMessageIndexStats.java | 2 +- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/util/StatsBuckets.java b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/util/StatsBuckets.java index 652ab159199fd8..60c0a7f6c9d225 100644 --- a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/util/StatsBuckets.java +++ b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/util/StatsBuckets.java @@ -73,19 +73,6 @@ public void refresh() { this.count = count; } - public void collect() { - long count = 0; - sum = sumCounter.sum(); - - for (int i = 0; i < buckets.length; i++) { - long value = buckets[i].sum(); - count += value; - values[i] = value; - } - - this.count = count; - } - public void reset() { sum = 0; sumCounter.reset(); diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedMessageIndexStats.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedMessageIndexStats.java index a2dab878565c59..f479a03092eaf2 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedMessageIndexStats.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedMessageIndexStats.java @@ -79,7 +79,7 @@ public Map genTopicMetricMap() { }); delayedMessageIndexBucketOpLatencyMs.forEach((typeName, statsBuckets) -> { - statsBuckets.collect(); + statsBuckets.refresh(); long[] buckets = statsBuckets.getBuckets(); for (int i = 0; i < buckets.length; i++) { long count = buckets[i];