diff --git a/host/build.gradle b/host/build.gradle index be96739..01dbffc 100644 --- a/host/build.gradle +++ b/host/build.gradle @@ -21,7 +21,7 @@ dependencies { implementation("io.opentelemetry.semconv:opentelemetry-semconv:1.23.1-alpha") implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.16.0-rc1") implementation("org.snmp4j:snmp4j-agent:3.8.1") - implementation(files("libs/otel-dc-0.9.9.jar")) + implementation(files("libs/otel-dc-0.10.0.jar")) implementation(files("libs/simp-snmp-0.1.3.jar")) testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.1") diff --git a/host/libs/otel-dc-0.10.0.jar b/host/libs/otel-dc-0.10.0.jar new file mode 100644 index 0000000..19c967c Binary files /dev/null and b/host/libs/otel-dc-0.10.0.jar differ diff --git a/host/libs/otel-dc-0.9.9.jar b/host/libs/otel-dc-0.9.9.jar deleted file mode 100644 index f3dc576..0000000 Binary files a/host/libs/otel-dc-0.9.9.jar and /dev/null differ diff --git a/internal/otel-dc/build.gradle b/internal/otel-dc/build.gradle index 9cdcb90..717fed0 100644 --- a/internal/otel-dc/build.gradle +++ b/internal/otel-dc/build.gradle @@ -4,7 +4,7 @@ plugins { } group = "com.instana.dc" -version = "0.9.9" +version = "0.10.0" repositories { mavenCentral() diff --git a/internal/otel-dc/src/main/java/com/instana/dc/AbstractDc.java b/internal/otel-dc/src/main/java/com/instana/dc/AbstractDc.java index 9e78897..25a9be9 100644 --- a/internal/otel-dc/src/main/java/com/instana/dc/AbstractDc.java +++ b/internal/otel-dc/src/main/java/com/instana/dc/AbstractDc.java @@ -1,5 +1,12 @@ package com.instana.dc; +import java.time.Duration; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; + +import static com.instana.dc.DcUtil.getCert; + import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.metrics.Meter; import io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporter; @@ -10,13 +17,6 @@ import io.opentelemetry.sdk.metrics.export.PeriodicMetricReader; import io.opentelemetry.sdk.resources.Resource; -import java.time.Duration; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; - -import static com.instana.dc.DcUtil.getCert; - public abstract class AbstractDc implements IDc { private final Map meters = new ConcurrentHashMap<>(); private final Map rawMetricsMap; @@ -63,8 +63,10 @@ public static OtlpGrpcMetricExporter createOtlpGrpcMetricExporter(String otelBac .setEndpoint(otelBackendUrl) .setTimeout(timeout, TimeUnit.SECONDS); + HeadersSupplier supplier = HeadersSupplier.INSTANCE; + builder.setHeaders(supplier::getHeaders); if (headers != null) { - builder.setHeaders(() -> headers); + supplier.updateHeaders(headers); } if (cert != null) { builder.setTrustedCertificates(cert); @@ -78,8 +80,10 @@ public static OtlpHttpMetricExporter createOtlpHttpMetricExporter(String otelBac .setEndpoint(otelBackendUrl) .setTimeout(timeout, TimeUnit.SECONDS); + HeadersSupplier supplier = HeadersSupplier.INSTANCE; + builder.setHeaders(supplier::getHeaders); if (headers != null) { - builder.setHeaders(() -> headers); + supplier.updateHeaders(headers); } if (cert != null) { builder.setTrustedCertificates(cert); diff --git a/internal/otel-dc/src/main/java/com/instana/dc/HeadersSupplier.java b/internal/otel-dc/src/main/java/com/instana/dc/HeadersSupplier.java new file mode 100644 index 0000000..8d58572 --- /dev/null +++ b/internal/otel-dc/src/main/java/com/instana/dc/HeadersSupplier.java @@ -0,0 +1,23 @@ +/* + * (c) Copyright IBM Corp. 2024 + * (c) Copyright Instana Inc. + */ +package com.instana.dc; + +import java.util.HashMap; +import java.util.Map; + +public enum HeadersSupplier { + INSTANCE; + + private final Map headers = new HashMap<>(); + + public synchronized void updateHeaders(Map newHeaders) { + headers.clear(); + headers.putAll(newHeaders); + } + + public Map getHeaders() { + return new HashMap<>(headers); + } +} diff --git a/llm/build.gradle b/llm/build.gradle index b9c9e8a..3025a2e 100644 --- a/llm/build.gradle +++ b/llm/build.gradle @@ -27,7 +27,7 @@ dependencies { implementation("com.google.protobuf:protobuf-java-util:3.23.4") implementation("com.linecorp.armeria:armeria:1.27.3") implementation("com.linecorp.armeria:armeria-grpc:1.27.3") - implementation(files("libs/otel-dc-0.9.9.jar")) + implementation(files("libs/otel-dc-0.10.0.jar")) testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.1") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.1") diff --git a/llm/libs/otel-dc-0.10.0.jar b/llm/libs/otel-dc-0.10.0.jar new file mode 100644 index 0000000..19c967c Binary files /dev/null and b/llm/libs/otel-dc-0.10.0.jar differ diff --git a/llm/libs/otel-dc-0.9.9.jar b/llm/libs/otel-dc-0.9.9.jar deleted file mode 100644 index f3dc576..0000000 Binary files a/llm/libs/otel-dc-0.9.9.jar and /dev/null differ diff --git a/rdb/build.gradle b/rdb/build.gradle index 6955260..d464079 100644 --- a/rdb/build.gradle +++ b/rdb/build.gradle @@ -20,7 +20,7 @@ dependencies { implementation("io.opentelemetry:opentelemetry-exporter-sender-okhttp:1.34.1") implementation("io.opentelemetry.semconv:opentelemetry-semconv:1.23.1-alpha") implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.16.0-rc1") - implementation(files("libs/otel-dc-0.9.9.jar")) + implementation(files("libs/otel-dc-0.10.0.jar")) implementation(files("libs/ngdbc-2.4.64.jar")) implementation("org.apache.commons:commons-dbcp2:2.11.0") diff --git a/rdb/libs/otel-dc-0.10.0.jar b/rdb/libs/otel-dc-0.10.0.jar new file mode 100644 index 0000000..19c967c Binary files /dev/null and b/rdb/libs/otel-dc-0.10.0.jar differ diff --git a/rdb/libs/otel-dc-0.9.9.jar b/rdb/libs/otel-dc-0.9.9.jar deleted file mode 100644 index f3dc576..0000000 Binary files a/rdb/libs/otel-dc-0.9.9.jar and /dev/null differ