From 941453b0d8be5dc22b64c06c02099ad5b292cb05 Mon Sep 17 00:00:00 2001 From: Channyboy Date: Thu, 7 Sep 2023 19:57:25 -0400 Subject: [PATCH 1/3] Add buckets to names that are generated --- .../io/smallrye/metrics/exporters/PrometheusMetricsExporter.java | 1 + 1 file changed, 1 insertion(+) diff --git a/implementation/src/main/java/io/smallrye/metrics/exporters/PrometheusMetricsExporter.java b/implementation/src/main/java/io/smallrye/metrics/exporters/PrometheusMetricsExporter.java index 0706b7c5..01a838a4 100644 --- a/implementation/src/main/java/io/smallrye/metrics/exporters/PrometheusMetricsExporter.java +++ b/implementation/src/main/java/io/smallrye/metrics/exporters/PrometheusMetricsExporter.java @@ -190,6 +190,7 @@ private void resolveMeterSuffixes(Set set, Type inputType) { set.add("_count"); set.add("_sum"); set.add("_max"); + set.add("_bucket"); break; default: if (LOGGER.isLoggable(Level.FINEST)) { From a6140ff8a0fae086f3b58fcb39e2ce99299b9408 Mon Sep 17 00:00:00 2001 From: Channyboy Date: Thu, 7 Sep 2023 19:57:42 -0400 Subject: [PATCH 2/3] Check for null config before adding --- .../setup/config/HistogramBucketMaxConfiguration.java | 5 ++++- .../setup/config/HistogramBucketMinConfiguration.java | 5 ++++- .../setup/config/TimerBucketMaxConfiguration.java | 9 ++++++--- .../setup/config/TimerBucketMinConfiguration.java | 9 ++++++--- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/implementation/src/main/java/io/smallrye/metrics/setup/config/HistogramBucketMaxConfiguration.java b/implementation/src/main/java/io/smallrye/metrics/setup/config/HistogramBucketMaxConfiguration.java index c73f0d5d..d9b7bdca 100644 --- a/implementation/src/main/java/io/smallrye/metrics/setup/config/HistogramBucketMaxConfiguration.java +++ b/implementation/src/main/java/io/smallrye/metrics/setup/config/HistogramBucketMaxConfiguration.java @@ -53,7 +53,10 @@ public static Collection parse(String input) { } // LIFO - right most configuration takes precedence - metricBucketMinMax.addFirst(metricBucketConfiguration); + if (metricBucketConfiguration != null) { + metricBucketMinMax.addFirst(metricBucketConfiguration); + } + } return metricBucketMinMax; diff --git a/implementation/src/main/java/io/smallrye/metrics/setup/config/HistogramBucketMinConfiguration.java b/implementation/src/main/java/io/smallrye/metrics/setup/config/HistogramBucketMinConfiguration.java index 5e93d7d0..1a142f71 100644 --- a/implementation/src/main/java/io/smallrye/metrics/setup/config/HistogramBucketMinConfiguration.java +++ b/implementation/src/main/java/io/smallrye/metrics/setup/config/HistogramBucketMinConfiguration.java @@ -53,7 +53,10 @@ public static Collection parse(String input) { } // LIFO - right most configuration takes precedence - metricBucketMinMax.addFirst(metricBucketConfiguration); + if (metricBucketConfiguration != null) { + metricBucketMinMax.addFirst(metricBucketConfiguration); + } + } return metricBucketMinMax; diff --git a/implementation/src/main/java/io/smallrye/metrics/setup/config/TimerBucketMaxConfiguration.java b/implementation/src/main/java/io/smallrye/metrics/setup/config/TimerBucketMaxConfiguration.java index 0b0d8922..03b28f7e 100644 --- a/implementation/src/main/java/io/smallrye/metrics/setup/config/TimerBucketMaxConfiguration.java +++ b/implementation/src/main/java/io/smallrye/metrics/setup/config/TimerBucketMaxConfiguration.java @@ -69,10 +69,13 @@ public static Collection parse(String input) { continue; } - sloMinConfiguration = new TimerBucketMaxConfiguration(metricName, dur); + if (dur != null) { + sloMinConfiguration = new TimerBucketMaxConfiguration(metricName, dur); + + // LIFO - right most configuration takes precedence + sloMinConfigCollection.addFirst(sloMinConfiguration); + } - // LIFO - right most configuration takes precedence - sloMinConfigCollection.addFirst(sloMinConfiguration); } return sloMinConfigCollection; diff --git a/implementation/src/main/java/io/smallrye/metrics/setup/config/TimerBucketMinConfiguration.java b/implementation/src/main/java/io/smallrye/metrics/setup/config/TimerBucketMinConfiguration.java index 1f68a4fe..26e11170 100644 --- a/implementation/src/main/java/io/smallrye/metrics/setup/config/TimerBucketMinConfiguration.java +++ b/implementation/src/main/java/io/smallrye/metrics/setup/config/TimerBucketMinConfiguration.java @@ -69,10 +69,13 @@ public static Collection parse(String input) { continue; } - sloMinConfiguration = new TimerBucketMinConfiguration(metricName, dur); + if (dur != null) { + sloMinConfiguration = new TimerBucketMinConfiguration(metricName, dur); + + // LIFO - right most configuration takes precedence + sloMinConfigCollection.addFirst(sloMinConfiguration); + } - // LIFO - right most configuration takes precedence - sloMinConfigCollection.addFirst(sloMinConfiguration); } return sloMinConfigCollection; From 0c3e73ccd2e209202d60bb61da2aed8df81b3db4 Mon Sep 17 00:00:00 2001 From: Channyboy Date: Tue, 19 Sep 2023 16:00:08 -0400 Subject: [PATCH 3/3] initialize dur as null for TimerBucketMaxConfiguration and TimerBucketMinConfiguration --- .../metrics/setup/config/TimerBucketMaxConfiguration.java | 2 +- .../metrics/setup/config/TimerBucketMinConfiguration.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/implementation/src/main/java/io/smallrye/metrics/setup/config/TimerBucketMaxConfiguration.java b/implementation/src/main/java/io/smallrye/metrics/setup/config/TimerBucketMaxConfiguration.java index 03b28f7e..756e2d41 100644 --- a/implementation/src/main/java/io/smallrye/metrics/setup/config/TimerBucketMaxConfiguration.java +++ b/implementation/src/main/java/io/smallrye/metrics/setup/config/TimerBucketMaxConfiguration.java @@ -34,7 +34,7 @@ public static Collection parse(String input) { String metricName = keyValueSplit[0]; TimerBucketMaxConfiguration sloMinConfiguration = null; - Duration dur; + Duration dur = null; // metricGroup= == invalid if (keyValueSplit.length == 2) { diff --git a/implementation/src/main/java/io/smallrye/metrics/setup/config/TimerBucketMinConfiguration.java b/implementation/src/main/java/io/smallrye/metrics/setup/config/TimerBucketMinConfiguration.java index 26e11170..bd14cfab 100644 --- a/implementation/src/main/java/io/smallrye/metrics/setup/config/TimerBucketMinConfiguration.java +++ b/implementation/src/main/java/io/smallrye/metrics/setup/config/TimerBucketMinConfiguration.java @@ -34,7 +34,7 @@ public static Collection parse(String input) { String metricName = keyValueSplit[0]; TimerBucketMinConfiguration sloMinConfiguration = null; - Duration dur; + Duration dur = null; // metricGroup= == invalid if (keyValueSplit.length == 2) {