From 521d57d2ef7d9b05d527167fc18bd7fa38399ddb Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Fri, 10 Jan 2025 09:24:43 +0900 Subject: [PATCH] Add a test verifying that a single character meter name is allowed for Prometheus (#5791) --- .../prometheusmetrics/PrometheusMeterRegistryTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/implementations/micrometer-registry-prometheus/src/test/java/io/micrometer/prometheusmetrics/PrometheusMeterRegistryTest.java b/implementations/micrometer-registry-prometheus/src/test/java/io/micrometer/prometheusmetrics/PrometheusMeterRegistryTest.java index ebb6bd26cf..860712e4f3 100644 --- a/implementations/micrometer-registry-prometheus/src/test/java/io/micrometer/prometheusmetrics/PrometheusMeterRegistryTest.java +++ b/implementations/micrometer-registry-prometheus/src/test/java/io/micrometer/prometheusmetrics/PrometheusMeterRegistryTest.java @@ -1016,6 +1016,12 @@ void doesNotCallConventionOnScrape() { assertThat(convention.tagKeyCount.get()).isEqualTo(expectedTagKeyCount); } + @Test + void scrapeWhenMeterNameContainsSingleCharacter() { + registry.counter("c").increment(); + assertThatNoException().isThrownBy(() -> registry.scrape()); + } + private static class CountingPrometheusNamingConvention extends PrometheusNamingConvention { AtomicInteger nameCount = new AtomicInteger();