Skip to content

Commit 25bd5f2

Browse files
switch to 2.18.1, and switch openai to upstream (#763)
* switch to 2.18.1, and switch openai to upstream * add breaking change notice * Update docs/release-notes/breaking-changes.md Co-authored-by: Fabrizio Ferri-Benedetti <[email protected]> * Update docs/release-notes/breaking-changes.md Co-authored-by: Fabrizio Ferri-Benedetti <[email protected]> * Update docs/release-notes/breaking-changes.md Co-authored-by: Fabrizio Ferri-Benedetti <[email protected]> * Update docs/release-notes/breaking-changes.md Co-authored-by: Fabrizio Ferri-Benedetti <[email protected]> --------- Co-authored-by: Fabrizio Ferri-Benedetti <[email protected]>
1 parent 52fddb3 commit 25bd5f2

File tree

6 files changed

+29
-7
lines changed

6 files changed

+29
-7
lines changed

custom/src/test/java/co/elastic/otel/ElasticAutoConfigurationCustomizerProviderTest.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ void defaultConfiguration() {
5858
void disableCustomResourceProvider() {
5959
Map<String, String> userConfig = new HashMap<>();
6060
userConfig.put("otel.java.disabled.resource.providers", "my.disabled.provider.Provider");
61-
Map<String, String> config = propertiesCustomizer(DefaultConfigProperties.create(userConfig));
61+
Map<String, String> config =
62+
propertiesCustomizer(DefaultConfigProperties.createFromMap(userConfig));
6263
String value = config.get("otel.java.disabled.resource.providers");
6364
assertThat(value)
6465
.satisfies(
@@ -73,15 +74,16 @@ void disableCustomResourceProvider() {
7374
void disableExperimentalRuntimeMetrics() {
7475
Map<String, String> userConfig = new HashMap<>();
7576
userConfig.put("otel.instrumentation.runtime-telemetry.emit-experimental-telemetry", "false");
76-
Map<String, String> config = propertiesCustomizer(DefaultConfigProperties.create(userConfig));
77+
Map<String, String> config =
78+
propertiesCustomizer(DefaultConfigProperties.createFromMap(userConfig));
7779
String value = config.get("otel.instrumentation.runtime-telemetry.emit-experimental-telemetry");
7880
assertThat(value).isEqualTo("false");
7981
}
8082

8183
@Test
8284
void ensureDefaultMetricTemporalityIsDelta() {
8385
Map<String, String> config =
84-
propertiesCustomizer(DefaultConfigProperties.create(new HashMap<>()));
86+
propertiesCustomizer(DefaultConfigProperties.createFromMap(new HashMap<>()));
8587
String value = config.get("otel.exporter.otlp.metrics.temporality.preference");
8688
assertThat(value).isEqualTo("DELTA");
8789
}
@@ -90,7 +92,8 @@ void ensureDefaultMetricTemporalityIsDelta() {
9092
void customizeMetricTemporalityPreference() {
9193
Map<String, String> userConfig = new HashMap<>();
9294
userConfig.put("otel.exporter.otlp.metrics.temporality.preference", "LOWMEMORY");
93-
Map<String, String> config = propertiesCustomizer(DefaultConfigProperties.create(userConfig));
95+
Map<String, String> config =
96+
propertiesCustomizer(DefaultConfigProperties.createFromMap(userConfig));
9497
String value = config.get("otel.exporter.otlp.metrics.temporality.preference");
9598
assertThat(value).isEqualTo("LOWMEMORY");
9699
}

docs/release-notes/breaking-changes.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,9 @@ Breaking changes can impact your applications, potentially disrupting normal ope
2828
% ::::
2929
% TEMPLATE END
3030

31-
No breaking changes.
31+
::::{dropdown} OpenAI instrumentation switched from openai-client to openai
32+
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.
33+
**Impact**<br> 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.
34+
**Action**<br> 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`
35+
View [PR #763](https://github.com/elastic/elastic-otel-java/pull/763).
36+
::::

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ opentelemetryProto = "1.3.2-alpha"
1111

1212
# otel agent, we rely on the '*-alpha' and get the non-alpha dependencies transitively
1313
# updated from upstream agent with gradle/update-upstream.sh
14-
opentelemetryJavaagentAlpha = "2.17.1-alpha"
14+
opentelemetryJavaagentAlpha = "2.18.1-alpha"
1515

1616
# otel contrib
1717
# updated from upstream agent with gradle/update-upstream.sh
18-
opentelemetryContribAlpha = "1.46.0-alpha"
18+
opentelemetryContribAlpha = "1.47.0-alpha"
1919

2020
# otel semconv
2121
# updated from upstream agent with gradle/update-upstream.sh

instrumentation/openai-client-instrumentation/instrumentation-1.1/src/main/java/co/elastic/otel/openai/v1_1/OpenAiClientInstrumentationModule.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.google.auto.service.AutoService;
2323
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
2424
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
25+
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
2526
import java.util.Collections;
2627
import java.util.List;
2728

@@ -41,4 +42,13 @@ public List<TypeInstrumentation> typeInstrumentations() {
4142
public boolean isHelperClass(String className) {
4243
return className.startsWith("co.elastic.otel.openai");
4344
}
45+
46+
@Override
47+
public boolean defaultEnabled(ConfigProperties config) {
48+
// the upstream implementation - openai or openai-java - is used in preference to this
49+
// you could disable that and enable this with
50+
// OTEL_INSTRUMENTATION_OPENAI=false
51+
// OTEL_INSTRUMENTATION_OPENAI_CLIENT=true
52+
return false;
53+
}
4454
}

instrumentation/openai-client-instrumentation/instrumentation-1.1/src/test/java/co/elastic/otel/openai/v1_1/ChatTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,11 @@
8585
import java.util.function.Consumer;
8686
import java.util.stream.Collectors;
8787
import org.junit.jupiter.api.BeforeEach;
88+
import org.junit.jupiter.api.Disabled;
8889
import org.junit.jupiter.api.Test;
8990
import org.junit.jupiter.api.extension.RegisterExtension;
9091

92+
@Disabled
9193
class ChatTest {
9294

9395
@RegisterExtension

instrumentation/openai-client-instrumentation/instrumentation-1.1/src/test/java/co/elastic/otel/openai/v1_1/EmbeddingsTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@
3737
import io.opentelemetry.api.trace.StatusCode;
3838
import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
3939
import java.util.Collections;
40+
import org.junit.jupiter.api.Disabled;
4041
import org.junit.jupiter.api.Test;
4142
import org.junit.jupiter.api.extension.RegisterExtension;
4243

44+
@Disabled
4345
class EmbeddingsTest {
4446
@RegisterExtension
4547
static final AgentInstrumentationExtension testing = AgentInstrumentationExtension.create();

0 commit comments

Comments
 (0)