Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ void defaultConfiguration() {
void disableCustomResourceProvider() {
Map<String, String> userConfig = new HashMap<>();
userConfig.put("otel.java.disabled.resource.providers", "my.disabled.provider.Provider");
Map<String, String> config = propertiesCustomizer(DefaultConfigProperties.create(userConfig));
Map<String, String> config =
propertiesCustomizer(DefaultConfigProperties.createFromMap(userConfig));
String value = config.get("otel.java.disabled.resource.providers");
assertThat(value)
.satisfies(
Expand All @@ -73,15 +74,16 @@ void disableCustomResourceProvider() {
void disableExperimentalRuntimeMetrics() {
Map<String, String> userConfig = new HashMap<>();
userConfig.put("otel.instrumentation.runtime-telemetry.emit-experimental-telemetry", "false");
Map<String, String> config = propertiesCustomizer(DefaultConfigProperties.create(userConfig));
Map<String, String> config =
propertiesCustomizer(DefaultConfigProperties.createFromMap(userConfig));
String value = config.get("otel.instrumentation.runtime-telemetry.emit-experimental-telemetry");
assertThat(value).isEqualTo("false");
}

@Test
void ensureDefaultMetricTemporalityIsDelta() {
Map<String, String> 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");
}
Expand All @@ -90,7 +92,8 @@ void ensureDefaultMetricTemporalityIsDelta() {
void customizeMetricTemporalityPreference() {
Map<String, String> userConfig = new HashMap<>();
userConfig.put("otel.exporter.otlp.metrics.temporality.preference", "LOWMEMORY");
Map<String, String> config = propertiesCustomizer(DefaultConfigProperties.create(userConfig));
Map<String, String> config =
propertiesCustomizer(DefaultConfigProperties.createFromMap(userConfig));
String value = config.get("otel.exporter.otlp.metrics.temporality.preference");
assertThat(value).isEqualTo("LOWMEMORY");
}
Expand Down
7 changes: 6 additions & 1 deletion docs/release-notes/breaking-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ Breaking changes can impact your applications, potentially disrupting normal ope
% ::::
% TEMPLATE END

No breaking changes.
::::{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**<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.
**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`
View [PR #763](https://github.com/elastic/elastic-otel-java/pull/763).
::::
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -41,4 +42,13 @@ public List<TypeInstrumentation> 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
Comment on lines +50 to +51
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between those two variables ? are there two instrumentations or at least two config options in upstream ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the upstream one uses OTEL_INSTRUMENTATION_OPENAI, while our implementation uses OTEL_INSTRUMENTATION_OPENAI_CLIENT. If the upstream one had used the same var, it wouldn't have been a breaking change and we could have just removed our implementation

return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly disabling those tests is required because now the upstream instrumentation is used. Do we already have an issue that describes the deprecation and removal steps ? Aligning the removal with the update to 3.x upstream seems a good option as it already forces to do a new major.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issue opened yet, I will open when this is merged

class ChatTest {

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading