Skip to content

Commit 5b5bdf0

Browse files
Fix test to follow the new naming behavior of the Prometheus Client
The Prometheus Java Client used to let users to use colons (":") in the metric names. Apparently, this should have not been allowed. See the docs: https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels "Metric names may contain ASCII letters, digits, underscores, and colons. It must match the regex [a-zA-Z_:][a-zA-Z0-9_:]*. Note: The colons are reserved for user defined recording rules. They should not be used by exporters or direct instrumentation." So even if metric names can contain colons (":"), exporters (like the Prometheus Java Client or Micrometer) should not use it. The Prometheus Java Client replaces colons (":") to underscores ("_") starting from 1.3.3. See prometheus/client_java#974 See prometheus/client_java#975
1 parent 119d28a commit 5b5bdf0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

implementations/micrometer-registry-prometheus/src/test/java/io/micrometer/prometheusmetrics/PrometheusNamingConventionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class PrometheusNamingConventionTest {
3030

3131
@Test
3232
void formatName() {
33-
assertThat(convention.name("123abc/{:id}水", Meter.Type.GAUGE)).startsWith("_23abc__:id__");
33+
assertThat(convention.name("123abc/{:id}水", Meter.Type.GAUGE)).startsWith("_23abc___id__");
3434
}
3535

3636
@Test

0 commit comments

Comments
 (0)