From ac9edb0c2c09e91f70dabd8860760c7adeeddded Mon Sep 17 00:00:00 2001 From: Jason Plumb Date: Mon, 2 Oct 2023 16:33:18 -0700 Subject: [PATCH 1/5] Revert "simplify use of dependencyManagement" This reverts commit 80c11931be3e8b2dfb24c914342b0c6687b8da0c. --- auto-instrumentation/okhttp/okhttp-3.0/agent/build.gradle.kts | 1 + .../okhttp/okhttp-3.0/library/build.gradle.kts | 1 + .../okhttp/okhttp-3.0/testing/build.gradle.kts | 2 ++ .../main/kotlin/otel.android-library-conventions.gradle.kts | 4 ---- .../src/main/kotlin/otel.java-library-conventions.gradle.kts | 2 -- dependencyManagement/build.gradle.kts | 2 +- instrumentation/build.gradle.kts | 1 + 7 files changed, 6 insertions(+), 7 deletions(-) diff --git a/auto-instrumentation/okhttp/okhttp-3.0/agent/build.gradle.kts b/auto-instrumentation/okhttp/okhttp-3.0/agent/build.gradle.kts index 43fd5f5c2..5941f29f0 100644 --- a/auto-instrumentation/okhttp/okhttp-3.0/agent/build.gradle.kts +++ b/auto-instrumentation/okhttp/okhttp-3.0/agent/build.gradle.kts @@ -4,6 +4,7 @@ plugins { } dependencies { + implementation(platform(project(":dependencyManagement"))) implementation(project(":auto-instrumentation:okhttp:okhttp-3.0:library")) implementation("net.bytebuddy:byte-buddy:${property("bytebuddy.version")}") } diff --git a/auto-instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts b/auto-instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts index e12856f62..e229fe4eb 100644 --- a/auto-instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts +++ b/auto-instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts @@ -4,6 +4,7 @@ plugins { } dependencies { + implementation(platform(project(":dependencyManagement"))) // Pin at 3.0.0 for api compatibility api("com.squareup.okhttp3:okhttp:3.0.0") api("io.opentelemetry.instrumentation:opentelemetry-okhttp-3.0") diff --git a/auto-instrumentation/okhttp/okhttp-3.0/testing/build.gradle.kts b/auto-instrumentation/okhttp/okhttp-3.0/testing/build.gradle.kts index e0521004a..96e1d433c 100644 --- a/auto-instrumentation/okhttp/okhttp-3.0/testing/build.gradle.kts +++ b/auto-instrumentation/okhttp/okhttp-3.0/testing/build.gradle.kts @@ -4,6 +4,8 @@ plugins { } dependencies { + implementation(platform(project(":dependencyManagement"))) + byteBuddy(project(":auto-instrumentation:okhttp:okhttp-3.0:agent")) implementation(project(":auto-instrumentation:okhttp:okhttp-3.0:library")) implementation("com.squareup.okhttp3:okhttp") diff --git a/buildSrc/src/main/kotlin/otel.android-library-conventions.gradle.kts b/buildSrc/src/main/kotlin/otel.android-library-conventions.gradle.kts index 9d410d849..f34b90f58 100644 --- a/buildSrc/src/main/kotlin/otel.android-library-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/otel.android-library-conventions.gradle.kts @@ -25,8 +25,4 @@ android { sourceCompatibility(javaVersion) targetCompatibility(javaVersion) } - - dependencies { - implementation(platform(project(":dependencyManagement"))) - } } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/otel.java-library-conventions.gradle.kts b/buildSrc/src/main/kotlin/otel.java-library-conventions.gradle.kts index f87592e7b..1628d9a27 100644 --- a/buildSrc/src/main/kotlin/otel.java-library-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/otel.java-library-conventions.gradle.kts @@ -1,4 +1,3 @@ -import gradle.kotlin.dsl.accessors._98848321c7233c2f7fb697478033dcb2.implementation import ru.vyarus.gradle.plugin.animalsniffer.AnimalSniffer plugins { @@ -14,7 +13,6 @@ java { } dependencies { - implementation(platform(project(":dependencyManagement"))) signature("com.toasttab.android:gummy-bears-api-${project.property("android.minSdk")}:0.5.1:coreLib@signature") implementation("com.google.code.findbugs:jsr305:3.0.2") } diff --git a/dependencyManagement/build.gradle.kts b/dependencyManagement/build.gradle.kts index a52d90ff9..e3b5d3d9c 100644 --- a/dependencyManagement/build.gradle.kts +++ b/dependencyManagement/build.gradle.kts @@ -40,7 +40,7 @@ dependencies { api(enforcedPlatform("org.junit:junit-bom:$junitVersion")) api(enforcedPlatform("io.opentelemetry:opentelemetry-bom-alpha:$otelSdkAlphaVersion")) api(enforcedPlatform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:$otelInstrumentationAlphaVersion")) - api(platform("com.squareup.okhttp3:okhttp-bom:$okhttpVersion")) + api(enforcedPlatform("com.squareup.okhttp3:okhttp-bom:$okhttpVersion")) constraints { api("androidx.appcompat:appcompat:$appCompatVersion") diff --git a/instrumentation/build.gradle.kts b/instrumentation/build.gradle.kts index ba06abcfb..cd5c9e0bc 100644 --- a/instrumentation/build.gradle.kts +++ b/instrumentation/build.gradle.kts @@ -58,6 +58,7 @@ android { } dependencies { + implementation(platform(project(":dependencyManagement"))) implementation("androidx.appcompat:appcompat") implementation("androidx.core:core") From 31eb974803fb9a1c1e50424365334ddcb998350d Mon Sep 17 00:00:00 2001 From: Jason Plumb Date: Mon, 2 Oct 2023 16:33:19 -0700 Subject: [PATCH 2/5] Revert "pin okhttp to 3.0.0" This reverts commit 1f25db0e7a209c290342672c9da074b32b69e80d. --- .../okhttp/okhttp-3.0/library/build.gradle.kts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/auto-instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts b/auto-instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts index e229fe4eb..308572073 100644 --- a/auto-instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts +++ b/auto-instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts @@ -5,8 +5,7 @@ plugins { dependencies { implementation(platform(project(":dependencyManagement"))) - // Pin at 3.0.0 for api compatibility - api("com.squareup.okhttp3:okhttp:3.0.0") + api("com.squareup.okhttp3:okhttp") api("io.opentelemetry.instrumentation:opentelemetry-okhttp-3.0") implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv") } From fd6b708e1a8c884f8a8b4b32108bcf403a357baf Mon Sep 17 00:00:00 2001 From: Jason Plumb Date: Mon, 2 Oct 2023 16:34:26 -0700 Subject: [PATCH 3/5] Revert "This adds a dependencyManagement module to help consolidate dependencies across the project into one consistent place." This reverts commit c949cfa3ea4f308e6ce372eff792a2f0ef2daeda. --- .../okhttp/okhttp-3.0/agent/build.gradle.kts | 1 - .../okhttp-3.0/library/build.gradle.kts | 8 +-- .../v3_0/internal/OkHttp3Singletons.java | 7 +-- .../okhttp-3.0/testing/build.gradle.kts | 6 +- .../otel.android-app-conventions.gradle.kts | 7 +-- dependencyManagement/build.gradle.kts | 59 ------------------- gradle.properties | 1 + instrumentation/build.gradle.kts | 22 +++---- settings.gradle.kts | 1 - 9 files changed, 23 insertions(+), 89 deletions(-) delete mode 100644 dependencyManagement/build.gradle.kts diff --git a/auto-instrumentation/okhttp/okhttp-3.0/agent/build.gradle.kts b/auto-instrumentation/okhttp/okhttp-3.0/agent/build.gradle.kts index 5941f29f0..43fd5f5c2 100644 --- a/auto-instrumentation/okhttp/okhttp-3.0/agent/build.gradle.kts +++ b/auto-instrumentation/okhttp/okhttp-3.0/agent/build.gradle.kts @@ -4,7 +4,6 @@ plugins { } dependencies { - implementation(platform(project(":dependencyManagement"))) implementation(project(":auto-instrumentation:okhttp:okhttp-3.0:library")) implementation("net.bytebuddy:byte-buddy:${property("bytebuddy.version")}") } diff --git a/auto-instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts b/auto-instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts index 308572073..fd790245b 100644 --- a/auto-instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts +++ b/auto-instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts @@ -3,9 +3,9 @@ plugins { id("otel.publish-conventions") } +val otelVersion = project.property("otel.sdk.version") dependencies { - implementation(platform(project(":dependencyManagement"))) - api("com.squareup.okhttp3:okhttp") - api("io.opentelemetry.instrumentation:opentelemetry-okhttp-3.0") - implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv") + api("com.squareup.okhttp3:okhttp:3.0.0") + api("io.opentelemetry.instrumentation:opentelemetry-okhttp-3.0:$otelVersion-alpha") + implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv:$otelVersion-alpha") } diff --git a/auto-instrumentation/okhttp/okhttp-3.0/library/src/main/java/io/opentelemetry/instrumentation/library/okhttp/v3_0/internal/OkHttp3Singletons.java b/auto-instrumentation/okhttp/okhttp-3.0/library/src/main/java/io/opentelemetry/instrumentation/library/okhttp/v3_0/internal/OkHttp3Singletons.java index 1c3c257f4..9170fc5a1 100644 --- a/auto-instrumentation/okhttp/okhttp-3.0/library/src/main/java/io/opentelemetry/instrumentation/library/okhttp/v3_0/internal/OkHttp3Singletons.java +++ b/auto-instrumentation/okhttp/okhttp-3.0/library/src/main/java/io/opentelemetry/instrumentation/library/okhttp/v3_0/internal/OkHttp3Singletons.java @@ -11,7 +11,7 @@ import io.opentelemetry.context.Context; import io.opentelemetry.context.Scope; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; -import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientResendCount; +import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientResend; import io.opentelemetry.instrumentation.api.instrumenter.net.PeerServiceAttributesExtractor; import io.opentelemetry.instrumentation.library.okhttp.v3_0.OkHttpInstrumentationConfig; import io.opentelemetry.instrumentation.okhttp.v3_0.internal.ConnectionErrorSpanInterceptor; @@ -38,8 +38,6 @@ public final class OkHttp3Singletons { OkHttpInstrumentationConfig .getCapturedResponseHeaders()) .setKnownMethods(OkHttpInstrumentationConfig.getKnownMethods()), - builder -> - builder.setKnownMethods(OkHttpInstrumentationConfig.getKnownMethods()), singletonList( PeerServiceAttributesExtractor.create( OkHttpAttributesGetter.INSTANCE, @@ -48,8 +46,7 @@ public final class OkHttp3Singletons { public static final Interceptor CONTEXT_INTERCEPTOR = chain -> { - try (Scope ignored = - HttpClientResendCount.initialize(Context.current()).makeCurrent()) { + try (Scope ignored = HttpClientResend.initialize(Context.current()).makeCurrent()) { return chain.proceed(chain.request()); } }; diff --git a/auto-instrumentation/okhttp/okhttp-3.0/testing/build.gradle.kts b/auto-instrumentation/okhttp/okhttp-3.0/testing/build.gradle.kts index 96e1d433c..acbf889d4 100644 --- a/auto-instrumentation/okhttp/okhttp-3.0/testing/build.gradle.kts +++ b/auto-instrumentation/okhttp/okhttp-3.0/testing/build.gradle.kts @@ -4,10 +4,8 @@ plugins { } dependencies { - implementation(platform(project(":dependencyManagement"))) - byteBuddy(project(":auto-instrumentation:okhttp:okhttp-3.0:agent")) implementation(project(":auto-instrumentation:okhttp:okhttp-3.0:library")) - implementation("com.squareup.okhttp3:okhttp") - androidTestImplementation("com.squareup.okhttp3:mockwebserver:${rootProject.extra["okhttpVersion"]}") + implementation("com.squareup.okhttp3:okhttp:4.11.0") + androidTestImplementation("com.squareup.okhttp3:mockwebserver:4.11.0") } diff --git a/buildSrc/src/main/kotlin/otel.android-app-conventions.gradle.kts b/buildSrc/src/main/kotlin/otel.android-app-conventions.gradle.kts index 499a31eac..3fdc10633 100644 --- a/buildSrc/src/main/kotlin/otel.android-app-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/otel.android-app-conventions.gradle.kts @@ -23,9 +23,8 @@ android { } } +val otelVersion = rootProject.property("otel.sdk.version") dependencies { - implementation(platform(project(":dependencyManagement"))) - - androidTestImplementation("androidx.test:runner:${rootProject.extra["androidTestRunnerVersion"]}") - androidTestImplementation("io.opentelemetry:opentelemetry-sdk-testing:${rootProject.extra["otelSdkVersion"]}") + androidTestImplementation("androidx.test:runner:1.5.2") + androidTestImplementation("io.opentelemetry:opentelemetry-sdk-testing:$otelVersion") } \ No newline at end of file diff --git a/dependencyManagement/build.gradle.kts b/dependencyManagement/build.gradle.kts deleted file mode 100644 index e3b5d3d9c..000000000 --- a/dependencyManagement/build.gradle.kts +++ /dev/null @@ -1,59 +0,0 @@ -plugins { - `java-platform` -} - -val otelSdkVersion = "1.30.1" -rootProject.extra["otelSdkVersion"] = otelSdkVersion -val otelSdkAlphaVersion = otelSdkVersion.replaceFirst("(-SNAPSHOT)?$".toRegex(), "-alpha$1") -val otelInstrumentationVersion = "1.30.0" -val otelInstrumentationAlphaVersion = - otelInstrumentationVersion.replaceFirst("(-SNAPSHOT)?$".toRegex(), "-alpha$1") - -val androidTestRunnerVersion = "1.5.2" -rootProject.extra["androidTestRunnerVersion"] = androidTestRunnerVersion -val androidxCoreVersion = "1.12.0" -val androidxNavFragmentVersion = "2.7.3" -val androidxTestCoreVersion = "1.5.0" -val appCompatVersion = "1.6.1" -val asmVersion = "9.5" -val assertjVersion = "3.24.2" -val awaitilityVersion = "4.2.0" -val byteBuddyVersion = "1.14.8" -val errorProneVersion = "2.21.1" -val jmhVersion = "1.37" -val junitVersion = "5.10.0" -val mockitoVersion = "5.5.0" -val mockwebserverVersion = "4.11.0" - -val okhttpVersion = "4.11.0" -rootProject.extra["okhttpVersion"] = okhttpVersion -val roboelectricVersion = "4.10.3" -val slf4jVersion = "2.0.9" - -javaPlatform { - allowDependencies() -} - -dependencies { - - // BOMs - api(enforcedPlatform("org.junit:junit-bom:$junitVersion")) - api(enforcedPlatform("io.opentelemetry:opentelemetry-bom-alpha:$otelSdkAlphaVersion")) - api(enforcedPlatform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:$otelInstrumentationAlphaVersion")) - api(enforcedPlatform("com.squareup.okhttp3:okhttp-bom:$okhttpVersion")) - - constraints { - api("androidx.appcompat:appcompat:$appCompatVersion") - api("androidx.core:core:$androidxCoreVersion") - api("androidx.navigation:navigation-fragment:$androidxNavFragmentVersion") - - api("androidx.test:runner:$androidTestRunnerVersion") - api("androidx.test:core:$androidxTestCoreVersion") - api("org.awaitility:awaitility:$awaitilityVersion") - api("org.assertj:assertj-core:$assertjVersion") - api("org.mockito:mockito-core:$mockitoVersion") - api("org.mockito:mockito-junit-jupiter:$mockitoVersion") - api("org.robolectric:robolectric:$roboelectricVersion") - api("com.squareup.okhttp3:mockwebserver:$mockwebserverVersion") - } -} diff --git a/gradle.properties b/gradle.properties index 2ff48c411..d81a60b90 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,6 +21,7 @@ android.defaults.buildfeatures.buildconfig=true android.minSdk=21 android.targetSdk=23 android.compileSdk=34 +otel.sdk.version=1.29.0 bytebuddy.version=1.14.8 version=0.2.0 diff --git a/instrumentation/build.gradle.kts b/instrumentation/build.gradle.kts index cd5c9e0bc..f82f9f667 100644 --- a/instrumentation/build.gradle.kts +++ b/instrumentation/build.gradle.kts @@ -58,12 +58,11 @@ android { } dependencies { - implementation(platform(project(":dependencyManagement"))) - - implementation("androidx.appcompat:appcompat") - implementation("androidx.core:core") - implementation("androidx.navigation:navigation-fragment") + implementation("androidx.appcompat:appcompat:1.6.1") + implementation("androidx.core:core:1.12.0") + implementation("androidx.navigation:navigation-fragment:2.7.3") + api(platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:${property("otel.sdk.version")}-alpha")) api("io.opentelemetry:opentelemetry-api") implementation("io.opentelemetry:opentelemetry-sdk") implementation("io.opentelemetry:opentelemetry-exporter-zipkin") @@ -72,16 +71,17 @@ dependencies { implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api") implementation("io.opentelemetry:opentelemetry-semconv") - testImplementation("org.mockito:mockito-core") - testImplementation("org.mockito:mockito-junit-jupiter") + testImplementation("org.mockito:mockito-core:5.5.0") + testImplementation("org.mockito:mockito-junit-jupiter:5.5.0") + testImplementation(platform("org.junit:junit-bom:5.10.0")) testImplementation("org.junit.jupiter:junit-jupiter-api") testImplementation("org.junit.jupiter:junit-jupiter-engine") testImplementation("org.junit.vintage:junit-vintage-engine") testImplementation("io.opentelemetry:opentelemetry-sdk-testing") - testImplementation("org.robolectric:robolectric") - testImplementation("androidx.test:core") - testImplementation("org.assertj:assertj-core") - testImplementation("org.awaitility:awaitility") + testImplementation("org.robolectric:robolectric:4.10.3") + testImplementation("androidx.test:core:1.5.0") + testImplementation("org.assertj:assertj-core:3.24.2") + testImplementation("org.awaitility:awaitility:4.2.0") coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.3") } diff --git a/settings.gradle.kts b/settings.gradle.kts index 26343f463..ef1710b6d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,7 +1,6 @@ rootProject.name = "opentelemetry-android" include(":instrumentation") -include(":dependencyManagement") include(":auto-instrumentation:okhttp:okhttp-3.0:agent") include(":auto-instrumentation:okhttp:okhttp-3.0:library") include(":auto-instrumentation:okhttp:okhttp-3.0:testing") From 4755df9c737b680611eaa03f72198bc651808e90 Mon Sep 17 00:00:00 2001 From: Jason Plumb Date: Mon, 2 Oct 2023 16:40:19 -0700 Subject: [PATCH 4/5] pin okhttp and nerf renovate --- .../okhttp/okhttp-3.0/library/build.gradle.kts | 4 +++- renovate.json5 | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/auto-instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts b/auto-instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts index fd790245b..d82a90dab 100644 --- a/auto-instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts +++ b/auto-instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts @@ -5,7 +5,9 @@ plugins { val otelVersion = project.property("otel.sdk.version") dependencies { - api("com.squareup.okhttp3:okhttp:3.0.0") + // pin okhttp api at 3.0.0 for now + //noinspection GradleDependency + compileOnly("com.squareup.okhttp3:okhttp:3.0.0") api("io.opentelemetry.instrumentation:opentelemetry-okhttp-3.0:$otelVersion-alpha") implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv:$otelVersion-alpha") } diff --git a/renovate.json5 b/renovate.json5 index 7e8202bcb..10f24e142 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -18,6 +18,12 @@ "matchUpdateTypes": ["major", "minor"], "enabled": false }, + { + // pin okhttp at 3.0.0 for api compatibility + "matchPackageNames": ["com.squareup.okhttp3:okhttp"], + "matchUpdateTypes": ["major", "minor"], + "enabled": false + }, { // somehow renovate gets confused by the android property in gradle.properties, // so let's just exclude it and hopefully clean up the dashboard From 3b2958607378b54fce85a1c3e40dbf223a5cf6a8 Mon Sep 17 00:00:00 2001 From: Jason Plumb Date: Tue, 3 Oct 2023 08:23:11 -0700 Subject: [PATCH 5/5] the agent module requires an implementation in order to apply at build-time --- auto-instrumentation/okhttp/okhttp-3.0/agent/build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/auto-instrumentation/okhttp/okhttp-3.0/agent/build.gradle.kts b/auto-instrumentation/okhttp/okhttp-3.0/agent/build.gradle.kts index 43fd5f5c2..ca8d84e4f 100644 --- a/auto-instrumentation/okhttp/okhttp-3.0/agent/build.gradle.kts +++ b/auto-instrumentation/okhttp/okhttp-3.0/agent/build.gradle.kts @@ -4,6 +4,7 @@ plugins { } dependencies { + implementation("com.squareup.okhttp3:okhttp:4.11.0") implementation(project(":auto-instrumentation:okhttp:okhttp-3.0:library")) implementation("net.bytebuddy:byte-buddy:${property("bytebuddy.version")}") }