Remove unnecessary libs from the javaagent shadowJar
* Remove unnecessary libs from the javaagent shadowJar
And make it a bit lighter: 36 MB -> 21 MB
* Apply code review comments
* Remove unnecessary kotlin exclusion
MODIFY
gradle/instrumentation.gradle
gradle/instrumentation.gradle
@@ -6,7 +6,6 @@ apply plugin: 'muzzle'
apply plugin: 'com.github.johnrengelman.shadow'
ext {
- packageInAgentBundle = true
mavenGroupId = 'io.opentelemetry.javaagent.instrumentation'
// Shadow is only for testing, not publishing.
noShadowPublish = true

MODIFY
instrumentation/cdi-testing/cdi-testing.gradle
instrumentation/cdi-testing/cdi-testing.gradle
-ext.skipPublish = true
+ext {
+ skipPublish = true
+}
apply from: "$rootDir/gradle/instrumentation.gradle"
dependencies {

MODIFY
instrumentation/classloaders/javaagent/jboss-testing/jboss-testing.gradle
instrumentation/classloaders/javaagent/jboss-testing/jboss-testing.gradle
-ext.skipPublish = true
+ext {
+ skipPublish = true
+}
apply from: "$rootDir/gradle/instrumentation.gradle"
dependencies {

MODIFY
instrumentation/classloaders/javaagent/osgi-testing/osgi-testing.gradle
instrumentation/classloaders/javaagent/osgi-testing/osgi-testing.gradle
-ext.skipPublish = true
+ext {
+ skipPublish = true
+}
apply from: "$rootDir/gradle/instrumentation.gradle"
dependencies {

MODIFY
instrumentation/classloaders/javaagent/tomcat-testing/tomcat-testing.gradle
instrumentation/classloaders/javaagent/tomcat-testing/tomcat-testing.gradle
-ext.skipPublish = true
-
+ext {
+ skipPublish = true
+}
apply from: "$rootDir/gradle/instrumentation.gradle"
muzzle {

MODIFY
instrumentation/couchbase/couchbase-3.1/javaagent/couchbase-3.1-javaagent.gradle
instrumentation/couchbase/couchbase-3.1/javaagent/couchbase-3.1-javaagent.gradle
@@ -12,7 +12,9 @@ muzzle {
}
dependencies {
- implementation group: "com.couchbase.client", name: "tracing-opentelemetry", version: "0.3.3"
+ implementation(group: "com.couchbase.client", name: "tracing-opentelemetry", version: "0.3.3") {
+ exclude(group: "com.couchbase.client", module: "core-io")
+ }
library group: "com.couchbase.client", name: "core-io", version: "2.1.0"

MODIFY
instrumentation/couchbase/couchbase-3.1/javaagent/src/test/groovy/CouchbaseClient31Test.groovy
instrumentation/couchbase/couchbase-3.1/javaagent/src/test/groovy/CouchbaseClient31Test.groovy
@@ -62,7 +62,7 @@ class CouchbaseClient31Test extends AgentInstrumentationSpecification {
name(~/.*get/)
}
span(1) {
- name("dispatch_to_server")
+ name(~/.*dispatch_to_server/)
}
}
}

MODIFY
instrumentation/dropwizard-testing/dropwizard-testing.gradle
instrumentation/dropwizard-testing/dropwizard-testing.gradle
-ext.skipPublish = true
+ext {
+ skipPublish = true
+}
apply from: "$rootDir/gradle/instrumentation.gradle"
dependencies {

MODIFY
instrumentation/instrumentation.gradle
instrumentation/instrumentation.gradle
@@ -24,7 +24,7 @@ subprojects {
// Make it so all instrumentation subproject tests can be run with a single command.
instr_project.tasks.test.dependsOn(subProj.tasks.test)
- if (subProj.findProperty('packageInAgentBundle')) {
+ if (subProj.name == 'javaagent') {
instr_project.dependencies {
implementation(project(subProj.getPath()))
}

MODIFY
instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-wildfly-testing/jaxrs-2.0-wildfly-testing.gradle
instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-wildfly-testing/jaxrs-2.0-wildfly-testing.gradle
-ext.skipPublish = true
+ext {
+ skipPublish = true
+}
apply from: "$rootDir/gradle/instrumentation.gradle"
configurations {
@@ -6,7 +8,7 @@ configurations {
}
dependencies {
- api "javax:javaee-api:7.0"
+ testImplementation "javax:javaee-api:7.0"
def arquillianVersion = '1.4.0.Final'
testImplementation "org.jboss.arquillian.junit:arquillian-junit-container:${arquillianVersion}"

MODIFY
instrumentation/mongo/mongo-4.0-testing/mongo-4.0-testing.gradle
instrumentation/mongo/mongo-4.0-testing/mongo-4.0-testing.gradle
+ext {
+ skipPublish = true
+}
apply from: "$rootDir/gradle/instrumentation.gradle"
-
-
dependencies {
testInstrumentation(project(':instrumentation:mongo:mongo-3.7:javaagent')) {
exclude group: 'org.mongodb', module: 'mongo-java-driver'

MODIFY
instrumentation/servlet/glassfish-testing/glassfish-testing.gradle
instrumentation/servlet/glassfish-testing/glassfish-testing.gradle
@@ -5,7 +5,6 @@ ext {
apply from: "$rootDir/gradle/instrumentation.gradle"
-
dependencies {
testInstrumentation project(':instrumentation:servlet:servlet-3.0:javaagent')
testInstrumentation project(':instrumentation:servlet:servlet-common:javaagent')

MODIFY
javaagent-tooling/javaagent-tooling.gradle
javaagent-tooling/javaagent-tooling.gradle
@@ -28,12 +28,7 @@ dependencies {
implementation deps.opentelemetrySdk
implementation deps.opentelemetrySdkAutoconfigure
implementation deps.opentelemetrySdkMetrics
- implementation(deps.opentelemetryKotlin) {
- // opentelemetry-extension-kotlin classes are injected into user classpath
- // where kotlin core libraries are already present
- exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-common'
- exclude group: 'org.jetbrains.kotlinx', module: 'kotlinx-coroutines-core'
- }
+ implementation(deps.opentelemetryKotlin)
implementation deps.opentelemetryExtAws
implementation deps.opentelemetryTraceProps
implementation(deps.opentelemetryResources) {

Remove unnecessary libs from the javaagent shadowJar (#2566)

* Remove unnecessary libs from the javaagent shadowJar

And make it a bit lighter: 36 MB -> 21 MB

* Apply code review comments

* Remove unnecessary kotlin exclusion