Remove unnecessary additionalHelperClasses() from elasticsearch-transport
MODIFY
instrumentation/elasticsearch/elasticsearch-transport-5.0/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v5_0/Elasticsearch5TransportClientInstrumentationModule.java
instrumentation/elasticsearch/elasticsearch-transport-5.0/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v5_0/Elasticsearch5TransportClientInstrumentationModule.java
@@ -34,18 +34,6 @@ public class Elasticsearch5TransportClientInstrumentationModule extends Instrume
super("elasticsearch-transport", "elasticsearch-transport-5.0", "elasticsearch");
}
- @Override
- protected String[] additionalHelperClassNames() {
- return new String[] {
- // TODO: use Java 8 Collectors.joining() instead
- "com.google.common.base.Preconditions",
- "com.google.common.base.Joiner",
- "com.google.common.base.Joiner$1",
- "com.google.common.base.Joiner$2",
- "com.google.common.base.Joiner$MapJoiner",
- };
- }
-
@Override
public List<TypeInstrumentation> typeInstrumentations() {
return singletonList(new AbstractClientInstrumentation());

MODIFY
instrumentation/elasticsearch/elasticsearch-transport-5.0/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v5_0/TransportActionListener.java
instrumentation/elasticsearch/elasticsearch-transport-5.0/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v5_0/TransportActionListener.java
@@ -7,7 +7,6 @@ package io.opentelemetry.javaagent.instrumentation.elasticsearch.transport.v5_0;
import static io.opentelemetry.javaagent.instrumentation.elasticsearch.transport.ElasticsearchTransportClientTracer.tracer;
-import com.google.common.base.Joiner;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.attributes.SemanticAttributes;
import io.opentelemetry.instrumentation.api.tracer.utils.NetPeerUtils;
@@ -41,14 +40,14 @@ public class TransportActionListener<T extends ActionResponse> implements Action
IndicesRequest req = (IndicesRequest) request;
String[] indices = req.indices();
if (indices != null && indices.length > 0) {
- span.setAttribute("elasticsearch.request.indices", Joiner.on(",").join(indices));
+ span.setAttribute("elasticsearch.request.indices", String.join(",", indices));
}
}
if (request instanceof SearchRequest) {
SearchRequest req = (SearchRequest) request;
String[] types = req.types();
if (types != null && types.length > 0) {
- span.setAttribute("elasticsearch.request.search.types", Joiner.on(",").join(types));
+ span.setAttribute("elasticsearch.request.search.types", String.join(",", types));
}
}
if (request instanceof DocumentRequest) {

MODIFY
instrumentation/elasticsearch/elasticsearch-transport-5.3/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v5_3/Elasticsearch53TransportClientInstrumentationModule.java
instrumentation/elasticsearch/elasticsearch-transport-5.3/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v5_3/Elasticsearch53TransportClientInstrumentationModule.java
@@ -35,18 +35,6 @@ public class Elasticsearch53TransportClientInstrumentationModule extends Instrum
super("elasticsearch-transport", "elasticsearch-transport-5.3", "elasticsearch");
}
- @Override
- protected String[] additionalHelperClassNames() {
- return new String[] {
- // TODO: use Java 8 Collectors.joining() instead
- "com.google.common.base.Preconditions",
- "com.google.common.base.Joiner",
- "com.google.common.base.Joiner$1",
- "com.google.common.base.Joiner$2",
- "com.google.common.base.Joiner$MapJoiner",
- };
- }
-
@Override
public List<TypeInstrumentation> typeInstrumentations() {
return singletonList(new AbstractClientInstrumentation());

MODIFY
instrumentation/elasticsearch/elasticsearch-transport-5.3/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v5_3/TransportActionListener.java
instrumentation/elasticsearch/elasticsearch-transport-5.3/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v5_3/TransportActionListener.java
@@ -7,7 +7,6 @@ package io.opentelemetry.javaagent.instrumentation.elasticsearch.transport.v5_3;
import static io.opentelemetry.javaagent.instrumentation.elasticsearch.transport.ElasticsearchTransportClientTracer.tracer;
-import com.google.common.base.Joiner;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.attributes.SemanticAttributes;
import io.opentelemetry.instrumentation.api.decorator.BaseDecorator;
@@ -41,14 +40,14 @@ public class TransportActionListener<T extends ActionResponse> implements Action
IndicesRequest req = (IndicesRequest) request;
String[] indices = req.indices();
if (indices != null && indices.length > 0) {
- span.setAttribute("elasticsearch.request.indices", Joiner.on(",").join(indices));
+ span.setAttribute("elasticsearch.request.indices", String.join(",", indices));
}
}
if (request instanceof SearchRequest) {
SearchRequest req = (SearchRequest) request;
String[] types = req.types();
if (types != null && types.length > 0) {
- span.setAttribute("elasticsearch.request.search.types", Joiner.on(",").join(types));
+ span.setAttribute("elasticsearch.request.search.types", String.join(",", types));
}
}
if (request instanceof DocWriteRequest) {

MODIFY
instrumentation/elasticsearch/elasticsearch-transport-6.0/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v6_0/Elasticsearch6TransportClientInstrumentationModule.java
instrumentation/elasticsearch/elasticsearch-transport-6.0/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v6_0/Elasticsearch6TransportClientInstrumentationModule.java
@@ -38,18 +38,6 @@ public class Elasticsearch6TransportClientInstrumentationModule extends Instrume
super("elasticsearch-transport", "elasticsearch-transport-6.0", "elasticsearch");
}
- @Override
- protected String[] additionalHelperClassNames() {
- return new String[] {
- // TODO: use Java 8 Collectors.joining() instead
- "com.google.common.base.Preconditions",
- "com.google.common.base.Joiner",
- "com.google.common.base.Joiner$1",
- "com.google.common.base.Joiner$2",
- "com.google.common.base.Joiner$MapJoiner",
- };
- }
-
@Override
public List<TypeInstrumentation> typeInstrumentations() {
return singletonList(new AbstractClientInstrumentation());

MODIFY
instrumentation/elasticsearch/elasticsearch-transport-6.0/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v6_0/TransportActionListener.java
instrumentation/elasticsearch/elasticsearch-transport-6.0/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v6_0/TransportActionListener.java
@@ -8,7 +8,6 @@ package io.opentelemetry.javaagent.instrumentation.elasticsearch.transport.v6_0;
import static io.opentelemetry.instrumentation.api.decorator.BaseDecorator.setPeer;
import static io.opentelemetry.javaagent.instrumentation.elasticsearch.transport.ElasticsearchTransportClientTracer.tracer;
-import com.google.common.base.Joiner;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.attributes.SemanticAttributes;
import org.elasticsearch.action.ActionListener;
@@ -45,14 +44,14 @@ public class TransportActionListener<T extends ActionResponse> implements Action
IndicesRequest req = (IndicesRequest) request;
String[] indices = req.indices();
if (indices != null && indices.length > 0) {
- span.setAttribute("elasticsearch.request.indices", Joiner.on(",").join(indices));
+ span.setAttribute("elasticsearch.request.indices", String.join(",", indices));
}
}
if (request instanceof SearchRequest) {
SearchRequest req = (SearchRequest) request;
String[] types = req.types();
if (types != null && types.length > 0) {
- span.setAttribute("elasticsearch.request.search.types", Joiner.on(",").join(types));
+ span.setAttribute("elasticsearch.request.search.types", String.join(",", types));
}
}
if (request instanceof DocWriteRequest) {

Remove unnecessary additionalHelperClasses() from elasticsearch-transport (#1766)