From c4e5fcf326144ab099ee3562490de8502e1fbeb0 Mon Sep 17 00:00:00 2001 From: Jack Shirazi Date: Thu, 7 Aug 2025 13:59:01 +0100 Subject: [PATCH 1/6] switch to 2.18.1, and switch openai to upstream --- ...lasticAutoConfigurationCustomizerProviderTest.java | 11 +++++++---- gradle/libs.versions.toml | 4 ++-- .../v1_1/OpenAiClientInstrumentationModule.java | 10 ++++++++++ .../java/co/elastic/otel/openai/v1_1/ChatTest.java | 2 ++ .../co/elastic/otel/openai/v1_1/EmbeddingsTest.java | 2 ++ 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/custom/src/test/java/co/elastic/otel/ElasticAutoConfigurationCustomizerProviderTest.java b/custom/src/test/java/co/elastic/otel/ElasticAutoConfigurationCustomizerProviderTest.java index f04ac0ae..d62226f5 100644 --- a/custom/src/test/java/co/elastic/otel/ElasticAutoConfigurationCustomizerProviderTest.java +++ b/custom/src/test/java/co/elastic/otel/ElasticAutoConfigurationCustomizerProviderTest.java @@ -58,7 +58,8 @@ void defaultConfiguration() { void disableCustomResourceProvider() { Map userConfig = new HashMap<>(); userConfig.put("otel.java.disabled.resource.providers", "my.disabled.provider.Provider"); - Map config = propertiesCustomizer(DefaultConfigProperties.create(userConfig)); + Map config = + propertiesCustomizer(DefaultConfigProperties.createFromMap(userConfig)); String value = config.get("otel.java.disabled.resource.providers"); assertThat(value) .satisfies( @@ -73,7 +74,8 @@ void disableCustomResourceProvider() { void disableExperimentalRuntimeMetrics() { Map userConfig = new HashMap<>(); userConfig.put("otel.instrumentation.runtime-telemetry.emit-experimental-telemetry", "false"); - Map config = propertiesCustomizer(DefaultConfigProperties.create(userConfig)); + Map config = + propertiesCustomizer(DefaultConfigProperties.createFromMap(userConfig)); String value = config.get("otel.instrumentation.runtime-telemetry.emit-experimental-telemetry"); assertThat(value).isEqualTo("false"); } @@ -81,7 +83,7 @@ void disableExperimentalRuntimeMetrics() { @Test void ensureDefaultMetricTemporalityIsDelta() { Map config = - propertiesCustomizer(DefaultConfigProperties.create(new HashMap<>())); + propertiesCustomizer(DefaultConfigProperties.createFromMap(new HashMap<>())); String value = config.get("otel.exporter.otlp.metrics.temporality.preference"); assertThat(value).isEqualTo("DELTA"); } @@ -90,7 +92,8 @@ void ensureDefaultMetricTemporalityIsDelta() { void customizeMetricTemporalityPreference() { Map userConfig = new HashMap<>(); userConfig.put("otel.exporter.otlp.metrics.temporality.preference", "LOWMEMORY"); - Map config = propertiesCustomizer(DefaultConfigProperties.create(userConfig)); + Map config = + propertiesCustomizer(DefaultConfigProperties.createFromMap(userConfig)); String value = config.get("otel.exporter.otlp.metrics.temporality.preference"); assertThat(value).isEqualTo("LOWMEMORY"); } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 56089e14..3fc4eaf5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,11 +11,11 @@ opentelemetryProto = "1.3.2-alpha" # otel agent, we rely on the '*-alpha' and get the non-alpha dependencies transitively # updated from upstream agent with gradle/update-upstream.sh -opentelemetryJavaagentAlpha = "2.17.1-alpha" +opentelemetryJavaagentAlpha = "2.18.1-alpha" # otel contrib # updated from upstream agent with gradle/update-upstream.sh -opentelemetryContribAlpha = "1.46.0-alpha" +opentelemetryContribAlpha = "1.47.0-alpha" # otel semconv # updated from upstream agent with gradle/update-upstream.sh diff --git a/instrumentation/openai-client-instrumentation/instrumentation-1.1/src/main/java/co/elastic/otel/openai/v1_1/OpenAiClientInstrumentationModule.java b/instrumentation/openai-client-instrumentation/instrumentation-1.1/src/main/java/co/elastic/otel/openai/v1_1/OpenAiClientInstrumentationModule.java index cd5ae070..0381508a 100644 --- a/instrumentation/openai-client-instrumentation/instrumentation-1.1/src/main/java/co/elastic/otel/openai/v1_1/OpenAiClientInstrumentationModule.java +++ b/instrumentation/openai-client-instrumentation/instrumentation-1.1/src/main/java/co/elastic/otel/openai/v1_1/OpenAiClientInstrumentationModule.java @@ -22,6 +22,7 @@ import com.google.auto.service.AutoService; import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import java.util.Collections; import java.util.List; @@ -41,4 +42,13 @@ public List typeInstrumentations() { public boolean isHelperClass(String className) { return className.startsWith("co.elastic.otel.openai"); } + + @Override + public boolean defaultEnabled(ConfigProperties config) { + // the upstream implementation - openai or openai-java - is used in preference to this + // you could disable that and enable this with + // OTEL_INSTRUMENTATION_OPENAI=false + // OTEL_INSTRUMENTATION_OPENAI_CLIENT=true + return false; + } } diff --git a/instrumentation/openai-client-instrumentation/instrumentation-1.1/src/test/java/co/elastic/otel/openai/v1_1/ChatTest.java b/instrumentation/openai-client-instrumentation/instrumentation-1.1/src/test/java/co/elastic/otel/openai/v1_1/ChatTest.java index 141cfa1c..a375e66b 100644 --- a/instrumentation/openai-client-instrumentation/instrumentation-1.1/src/test/java/co/elastic/otel/openai/v1_1/ChatTest.java +++ b/instrumentation/openai-client-instrumentation/instrumentation-1.1/src/test/java/co/elastic/otel/openai/v1_1/ChatTest.java @@ -85,9 +85,11 @@ import java.util.function.Consumer; import java.util.stream.Collectors; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; +@Disabled class ChatTest { @RegisterExtension diff --git a/instrumentation/openai-client-instrumentation/instrumentation-1.1/src/test/java/co/elastic/otel/openai/v1_1/EmbeddingsTest.java b/instrumentation/openai-client-instrumentation/instrumentation-1.1/src/test/java/co/elastic/otel/openai/v1_1/EmbeddingsTest.java index 57e78f51..b7e97cc0 100644 --- a/instrumentation/openai-client-instrumentation/instrumentation-1.1/src/test/java/co/elastic/otel/openai/v1_1/EmbeddingsTest.java +++ b/instrumentation/openai-client-instrumentation/instrumentation-1.1/src/test/java/co/elastic/otel/openai/v1_1/EmbeddingsTest.java @@ -37,9 +37,11 @@ import io.opentelemetry.api.trace.StatusCode; import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; import java.util.Collections; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; +@Disabled class EmbeddingsTest { @RegisterExtension static final AgentInstrumentationExtension testing = AgentInstrumentationExtension.create(); From 9afd6d472ec8766eff76d3b47996c20333da3032 Mon Sep 17 00:00:00 2001 From: Jack Shirazi Date: Thu, 7 Aug 2025 14:41:04 +0100 Subject: [PATCH 2/6] add breaking change notice --- docs/release-notes/breaking-changes.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/breaking-changes.md b/docs/release-notes/breaking-changes.md index 24e3257c..787622a6 100644 --- a/docs/release-notes/breaking-changes.md +++ b/docs/release-notes/breaking-changes.md @@ -28,4 +28,9 @@ Breaking changes can impact your applications, potentially disrupting normal ope % :::: % TEMPLATE END -No breaking changes. \ No newline at end of file +::::{dropdown} openai instrumentation switched from openai-client to openai +In OpenTelemetry Java agent version 2.18.0, an `openai` instrumentation module was added. This conflicted with the `openai-client` instrumentation module that was implemented in the EDOT agent. Since the `openai` module is on by default, we switched off the `openai-client` instrumentation module (previously on by default). The functionality is broadly the same +**Impact**
Small changes in span names and attributes expected. If the elastic specific `ELASTIC_OTEL_JAVA_INSTRUMENTATION_GENAI_EMIT_EVENTS` was previously set to true, this would no longer produce events +**Action**
the equivalent of `ELASTIC_OTEL_JAVA_INSTRUMENTATION_GENAI_EMIT_EVENTS` is simply `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT`. If you want to revert entirely to the previous setup, you can disable the upstream implementation and enable the EDOT one, eg `OTEL_INSTRUMENTATION_OPENAI=false` and `OTEL_INSTRUMENTATION_OPENAI_CLIENT=true` +View [PR #763](https://github.com/elastic/elastic-otel-java/pull/763). +:::: From bdbcb20092a09911a5e00e8a16e75983aad5b8dd Mon Sep 17 00:00:00 2001 From: jackshirazi Date: Fri, 8 Aug 2025 13:03:25 +0100 Subject: [PATCH 3/6] Update docs/release-notes/breaking-changes.md Co-authored-by: Fabrizio Ferri-Benedetti --- docs/release-notes/breaking-changes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release-notes/breaking-changes.md b/docs/release-notes/breaking-changes.md index 787622a6..784f09a6 100644 --- a/docs/release-notes/breaking-changes.md +++ b/docs/release-notes/breaking-changes.md @@ -28,7 +28,7 @@ Breaking changes can impact your applications, potentially disrupting normal ope % :::: % TEMPLATE END -::::{dropdown} openai instrumentation switched from openai-client to openai +::::{dropdown} OpenAI instrumentation switched from openai-client to openai In OpenTelemetry Java agent version 2.18.0, an `openai` instrumentation module was added. This conflicted with the `openai-client` instrumentation module that was implemented in the EDOT agent. Since the `openai` module is on by default, we switched off the `openai-client` instrumentation module (previously on by default). The functionality is broadly the same **Impact**
Small changes in span names and attributes expected. If the elastic specific `ELASTIC_OTEL_JAVA_INSTRUMENTATION_GENAI_EMIT_EVENTS` was previously set to true, this would no longer produce events **Action**
the equivalent of `ELASTIC_OTEL_JAVA_INSTRUMENTATION_GENAI_EMIT_EVENTS` is simply `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT`. If you want to revert entirely to the previous setup, you can disable the upstream implementation and enable the EDOT one, eg `OTEL_INSTRUMENTATION_OPENAI=false` and `OTEL_INSTRUMENTATION_OPENAI_CLIENT=true` From 0295ec6025fdffad23a47544ff13ff725164006c Mon Sep 17 00:00:00 2001 From: jackshirazi Date: Fri, 8 Aug 2025 13:03:40 +0100 Subject: [PATCH 4/6] Update docs/release-notes/breaking-changes.md Co-authored-by: Fabrizio Ferri-Benedetti --- docs/release-notes/breaking-changes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release-notes/breaking-changes.md b/docs/release-notes/breaking-changes.md index 784f09a6..c53ac2f5 100644 --- a/docs/release-notes/breaking-changes.md +++ b/docs/release-notes/breaking-changes.md @@ -29,7 +29,7 @@ Breaking changes can impact your applications, potentially disrupting normal ope % TEMPLATE END ::::{dropdown} OpenAI instrumentation switched from openai-client to openai -In OpenTelemetry Java agent version 2.18.0, an `openai` instrumentation module was added. This conflicted with the `openai-client` instrumentation module that was implemented in the EDOT agent. Since the `openai` module is on by default, we switched off the `openai-client` instrumentation module (previously on by default). The functionality is broadly the same +In OpenTelemetry Java agent version 2.18.0, an `openai` instrumentation module was added. This conflicted with the `openai-client` instrumentation module that was implemented in the EDOT agent. Since the `openai` module is on by default, we switched off the `openai-client` instrumentation module (previously on by default). The functionality is broadly the same. **Impact**
Small changes in span names and attributes expected. If the elastic specific `ELASTIC_OTEL_JAVA_INSTRUMENTATION_GENAI_EMIT_EVENTS` was previously set to true, this would no longer produce events **Action**
the equivalent of `ELASTIC_OTEL_JAVA_INSTRUMENTATION_GENAI_EMIT_EVENTS` is simply `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT`. If you want to revert entirely to the previous setup, you can disable the upstream implementation and enable the EDOT one, eg `OTEL_INSTRUMENTATION_OPENAI=false` and `OTEL_INSTRUMENTATION_OPENAI_CLIENT=true` View [PR #763](https://github.com/elastic/elastic-otel-java/pull/763). From 3c283fe73f9ae4a9e6602a202879f87dc451bc9c Mon Sep 17 00:00:00 2001 From: jackshirazi Date: Fri, 8 Aug 2025 13:03:54 +0100 Subject: [PATCH 5/6] Update docs/release-notes/breaking-changes.md Co-authored-by: Fabrizio Ferri-Benedetti --- docs/release-notes/breaking-changes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release-notes/breaking-changes.md b/docs/release-notes/breaking-changes.md index c53ac2f5..db0b313d 100644 --- a/docs/release-notes/breaking-changes.md +++ b/docs/release-notes/breaking-changes.md @@ -30,7 +30,7 @@ Breaking changes can impact your applications, potentially disrupting normal ope ::::{dropdown} OpenAI instrumentation switched from openai-client to openai In OpenTelemetry Java agent version 2.18.0, an `openai` instrumentation module was added. This conflicted with the `openai-client` instrumentation module that was implemented in the EDOT agent. Since the `openai` module is on by default, we switched off the `openai-client` instrumentation module (previously on by default). The functionality is broadly the same. -**Impact**
Small changes in span names and attributes expected. If the elastic specific `ELASTIC_OTEL_JAVA_INSTRUMENTATION_GENAI_EMIT_EVENTS` was previously set to true, this would no longer produce events +**Impact**
Small changes in span names and attributes expected. If the elastic specific `ELASTIC_OTEL_JAVA_INSTRUMENTATION_GENAI_EMIT_EVENTS` was previously set to true, this would no longer produce events. **Action**
the equivalent of `ELASTIC_OTEL_JAVA_INSTRUMENTATION_GENAI_EMIT_EVENTS` is simply `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT`. If you want to revert entirely to the previous setup, you can disable the upstream implementation and enable the EDOT one, eg `OTEL_INSTRUMENTATION_OPENAI=false` and `OTEL_INSTRUMENTATION_OPENAI_CLIENT=true` View [PR #763](https://github.com/elastic/elastic-otel-java/pull/763). :::: From c8e9059ca53ea15b5302f10a6296051043f845b9 Mon Sep 17 00:00:00 2001 From: jackshirazi Date: Fri, 8 Aug 2025 13:04:23 +0100 Subject: [PATCH 6/6] Update docs/release-notes/breaking-changes.md Co-authored-by: Fabrizio Ferri-Benedetti --- docs/release-notes/breaking-changes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release-notes/breaking-changes.md b/docs/release-notes/breaking-changes.md index db0b313d..9657af61 100644 --- a/docs/release-notes/breaking-changes.md +++ b/docs/release-notes/breaking-changes.md @@ -31,6 +31,6 @@ Breaking changes can impact your applications, potentially disrupting normal ope ::::{dropdown} OpenAI instrumentation switched from openai-client to openai In OpenTelemetry Java agent version 2.18.0, an `openai` instrumentation module was added. This conflicted with the `openai-client` instrumentation module that was implemented in the EDOT agent. Since the `openai` module is on by default, we switched off the `openai-client` instrumentation module (previously on by default). The functionality is broadly the same. **Impact**
Small changes in span names and attributes expected. If the elastic specific `ELASTIC_OTEL_JAVA_INSTRUMENTATION_GENAI_EMIT_EVENTS` was previously set to true, this would no longer produce events. -**Action**
the equivalent of `ELASTIC_OTEL_JAVA_INSTRUMENTATION_GENAI_EMIT_EVENTS` is simply `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT`. If you want to revert entirely to the previous setup, you can disable the upstream implementation and enable the EDOT one, eg `OTEL_INSTRUMENTATION_OPENAI=false` and `OTEL_INSTRUMENTATION_OPENAI_CLIENT=true` +**Action**
The equivalent of `ELASTIC_OTEL_JAVA_INSTRUMENTATION_GENAI_EMIT_EVENTS` is `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT`. If you want to revert entirely to the previous setup, turn off the upstream implementation and turn on the EDOT one. For example: `OTEL_INSTRUMENTATION_OPENAI=false` and `OTEL_INSTRUMENTATION_OPENAI_CLIENT=true` View [PR #763](https://github.com/elastic/elastic-otel-java/pull/763). ::::