Skip to content

Commit

Permalink
elasticsearch rest client doesn't use native instrumentation, revert …
Browse files Browse the repository at this point in the history
…these changes
  • Loading branch information
laurit committed Sep 12, 2023
1 parent 897d9ad commit 1c5fb6e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ muzzle {
pass {
group.set("org.elasticsearch.client")
module.set("elasticsearch-rest-client")
versions.set("[7.0,8.10)") // 8.10+ has native, on-by-default opentelemetry instrumentation
versions.set("[7.0,)")
assertInverse.set(true)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed;
import static java.util.Collections.singletonList;
import static net.bytebuddy.matcher.ElementMatchers.not;

import com.google.auto.service.AutoService;
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
Expand All @@ -24,12 +23,7 @@ public ElasticsearchRest7InstrumentationModule() {
@Override
public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
// Class `org.elasticsearch.client.RestClient$InternalRequest` introduced in 7.0.0.
// Since Elasticsearch client version 8.10, the ES client comes with a native OTel
// instrumentation
// that introduced the class `co.elastic.clients.transport.instrumentation.Instrumentation`.
// Disabling agent instrumentation for those cases.
return hasClassesNamed("org.elasticsearch.client.RestClient$InternalRequest")
.and(not(hasClassesNamed("co.elastic.clients.transport.instrumentation.Instrumentation")));
return hasClassesNamed("org.elasticsearch.client.RestClient$InternalRequest");
}

@Override
Expand Down

0 comments on commit 1c5fb6e

Please sign in to comment.