From 32d4715f74a47fc6e6980b157ee9c039abd4b2a3 Mon Sep 17 00:00:00 2001 From: Anuraag Agrawal Date: Fri, 8 Jan 2021 03:44:09 +0900 Subject: [PATCH] Remove accidentally duped jsongenerator class (#2449) --- .../otlp/OtlpJsonLoggingMetricExporter.java | 38 ------------------- 1 file changed, 38 deletions(-) diff --git a/exporters/logging-otlp/src/main/java/io/opentelemetry/exporter/logging/otlp/OtlpJsonLoggingMetricExporter.java b/exporters/logging-otlp/src/main/java/io/opentelemetry/exporter/logging/otlp/OtlpJsonLoggingMetricExporter.java index f63cb013e9..e1e73af566 100644 --- a/exporters/logging-otlp/src/main/java/io/opentelemetry/exporter/logging/otlp/OtlpJsonLoggingMetricExporter.java +++ b/exporters/logging-otlp/src/main/java/io/opentelemetry/exporter/logging/otlp/OtlpJsonLoggingMetricExporter.java @@ -7,10 +7,8 @@ package io.opentelemetry.exporter.logging.otlp; import static io.opentelemetry.exporter.logging.otlp.HexEncodingStringJsonGenerator.JSON_FACTORY; -import com.fasterxml.jackson.core.Base64Variant; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.io.SegmentedStringWriter; -import com.fasterxml.jackson.core.util.JsonGeneratorDelegate; import io.opentelemetry.proto.metrics.v1.ResourceMetrics; import io.opentelemetry.sdk.common.CompletableResultCode; import io.opentelemetry.sdk.extension.otproto.MetricAdapter; @@ -70,40 +68,4 @@ public class OtlpJsonLoggingMetricExporter implements MetricExporter { public CompletableResultCode shutdown() { return CompletableResultCode.ofSuccess(); } - - private static final class HexEncodingStringJsonGenerator extends JsonGeneratorDelegate { - - static JsonGenerator create(SegmentedStringWriter stringWriter) { - final JsonGenerator delegate; - try { - delegate = JSON_FACTORY.createGenerator(stringWriter); - } catch (IOException e) { - throw new IllegalStateException( - "Unable to create in-memory JsonGenerator, can't happen.", e); - } - return new HexEncodingStringJsonGenerator(delegate); - } - - private HexEncodingStringJsonGenerator(JsonGenerator delegate) { - super(delegate); - } - - @Override - public void writeBinary(Base64Variant b64variant, byte[] data, int offset, int len) - throws IOException { - writeString(bytesToHex(data, offset, len)); - } - - private static final char[] HEX_ARRAY = "0123456789abcdef".toCharArray(); - - private static String bytesToHex(byte[] bytes, int offset, int len) { - char[] hexChars = new char[len * 2]; - for (int i = 0; i < len; i++) { - int v = bytes[offset + i] & 0xFF; - hexChars[i * 2] = HEX_ARRAY[v >>> 4]; - hexChars[i * 2 + 1] = HEX_ARRAY[v & 0x0F]; - } - return new String(hexChars); - } - } }