diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/BrokerOperabilityMetrics.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/BrokerOperabilityMetrics.java index 09b313aa749a7..32192f01b6a55 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/BrokerOperabilityMetrics.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/BrokerOperabilityMetrics.java @@ -33,7 +33,6 @@ public class BrokerOperabilityMetrics { private static final Counter TOPIC_LOAD_FAILED = Counter.build("topic_load_failed", "-").register(); private final List metricsList; private final String localCluster; - private final DimensionStats oldTopicLoadStats; private final DimensionStats topicLoadStats; private final String brokerName; private final LongAdder connectionTotalCreatedCount; @@ -45,7 +44,6 @@ public class BrokerOperabilityMetrics { public BrokerOperabilityMetrics(String localCluster, String brokerName) { this.metricsList = new ArrayList<>(); this.localCluster = localCluster; - this.oldTopicLoadStats = new DimensionStats("topic_load_times", 60); this.topicLoadStats = new DimensionStats("pulsar_topic_load_times", 60); this.brokerName = brokerName; this.connectionTotalCreatedCount = new LongAdder(); @@ -61,7 +59,6 @@ public List getMetrics() { } private void generate() { - metricsList.add(getOldTopicLoadMetrics()); metricsList.add(getTopicLoadMetrics()); metricsList.add(getConnectionMetrics()); } @@ -88,11 +85,6 @@ Map getDimensionMap(String metricsName) { return dimensionMap; } - Metrics getOldTopicLoadMetrics() { - Metrics metrics = getDimensionMetrics("topic_load_times", "topic_load", oldTopicLoadStats); - return metrics; - } - Metrics getTopicLoadMetrics() { Metrics metrics = getDimensionMetrics("pulsar_topic_load_times", "topic_load", topicLoadStats); metrics.put("brk_topic_load_failed_count", TOPIC_LOAD_FAILED.get()); @@ -117,12 +109,10 @@ Metrics getDimensionMetrics(String metricsName, String dimensionName, DimensionS public void reset() { metricsList.clear(); - oldTopicLoadStats.reset(); topicLoadStats.reset(); } public void recordTopicLoadTimeValue(long topicLoadLatencyMs) { - oldTopicLoadStats.recordDimensionTimeValue(topicLoadLatencyMs, TimeUnit.MILLISECONDS); topicLoadStats.recordDimensionTimeValue(topicLoadLatencyMs, TimeUnit.MILLISECONDS); } diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/stats/PrometheusMetricsTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/stats/PrometheusMetricsTest.java index 31d468394ff17..c4aa08f4f6f3b 100644 --- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/stats/PrometheusMetricsTest.java +++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/stats/PrometheusMetricsTest.java @@ -247,10 +247,6 @@ public void testMetricsTopicCount() throws Exception { assertEquals(item.value, 3.0); } }); - Collection topicLoadTimesMetrics = metrics.get("topic_load_times"); - Collection topicLoadTimesCountMetrics = metrics.get("topic_load_times_count"); - assertEquals(topicLoadTimesMetrics.size(), 6); - assertEquals(topicLoadTimesCountMetrics.size(), 1); Collection pulsarTopicLoadTimesMetrics = metrics.get("pulsar_topic_load_times"); Collection pulsarTopicLoadTimesCountMetrics = metrics.get("pulsar_topic_load_times_count"); assertEquals(pulsarTopicLoadTimesMetrics.size(), 6); @@ -338,7 +334,7 @@ public void testPerTopicStats() throws Exception { assertEquals(cm.get(1).tags.get("topic"), "persistent://my-property/use/my-ns/my-topic1"); assertEquals(cm.get(1).tags.get("namespace"), "my-property/use/my-ns"); - cm = (List) metrics.get("topic_load_times_count"); + cm = (List) metrics.get("pulsar_topic_load_times_count"); assertEquals(cm.size(), 1); assertEquals(cm.get(0).tags.get("cluster"), "test");