Merge pull request #378 from DataDog/ark/cassandra-fix

Remove most shadow relocates
This commit is contained in:
Andrew Kent 2018-06-27 11:56:33 -07:00 committed by GitHub
commit 0360bd01ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 21 deletions

View File

@ -19,7 +19,7 @@ class ShadowPackageRenamingTest extends Specification {
final String agentGuavaDep = final String agentGuavaDep =
ddClass ddClass
.getClassLoader() .getClassLoader()
.loadClass("datadog.trace.agent.deps.google.common.collect.MapMaker") .loadClass("com.google.common.collect.MapMaker")
.getProtectionDomain() .getProtectionDomain()
.getCodeSource() .getCodeSource()
.getLocation() .getLocation()
@ -99,7 +99,6 @@ class ShadowPackageRenamingTest extends Specification {
expect: expect:
duplicateClassFile == [] duplicateClassFile == []
badBootstrapPrefixes == [] badBootstrapPrefixes == []
// ListenableFuture is skipped from shadow due to cassandra instrumentation. badAgentPrefixes == []
badAgentPrefixes == ['com.google.common.util.concurrent.ListenableFuture']
} }
} }

View File

@ -16,10 +16,21 @@ public class Utils {
"datadog.trace.context" "datadog.trace.context"
}; };
public static final String[] AGENT_PACKAGE_PREFIXES = { public static final String[] AGENT_PACKAGE_PREFIXES = {
"datadog.trace.agent",
"datadog.opentracing",
"datadog.trace.common", "datadog.trace.common",
"datadog.trace.instrumentation" "datadog.trace.agent",
"datadog.trace.instrumentation",
// guava
"com.google.auto",
"com.google.common",
"com.google.thirdparty.publicsuffix",
// bytebuddy
"net.bytebuddy",
// OT contribs for dd trace resolver
"io.opentracing.contrib",
// jackson
"org.msgpack",
"com.fasterxml.jackson",
"org.yaml.snakeyaml"
}; };
private static Method findLoadedClassMethod = null; private static Method findLoadedClassMethod = null;

View File

@ -41,23 +41,9 @@ def includeShadowJar(subproject, jarname) {
relocate 'java.util.logging.Logger', 'datadog.trace.bootstrap.PatchLogger' relocate 'java.util.logging.Logger', 'datadog.trace.bootstrap.PatchLogger'
if (!project.hasProperty("disableShadowRelocate") || !disableShadowRelocate) { if (!project.hasProperty("disableShadowRelocate") || !disableShadowRelocate) {
// shadow OT impl to prevent casts to implementation
relocate 'datadog.trace.common', 'datadog.trace.agent.common' relocate 'datadog.trace.common', 'datadog.trace.agent.common'
relocate 'datadog.opentracing', 'datadog.trace.agent.ot' relocate 'datadog.opentracing', 'datadog.trace.agent.ot'
relocate('io.opentracing.contrib', 'datadog.trace.agent.opentracing.contrib') {
// Don't want to change the annotation we're looking for.
exclude 'io.opentracing.contrib.dropwizard.Trace'
}
relocate 'org.yaml', 'datadog.trace.agent.deps.yaml'
relocate 'org.msgpack', 'datadog.trace.agent.deps.msgpack'
relocate 'com.fasterxml', 'datadog.trace.agent.deps.fasterxml'
relocate 'net.bytebuddy', 'datadog.trace.agent.deps.bytebuddy'
relocate('com.google', 'datadog.trace.agent.deps.google') {
// This is used in the Cassandra Cluster.connectAsync signature so we can't relocate it. :fingers_crossed:
exclude 'com.google.common.util.concurrent.ListenableFuture'
}
} }
} }
} }