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 @@ -141,7 +141,9 @@ static final class Renamer extends Remapper {
RENAMED_PACKAGES.put(
"io/opentelemetry/javaagent/bootstrap/", "datadog/trace/bootstrap/otel/instrumentation/");

RENAMED_PACKAGES.put("org/objectweb/asm/", "net/bytebuddy/jar/asm/");
// we want to keep this package unchanged so it matches against any unshaded extensions
// dropped in at runtime; use replace to stop it being transformed by the shadow plugin
RENAMED_PACKAGES.put("org|objectweb|asm|".replace('|', '/'), "net/bytebuddy/jar/asm/");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ protected byte[] doMapBytecode(String unused) {
/** Maps logging references in the extension to use the tracer's embedded logger. */
public static final Function<String, String> MAP_LOGGING =
new Function<String, String>() {
// substring stops string literal from being changed by shadow plugin
private final String ORG_SLF4J = "_org/slf4j/".substring(1);
// we want to keep this package unchanged so it matches against any unshaded extensions
// dropped in at runtime; use replace to stop it being transformed by the shadow plugin
private final String ORG_SLF4J = "org|slf4j|".replace('|', '/');

@Override
public String apply(String internalName) {
Expand Down
4 changes: 4 additions & 0 deletions dd-java-agent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ def generalShadowJarConfig(ShadowJar shadowJarTask) {
// patch JFFI loading mechanism to maintain isolation
exclude '**/com/kenai/jffi/Init.class'
relocate('com.kenai.jffi.Init', 'com.kenai.jffi.PatchInit')
// use dd-instrument-java's embedded copy of asm
relocate('org.objectweb.asm', 'datadog.instrument.asm')

// Minimize and relocate the airlift compressor dependency for ZSTD
exclude '**/io/airlift/compress/bzip2/**'
Expand Down Expand Up @@ -205,6 +207,8 @@ def sharedShadowJar = tasks.register('sharedShadowJar', ShadowJar) {
exclude(project(':utils:config-utils'))
exclude(project(':utils:time-utils'))
exclude(dependency('org.slf4j::'))
// use dd-instrument-java's embedded copy of asm
exclude(dependency('org.ow2.asm:asm:'))
}
}
includeShadowJar(sharedShadowJar, 'shared', includedJarFileTree)
Expand Down
2 changes: 2 additions & 0 deletions dd-trace-ot/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJ
exclude(dependency("io.opentracing.contrib:"))
exclude(dependency("org.slf4j:"))
exclude(dependency("com.github.jnr:"))
// indirect dependency of JNR, no need to embed
exclude(dependency("org.ow2.asm:"))
}

relocate("com.", "ddtrot.com.") {
Expand Down