diff --git a/src/main/java/io/strimzi/kafka/metrics/yammer/YammerMetricWrapper.java b/src/main/java/io/strimzi/kafka/metrics/yammer/YammerMetricWrapper.java index 23ccc70..8a65729 100644 --- a/src/main/java/io/strimzi/kafka/metrics/yammer/YammerMetricWrapper.java +++ b/src/main/java/io/strimzi/kafka/metrics/yammer/YammerMetricWrapper.java @@ -41,11 +41,10 @@ public YammerMetricWrapper(String prometheusName, String scope, Metric metric, S */ public static String prometheusName(MetricName metricName) { return PrometheusNaming.prometheusName( - "kafka_server_" + - PrometheusNaming.sanitizeMetricName( - metricName.getGroup() + '_' + - metricName.getType() + '_' + - metricName.getName()).toLowerCase(Locale.ROOT)); + PrometheusNaming.sanitizeMetricName( + metricName.getGroup() + '_' + + metricName.getType() + '_' + + metricName.getName()).toLowerCase(Locale.ROOT)); } static Labels labelsFromScope(String scope, String metricName) { diff --git a/src/test/java/io/strimzi/kafka/metrics/YammerPrometheusMetricsReporterTest.java b/src/test/java/io/strimzi/kafka/metrics/YammerPrometheusMetricsReporterTest.java index e427116..94d762a 100644 --- a/src/test/java/io/strimzi/kafka/metrics/YammerPrometheusMetricsReporterTest.java +++ b/src/test/java/io/strimzi/kafka/metrics/YammerPrometheusMetricsReporterTest.java @@ -42,7 +42,7 @@ public void setup() { @Test public void testLifeCycle() throws Exception { YammerPrometheusMetricsReporter reporter = new YammerPrometheusMetricsReporter(registry, collector); - configs.put(PrometheusMetricsReporterConfig.ALLOWLIST_CONFIG, "kafka_server_group_type.*"); + configs.put(PrometheusMetricsReporterConfig.ALLOWLIST_CONFIG, "group_type.*"); reporter.init(new VerifiableProperties(configs)); HttpServers.ServerCounter httpServer = null; @@ -60,7 +60,7 @@ public void testLifeCycle() throws Exception { newCounter("group", "type", "name"); metrics = getMetrics(port); assertEquals(1, metrics.size()); - assertEquals("kafka_server_group_type_name_total 0.0", metrics.get(0)); + assertEquals("group_type_name_total 0.0", metrics.get(0)); // Removing the metric removeMetric("group", "type", "name"); diff --git a/src/test/java/io/strimzi/kafka/metrics/yammer/YammerMetricWrapperTest.java b/src/test/java/io/strimzi/kafka/metrics/yammer/YammerMetricWrapperTest.java index f9f7e28..edad975 100644 --- a/src/test/java/io/strimzi/kafka/metrics/yammer/YammerMetricWrapperTest.java +++ b/src/test/java/io/strimzi/kafka/metrics/yammer/YammerMetricWrapperTest.java @@ -34,7 +34,7 @@ public void testLabelsFromScope() { @Test public void testYammerMetricName() { String metricName = YammerMetricWrapper.prometheusName(new MetricName("Kafka.Server", "Log", "NumLogSegments")); - assertEquals("kafka_server_kafka_server_log_numlogsegments", metricName); + assertEquals("kafka_server_log_numlogsegments", metricName); } @Test