Have cassandra integration to work with recent versions of Guava.
Recent versions of Guava removed method 'Futures::transform(input, function)' in favor of 'Futures::transform(input, function, executor)'.
This commit manually retrieve the executor as it was done in Guava 20 in the overloaded method.
See:
MODIFY
dd-java-agent/instrumentation/datastax-cassandra-3/datastax-cassandra-3.gradle
dd-java-agent/instrumentation/datastax-cassandra-3/datastax-cassandra-3.gradle
@@ -3,14 +3,35 @@ ext {
// Test use Cassandra 3 which requires Java 8. (Currently incompatible with Java 9.)
minJavaVersionForTests = JavaVersion.VERSION_1_8
maxJavaVersionForTests = JavaVersion.VERSION_1_8
+ cassandraDriverTestVersions = "[3.0,4.0)"
}
+
muzzle {
+
pass {
group = "com.datastax.cassandra"
module = "cassandra-driver-core"
- versions = "[3.0,4.0)"
+ versions = cassandraDriverTestVersions
assertInverse = true
+ // Older versions of cassandra-driver-core require an older guava dependency (0.16.0). guava <20 is not
+ // compatible with Java 7, so we declare the dependency on 20 in our top level dependencies.gradle.
+ // Ideally our muzzle plugin should take into account those versions declaration, instead it does not so we would
+ // end up with testing compatibility with guava 0.16 which lacks the method invocation added to be compatible with
+ // most recent versions of guava (27+). While the long term solution is to make the muzzle plugin of upstream
+ // declared dependencies, for now we just make sure that we use the proper ones.
+ extraDependency "com.google.guava:guava:20.0"
+ }
+
+ // Making sure that instrumentation works with recent versions of Guava which removed method
+ // Futures::transform(input, function) in favor of Futures::transform(input, function, executor)
+ pass {
+ name = "Newest versions of Guava"
+ group = "com.datastax.cassandra"
+ module = "cassandra-driver-core"
+ versions = cassandraDriverTestVersions
+ // While com.datastax.cassandra uses old versions of Guava, users may depends themselves on newer versions of Guava
+ extraDependency "com.google.guava:guava:27.0-jre"
}
}

MODIFY
dd-java-agent/instrumentation/datastax-cassandra-3/src/main/java/datadog/trace/instrumentation/datastax/cassandra/TracingSession.java
dd-java-agent/instrumentation/datastax-cassandra-3/src/main/java/datadog/trace/instrumentation/datastax/cassandra/TracingSession.java
package datadog.trace.instrumentation.datastax.cassandra;
+import static com.google.common.util.concurrent.MoreExecutors.directExecutor;
import static datadog.trace.instrumentation.datastax.cassandra.CassandraClientDecorator.DECORATE;
import com.datastax.driver.core.BoundStatement;
@@ -51,7 +52,9 @@ public class TracingSession implements Session {
public Session apply(final Session session) {
return new TracingSession(session, tracer);
}
- });
+ },
+ directExecutor()
+ );
}
@Override

Have cassandra integration to work with recent versions of Guava.

Recent versions of Guava removed method 'Futures::transform(input, function)' in favor of 'Futures::transform(input, function, executor)'.
This commit manually retrieve the executor as it was done in Guava 20 in the overloaded method.
See: https://github.com/google/guava/blob/65f6b4f4b132a051616403bcf74e4034a19d92a1/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java#L58