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
This commit is contained in:
Mateusz Rzeszutek 2021-03-16 10:47:05 +01:00 committed by GitHub
parent f3bc02f2e7
commit f3ba2302eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 28 additions and 21 deletions

View File

@ -6,7 +6,6 @@ apply plugin: 'muzzle'
apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'com.github.johnrengelman.shadow'
ext { ext {
packageInAgentBundle = true
mavenGroupId = 'io.opentelemetry.javaagent.instrumentation' mavenGroupId = 'io.opentelemetry.javaagent.instrumentation'
// Shadow is only for testing, not publishing. // Shadow is only for testing, not publishing.
noShadowPublish = true noShadowPublish = true

View File

@ -1,4 +1,6 @@
ext.skipPublish = true ext {
skipPublish = true
}
apply from: "$rootDir/gradle/instrumentation.gradle" apply from: "$rootDir/gradle/instrumentation.gradle"
dependencies { dependencies {

View File

@ -1,4 +1,6 @@
ext.skipPublish = true ext {
skipPublish = true
}
apply from: "$rootDir/gradle/instrumentation.gradle" apply from: "$rootDir/gradle/instrumentation.gradle"
dependencies { dependencies {

View File

@ -1,4 +1,6 @@
ext.skipPublish = true ext {
skipPublish = true
}
apply from: "$rootDir/gradle/instrumentation.gradle" apply from: "$rootDir/gradle/instrumentation.gradle"
dependencies { dependencies {

View File

@ -1,5 +1,6 @@
ext.skipPublish = true ext {
skipPublish = true
}
apply from: "$rootDir/gradle/instrumentation.gradle" apply from: "$rootDir/gradle/instrumentation.gradle"
muzzle { muzzle {

View File

@ -12,7 +12,9 @@ muzzle {
} }
dependencies { 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" library group: "com.couchbase.client", name: "core-io", version: "2.1.0"

View File

@ -62,7 +62,7 @@ class CouchbaseClient31Test extends AgentInstrumentationSpecification {
name(~/.*get/) name(~/.*get/)
} }
span(1) { span(1) {
name("dispatch_to_server") name(~/.*dispatch_to_server/)
} }
} }
} }

View File

@ -1,4 +1,6 @@
ext.skipPublish = true ext {
skipPublish = true
}
apply from: "$rootDir/gradle/instrumentation.gradle" apply from: "$rootDir/gradle/instrumentation.gradle"
dependencies { dependencies {

View File

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

View File

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

View File

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

View File

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

View File

@ -28,12 +28,7 @@ dependencies {
implementation deps.opentelemetrySdk implementation deps.opentelemetrySdk
implementation deps.opentelemetrySdkAutoconfigure implementation deps.opentelemetrySdkAutoconfigure
implementation deps.opentelemetrySdkMetrics implementation deps.opentelemetrySdkMetrics
implementation(deps.opentelemetryKotlin) { 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.opentelemetryExtAws implementation deps.opentelemetryExtAws
implementation deps.opentelemetryTraceProps implementation deps.opentelemetryTraceProps
implementation(deps.opentelemetryResources) { implementation(deps.opentelemetryResources) {