Skip to content

Commit 529ff69

Browse files
committed
fix
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
1 parent 30ad118 commit 529ff69

File tree

3 files changed

+8
-0
lines changed
  • prometheus-metrics-exporter-common/src/main/java/io/prometheus/metrics/exporter/common
  • prometheus-metrics-exporter-pushgateway/src/main/java/io/prometheus/metrics/exporter/pushgateway
  • prometheus-metrics-exposition-textformats/src/main/java/io/prometheus/metrics/expositionformats

3 files changed

+8
-0
lines changed

prometheus-metrics-exporter-common/src/main/java/io/prometheus/metrics/exporter/common/PrometheusHttpRequest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ default String getParameter(String name) {
4343
/** See {@code jakarta.servlet.ServletRequest.getParameterValues(String)} */
4444
@Override
4545
@Nullable
46+
// decode with Charset is only available in Java 10+, but we want to support Java 8
47+
@SuppressWarnings("JdkObsolete")
4648
default String[] getParameterValues(String name) {
4749
try {
4850
ArrayList<String> result = new ArrayList<>();

prometheus-metrics-exporter-pushgateway/src/main/java/io/prometheus/metrics/exporter/pushgateway/PushGateway.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ private void doRequest(@Nullable PrometheusRegistry registry, String method) thr
253253
}
254254
}
255255

256+
// toString with Charset is only available in Java 10+, but we want to support Java 8
257+
@SuppressWarnings("JdkObsolete")
256258
private static String readFromStream(InputStream is) throws IOException {
257259
ByteArrayOutputStream result = new ByteArrayOutputStream();
258260
byte[] buffer = new byte[1024];
@@ -497,6 +499,8 @@ private Format getFormat() {
497499
return Format.PROMETHEUS_PROTOBUF;
498500
}
499501

502+
// encode with Charset is only available in Java 10+, but we want to support Java 8
503+
@SuppressWarnings("JdkObsolete")
500504
private URL makeUrl(@Nullable ExporterPushgatewayProperties properties)
501505
throws UnsupportedEncodingException, MalformedURLException {
502506
StringBuilder url =

prometheus-metrics-exposition-textformats/src/main/java/io/prometheus/metrics/expositionformats/ExpositionFormatWriter.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ default void write(OutputStream out, MetricSnapshots metricSnapshots) throws IOE
2020
}
2121

2222
/** Converts the metric snapshots to a debug string using the specified escaping scheme. */
23+
// toString with Charset is only available in Java 10+, but we want to support Java 8
24+
@SuppressWarnings("JdkObsolete")
2325
default String toDebugString(MetricSnapshots metricSnapshots, EscapingScheme escapingScheme) {
2426
ByteArrayOutputStream out = new ByteArrayOutputStream();
2527
try {

0 commit comments

Comments
 (0)