@@ -507,7 +507,10 @@ public void testGaugeUTF8() throws IOException {
507507 .labels (Labels .builder ().label ("name.1" , "Björn" ).label ("name*2" , "佖佥" ).build ())
508508 .build ())
509509 .build ();
510- assertPrometheusText (prometheusText , gauge );
510+ ByteArrayOutputStream out = new ByteArrayOutputStream ();
511+ getPrometheusWriter (PrometheusTextFormatWriter .builder ().setIncludeCreatedTimestamps (true ))
512+ .write (out , MetricSnapshots .of ((MetricSnapshot ) gauge ), EscapingScheme .NO_ESCAPING );
513+ assertThat (out ).hasToString (prometheusText );
511514 }
512515
513516 @ Test
@@ -2830,7 +2833,7 @@ private void assertOpenMetricsText(String expected, MetricSnapshot snapshot) thr
28302833 ByteArrayOutputStream out = new ByteArrayOutputStream ();
28312834 OpenMetricsTextFormatWriter writer =
28322835 OpenMetricsTextFormatWriter .builder ().setCreatedTimestampsEnabled (true ).build ();
2833- writer .write (out , MetricSnapshots .of (snapshot ), EscapingScheme .NO_ESCAPING );
2836+ writer .write (out , MetricSnapshots .of (snapshot ), EscapingScheme .UNDERSCORE_ESCAPING );
28342837 assertThat (out ).hasToString (expected );
28352838 }
28362839
@@ -2842,22 +2845,22 @@ private void assertOpenMetricsTextWithExemplarsOnAllTimeSeries(
28422845 .setCreatedTimestampsEnabled (true )
28432846 .setExemplarsOnAllMetricTypesEnabled (true )
28442847 .build ();
2845- writer .write (out , MetricSnapshots .of (snapshot ), EscapingScheme .NO_ESCAPING );
2848+ writer .write (out , MetricSnapshots .of (snapshot ), EscapingScheme .UNDERSCORE_ESCAPING );
28462849 assertThat (out ).hasToString (expected );
28472850 }
28482851
28492852 private void assertOpenMetricsTextWithoutCreated (String expected , MetricSnapshot snapshot )
28502853 throws IOException {
28512854 ByteArrayOutputStream out = new ByteArrayOutputStream ();
28522855 OpenMetricsTextFormatWriter writer = OpenMetricsTextFormatWriter .create ();
2853- writer .write (out , MetricSnapshots .of (snapshot ), EscapingScheme .NO_ESCAPING );
2856+ writer .write (out , MetricSnapshots .of (snapshot ), EscapingScheme .UNDERSCORE_ESCAPING );
28542857 assertThat (out ).hasToString (expected );
28552858 }
28562859
28572860 private void assertPrometheusText (String expected , MetricSnapshot snapshot ) throws IOException {
28582861 ByteArrayOutputStream out = new ByteArrayOutputStream ();
28592862 getPrometheusWriter (PrometheusTextFormatWriter .builder ().setIncludeCreatedTimestamps (true ))
2860- .write (out , MetricSnapshots .of (snapshot ), EscapingScheme .NO_ESCAPING );
2863+ .write (out , MetricSnapshots .of (snapshot ), EscapingScheme .UNDERSCORE_ESCAPING );
28612864 assertThat (out ).hasToString (expected );
28622865 }
28632866
@@ -2871,7 +2874,7 @@ private void assertPrometheusTextWithoutCreated(String expected, MetricSnapshot
28712874 throws IOException {
28722875 ByteArrayOutputStream out = new ByteArrayOutputStream ();
28732876 getPrometheusWriter (PrometheusTextFormatWriter .builder ())
2874- .write (out , MetricSnapshots .of (snapshot ), EscapingScheme .NO_ESCAPING );
2877+ .write (out , MetricSnapshots .of (snapshot ), EscapingScheme .UNDERSCORE_ESCAPING );
28752878 assertThat (out ).hasToString (expected );
28762879 }
28772880
0 commit comments