From b391c4aff26c3dd32f867b3a40351024ad04a829 Mon Sep 17 00:00:00 2001 From: Pranav Sharma Date: Fri, 16 Jun 2023 10:47:00 -0400 Subject: [PATCH] Hardcode path separator used for metric type (#253) Using Java Paths class to combine string leads to different path-separators depending on the OS of the machine code runs on. For metric names, only the linux path-separators are valid, so hardcoding this. --- .../google/cloud/opentelemetry/metric/MetricTranslator.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/exporters/metrics/src/main/java/com/google/cloud/opentelemetry/metric/MetricTranslator.java b/exporters/metrics/src/main/java/com/google/cloud/opentelemetry/metric/MetricTranslator.java index d58d4276..4fa968de 100644 --- a/exporters/metrics/src/main/java/com/google/cloud/opentelemetry/metric/MetricTranslator.java +++ b/exporters/metrics/src/main/java/com/google/cloud/opentelemetry/metric/MetricTranslator.java @@ -38,7 +38,6 @@ import io.opentelemetry.sdk.metrics.data.MetricData; import io.opentelemetry.sdk.metrics.data.MetricDataType; import io.opentelemetry.sdk.metrics.data.SumData; -import java.nio.file.Paths; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -226,7 +225,7 @@ private static String mapMetricType(String instrumentName, String prefix) { return instrumentName; } } - return Paths.get(prefix, instrumentName).toString(); + return String.join("/", prefix, instrumentName); } private static Distribution.Exemplar mapExemplar(ExemplarData exemplar, String projectId) {