Skip to content

Commit 6f1b6a3

Browse files
committed
fix
Signed-off-by: Gregor Zeitlinger <[email protected]>
1 parent fbd94e6 commit 6f1b6a3

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

prometheus-metrics-core/src/test/java/io/prometheus/metrics/core/metrics/CounterTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import io.prometheus.metrics.expositionformats.internal.PrometheusProtobufWriterImpl;
1313
import io.prometheus.metrics.expositionformats.internal.ProtobufUtil;
1414
import io.prometheus.metrics.model.snapshots.CounterSnapshot;
15+
import io.prometheus.metrics.model.snapshots.EscapingScheme;
1516
import io.prometheus.metrics.model.snapshots.Exemplar;
1617
import io.prometheus.metrics.model.snapshots.Label;
1718
import io.prometheus.metrics.model.snapshots.Labels;
@@ -117,7 +118,7 @@ public void testLabels() {
117118
public void testTotalStrippedFromName(String name) {
118119
Counter counter = Counter.builder().name(name).unit(Unit.SECONDS).build();
119120
Metrics.MetricFamily protobufData =
120-
new PrometheusProtobufWriterImpl().convert(counter.collect());
121+
new PrometheusProtobufWriterImpl().convert(counter.collect(), EscapingScheme.NO_ESCAPING);
121122
assertThat(ProtobufUtil.shortDebugString(protobufData))
122123
.isEqualTo(
123124
"name: \"my_counter_seconds_total\" type: COUNTER metric { counter { value: 0.0 } }");

prometheus-metrics-core/src/test/java/io/prometheus/metrics/core/metrics/HistogramTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ private void run() throws NoSuchFieldException, IllegalAccessException {
8686
}
8787
}
8888
Metrics.MetricFamily protobufData =
89-
new PrometheusProtobufWriterImpl().convert(histogram.collect());
89+
new PrometheusProtobufWriterImpl()
90+
.convert(histogram.collect(), EscapingScheme.NO_ESCAPING);
9091
String expectedWithMetadata =
9192
"name: \"test\" type: HISTOGRAM metric { histogram { " + expected + " } }";
9293
assertThat(ProtobufUtil.shortDebugString(protobufData))
@@ -941,7 +942,8 @@ public void testDefaults() throws IOException {
941942
""";
942943

943944
// protobuf
944-
Metrics.MetricFamily protobufData = new PrometheusProtobufWriterImpl().convert(snapshot);
945+
Metrics.MetricFamily protobufData =
946+
new PrometheusProtobufWriterImpl().convert(snapshot, EscapingScheme.NO_ESCAPING);
945947
assertThat(ProtobufUtil.shortDebugString(protobufData)).isEqualTo(expectedProtobuf);
946948

947949
// text

prometheus-metrics-core/src/test/java/io/prometheus/metrics/core/metrics/InfoTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class InfoTest {
2525
public void testInfoStrippedFromName(String name) {
2626
Info info = Info.builder().name(name).labelNames("my.key").build();
2727
info.addLabelValues("value");
28-
Metrics.MetricFamily protobufData = new PrometheusProtobufWriterImpl().convert(info.collect());
28+
Metrics.MetricFamily protobufData =
29+
new PrometheusProtobufWriterImpl().convert(info.collect(), EscapingScheme.NO_ESCAPING);
2930
assertThat(ProtobufUtil.shortDebugString(protobufData))
3031
.isEqualTo(
3132
"name: \"jvm.runtime_info\" type: GAUGE metric { label { name: \"my.key\" value:"

0 commit comments

Comments
 (0)