From 846679797fbb4a576436f42ece09ae7a3ac91973 Mon Sep 17 00:00:00 2001 From: Jason Plumb Date: Tue, 7 Mar 2023 13:49:45 -0800 Subject: [PATCH 01/10] update to java 17 for GHA --- .github/workflows/ci.yaml | 24 ++++++++++++------------ .github/workflows/nightly.yaml | 24 ++++++++++++------------ .github/workflows/pr.yaml | 24 ++++++++++++------------ 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 93c4cc405..cac7246fb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -36,11 +36,11 @@ jobs: steps: - uses: actions/checkout@v3.3.0 - - name: Set up JDK 11 for running Gradle + - name: Set up JDK 17 for running Gradle uses: actions/setup-java@v3.10.0 with: - distribution: adopt - java-version: 11.0.11+9 + distribution: temurin + java-version: 17 - name: Cache Gradle Wrapper uses: actions/cache@v3.2.6 @@ -59,11 +59,11 @@ jobs: - name: Check out repository uses: actions/checkout@v3.3.0 - - name: Set up JDK 11 for running Gradle + - name: Set up JDK 17 for running Gradle uses: actions/setup-java@v3.10.0 with: - distribution: adopt - java-version: 11.0.11+9 + distribution: temurin + java-version: 17 - name: Cache Gradle Wrapper uses: actions/cache@v3.2.6 @@ -84,11 +84,11 @@ jobs: - name: Check out repository uses: actions/checkout@v3.3.0 - - name: Set up JDK 11 for running Gradle + - name: Set up JDK 17 for running Gradle uses: actions/setup-java@v3.10.0 with: - distribution: adopt - java-version: 11.0.11+9 + distribution: temurin + java-version: 17 - name: Cache Gradle Wrapper uses: actions/cache@v3.2.6 @@ -122,11 +122,11 @@ jobs: steps: - uses: actions/checkout@v3.3.0 - - name: Set up JDK 11 for running Gradle + - name: Set up JDK 17 for running Gradle uses: actions/setup-java@v3.10.0 with: - distribution: adopt - java-version: 11.0.11+9 + distribution: temurin + java-version: 17 - name: Cache Gradle Wrapper uses: actions/cache@v3.2.6 diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index 9b79d797e..450b71ddd 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -11,11 +11,11 @@ jobs: steps: - uses: actions/checkout@v3.3.0 - - name: Set up JDK 11 for running Gradle + - name: Set up JDK 17 for running Gradle uses: actions/setup-java@v3.10.0 with: - distribution: adopt - java-version: 11.0.11+9 + distribution: temurin + java-version: 17 - name: Cache Gradle Wrapper uses: actions/cache@v3.2.6 @@ -34,11 +34,11 @@ jobs: - name: Check out repository uses: actions/checkout@v3.3.0 - - name: Set up JDK 11 for running Gradle + - name: Set up JDK 17 for running Gradle uses: actions/setup-java@v3.10.0 with: - distribution: adopt - java-version: 11.0.11+9 + distribution: temurin + java-version: 17 - name: Cache Gradle Wrapper uses: actions/cache@v3.2.6 @@ -59,11 +59,11 @@ jobs: - name: Check out repository uses: actions/checkout@v3.3.0 - - name: Set up JDK 11 for running Gradle + - name: Set up JDK 17 for running Gradle uses: actions/setup-java@v3.10.0 with: - distribution: adopt - java-version: 11.0.11+9 + distribution: temurin + java-version: 17 - name: Cache Gradle Wrapper uses: actions/cache@v3.2.6 @@ -97,11 +97,11 @@ jobs: steps: - uses: actions/checkout@v3.3.0 - - name: Set up JDK 11 for running Gradle + - name: Set up JDK 17 for running Gradle uses: actions/setup-java@v3.10.0 with: - distribution: adopt - java-version: 11.0.11+9 + distribution: temurin + java-version: 17 - name: Cache Gradle Wrapper uses: actions/cache@v3.2.6 diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 86b17178a..61a8bbe67 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -33,11 +33,11 @@ jobs: steps: - uses: actions/checkout@v3.3.0 - - name: Set up JDK 11 for running Gradle + - name: Set up JDK 17 for running Gradle uses: actions/setup-java@v3.10.0 with: - distribution: adopt - java-version: 11.0.11+9 + distribution: temurin + java-version: 17 - name: Cache Gradle Wrapper uses: actions/cache@v3.2.6 @@ -56,11 +56,11 @@ jobs: - name: Check out repository uses: actions/checkout@v3.3.0 - - name: Set up JDK 11 for running Gradle + - name: Set up JDK 17 for running Gradle uses: actions/setup-java@v3.10.0 with: - distribution: adopt - java-version: 11.0.11+9 + distribution: temurin + java-version: 17 - name: Cache Gradle Wrapper uses: actions/cache@v3.2.6 @@ -81,11 +81,11 @@ jobs: - name: Check out repository uses: actions/checkout@v3.3.0 - - name: Set up JDK 11 for running Gradle + - name: Set up JDK 17 for running Gradle uses: actions/setup-java@v3.10.0 with: - distribution: adopt - java-version: 11.0.11+9 + distribution: temurin + java-version: 17 - name: Cache Gradle Wrapper uses: actions/cache@v3.2.6 @@ -119,11 +119,11 @@ jobs: steps: - uses: actions/checkout@v3.3.0 - - name: Set up JDK 11 for running Gradle + - name: Set up JDK 17 for running Gradle uses: actions/setup-java@v3.10.0 with: - distribution: adopt - java-version: 11.0.11+9 + distribution: temurin + java-version: 17 - name: Cache Gradle Wrapper uses: actions/cache@v3.2.6 From 88b8ce04621deff46aad0c67ea936f643cf57400 Mon Sep 17 00:00:00 2001 From: Jason Plumb Date: Tue, 7 Mar 2023 16:34:09 -0800 Subject: [PATCH 02/10] upgrade gradle to 8.0.2 --- .../kotlin/splunk.java-conventions.gradle.kts | 16 +++++++++++++--- gradle/wrapper/gradle-wrapper.properties | 3 ++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/buildSrc/src/main/kotlin/splunk.java-conventions.gradle.kts b/buildSrc/src/main/kotlin/splunk.java-conventions.gradle.kts index 70420f1eb..b9cce0014 100644 --- a/buildSrc/src/main/kotlin/splunk.java-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/splunk.java-conventions.gradle.kts @@ -9,11 +9,21 @@ repositories { } } evaluationDependsOn(":dependencyManagement") +val dependencyManagementConf = configurations.create("dependencyManagement") { + isCanBeConsumed = false + isCanBeResolved = false + isVisible = false +} +afterEvaluate { + configurations.configureEach { + if (isCanBeResolved && !isCanBeConsumed) { + extendsFrom(dependencyManagementConf) + } + } +} dependencies { - for (conf in configurations) { - add(conf.name, platform(project(":dependencyManagement"))) - } + add(dependencyManagementConf.name, platform(project(":dependencyManagement"))) add("testImplementation", "org.assertj:assertj-core") add("testImplementation", "org.awaitility:awaitility") add("testImplementation", "org.mockito:mockito-core") diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 070cb702f..2951164c7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionSha256Sum=ff7bf6a86f09b9b2c40bb8f48b25fc19cf2b2664fd1d220cd7ab833ec758d0d7 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 6ef4f7214c5265028b9c9cd6a8fa696ec71cfda2 Mon Sep 17 00:00:00 2001 From: Jason Plumb Date: Tue, 7 Mar 2023 16:36:13 -0800 Subject: [PATCH 03/10] upgrade nexus publish --- settings.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index 16a6eae08..56e046fc9 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,7 +2,7 @@ pluginManagement { plugins { id("com.bmuschko.docker-remote-api") version "9.2.1" id("com.github.johnrengelman.shadow") version "7.1.2" - id("io.github.gradle-nexus.publish-plugin") version "1.2.0" + id("io.github.gradle-nexus.publish-plugin") version "1.3.0" id("nebula.release") version "17.2.0" id("org.unbroken-dome.test-sets") version "4.0.0" } From 8fd5d7c2b788cec65eba2577bd1f10c90aee1f19 Mon Sep 17 00:00:00 2001 From: Jason Plumb Date: Tue, 7 Mar 2023 16:41:02 -0800 Subject: [PATCH 04/10] upgrade shadow jar version --- buildSrc/build.gradle.kts | 2 +- settings.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 1616960db..4c9a62b99 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -43,5 +43,5 @@ dependencies { implementation("io.spring.gradle:dependency-management-plugin:1.1.0") // keep these versions in sync with settings.gradle.kts - implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.2") + implementation("gradle.plugin.com.github.johnrengelman:shadow:8.0.0") } diff --git a/settings.gradle.kts b/settings.gradle.kts index 56e046fc9..d556fe21c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,7 +1,7 @@ pluginManagement { plugins { id("com.bmuschko.docker-remote-api") version "9.2.1" - id("com.github.johnrengelman.shadow") version "7.1.2" + id("com.github.johnrengelman.shadow") version "8.1.0" id("io.github.gradle-nexus.publish-plugin") version "1.3.0" id("nebula.release") version "17.2.0" id("org.unbroken-dome.test-sets") version "4.0.0" From f7c4aa3d038cce5154e2d1811c33e2a2de58bc7d Mon Sep 17 00:00:00 2001 From: Jason Plumb Date: Tue, 7 Mar 2023 16:42:47 -0800 Subject: [PATCH 05/10] update protobuf-bom --- dependencyManagement/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencyManagement/build.gradle.kts b/dependencyManagement/build.gradle.kts index cf4399404..e6302a7a0 100644 --- a/dependencyManagement/build.gradle.kts +++ b/dependencyManagement/build.gradle.kts @@ -28,7 +28,7 @@ dependencies { // BOMs api(enforcedPlatform("com.fasterxml.jackson:jackson-bom:2.14.2")) - api(enforcedPlatform("com.google.protobuf:protobuf-bom:3.21.12")) + api(enforcedPlatform("com.google.protobuf:protobuf-bom:3.22.0")) api(enforcedPlatform("com.squareup.okhttp3:okhttp-bom:4.10.0")) api(enforcedPlatform("io.grpc:grpc-bom:1.53.0")) api(platform("io.micrometer:micrometer-bom:$micrometerVersion")) From cae1fcfa7f6ba3c09f360ac22ed4ee4c1b742d0d Mon Sep 17 00:00:00 2001 From: Jason Plumb Date: Tue, 7 Mar 2023 16:48:08 -0800 Subject: [PATCH 06/10] update proto --- profiler/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiler/build.gradle.kts b/profiler/build.gradle.kts index 0f9ff1949..ce137ac3f 100644 --- a/profiler/build.gradle.kts +++ b/profiler/build.gradle.kts @@ -3,7 +3,7 @@ plugins { id("com.google.protobuf") version "0.9.2" } -val protobufVersion = "3.21.12" +val protobufVersion = "3.22.0" protobuf { protoc { From 66aa297f235008df1d4ab3ff5e7c6cd96555ef9a Mon Sep 17 00:00:00 2001 From: jason plumb <75337021+breedx-splk@users.noreply.github.com> Date: Wed, 8 Mar 2023 08:15:58 -0800 Subject: [PATCH 07/10] Update buildSrc/build.gradle.kts Co-authored-by: Mateusz Rzeszutek --- buildSrc/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 4c9a62b99..3fc44336b 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -43,5 +43,5 @@ dependencies { implementation("io.spring.gradle:dependency-management-plugin:1.1.0") // keep these versions in sync with settings.gradle.kts - implementation("gradle.plugin.com.github.johnrengelman:shadow:8.0.0") + implementation("gradle.plugin.com.github.johnrengelman:shadow:8.1.0") } From d225d4e2c8e1c97040d676d49cd33e552cd07f63 Mon Sep 17 00:00:00 2001 From: Jason Plumb Date: Wed, 8 Mar 2023 08:32:15 -0800 Subject: [PATCH 08/10] revert --- buildSrc/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 3fc44336b..4c9a62b99 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -43,5 +43,5 @@ dependencies { implementation("io.spring.gradle:dependency-management-plugin:1.1.0") // keep these versions in sync with settings.gradle.kts - implementation("gradle.plugin.com.github.johnrengelman:shadow:8.1.0") + implementation("gradle.plugin.com.github.johnrengelman:shadow:8.0.0") } From 4afe16cb79c9753f813abfb30e11ede54df028c0 Mon Sep 17 00:00:00 2001 From: Mateusz Rzeszutek Date: Wed, 8 Mar 2023 16:18:06 +0100 Subject: [PATCH 09/10] Remove test sets plugin --- .../micrometer-testing/build.gradle.kts | 52 ++++++++++++------- settings.gradle.kts | 1 - 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/instrumentation/micrometer-testing/build.gradle.kts b/instrumentation/micrometer-testing/build.gradle.kts index 214bc4043..a2e1a68a2 100644 --- a/instrumentation/micrometer-testing/build.gradle.kts +++ b/instrumentation/micrometer-testing/build.gradle.kts @@ -1,38 +1,50 @@ plugins { id("splunk.instrumentation-conventions") - id("org.unbroken-dome.test-sets") -} - -testSets { - (3..10).forEach { ver -> - create("version1${ver}Test") { - dirName = "test" - } - } } dependencies { testInstrumentation(project(":instrumentation:micrometer-1.3")) testInstrumentation(project(":instrumentation:micrometer-1.5")) - add("version13TestImplementation", "io.micrometer:micrometer-core:1.3.16") - add("version14TestImplementation", "io.micrometer:micrometer-core:1.4.2") - add("version15TestImplementation", "io.micrometer:micrometer-core:1.5.17") - add("version16TestImplementation", "io.micrometer:micrometer-core:1.6.12") - add("version17TestImplementation", "io.micrometer:micrometer-core:1.7.5") - add("version18TestImplementation", "io.micrometer:micrometer-core:1.8.11") - add("version19TestImplementation", "io.micrometer:micrometer-core:1.9.5") - add("version110TestImplementation", "io.micrometer:micrometer-core:1.10.3") // use the agent (latest) micrometer version in the default test task testImplementation("io.micrometer:micrometer-core") } -tasks { - test { +testing { + suites { (3..10).forEach { ver -> - dependsOn(named("version1${ver}Test")) + register("version1_${ver}Test") { + sources { + java { + setSrcDirs(listOf("src/test/java")) + } + } + dependencies { + implementation("io.micrometer:micrometer-core:1.$ver.+") + + implementation(project(":testing:common")) + implementation("org.assertj:assertj-core") + } + + targets { + all { + testTask.configure { + jvmArgs("-Dsplunk.metrics.enabled=true") + + // set some global metrics tags for testing javaagent + jvmArgs("-Dsplunk.testing.metrics.global-tags=food=cheesecake") + } + } + } + } } } +} + +tasks { + check { + dependsOn(testing.suites) + } withType { jvmArgs("-Dsplunk.metrics.enabled=true") diff --git a/settings.gradle.kts b/settings.gradle.kts index d556fe21c..5dd0870e3 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,7 +4,6 @@ pluginManagement { id("com.github.johnrengelman.shadow") version "8.1.0" id("io.github.gradle-nexus.publish-plugin") version "1.3.0" id("nebula.release") version "17.2.0" - id("org.unbroken-dome.test-sets") version "4.0.0" } } From 1165d18cea9f4c79ebe021d350a0a4b7b3ca360d Mon Sep 17 00:00:00 2001 From: Mateusz Rzeszutek Date: Wed, 8 Mar 2023 17:30:52 +0100 Subject: [PATCH 10/10] fix khttp test --- instrumentation/khttp-0.1/build.gradle.kts | 7 +++++++ .../khttp/KHttpHttpClientHttpAttributesGetter.java | 8 ++++++-- .../instrumentation/khttp/KHttpSingletons.java | 7 ++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/instrumentation/khttp-0.1/build.gradle.kts b/instrumentation/khttp-0.1/build.gradle.kts index ba7bf03c8..da1585a88 100644 --- a/instrumentation/khttp-0.1/build.gradle.kts +++ b/instrumentation/khttp-0.1/build.gradle.kts @@ -25,3 +25,10 @@ dependencies { testRuntimeOnly("org.junit.vintage:junit-vintage-engine") } + +tasks.withType().configureEach { + // required on jdk17 + jvmArgs("--add-opens=java.base/java.net=ALL-UNNAMED") + jvmArgs("--add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED") + jvmArgs("-XX:+IgnoreUnrecognizedVMOptions") +} diff --git a/instrumentation/khttp-0.1/src/main/java/com/splunk/opentelemetry/instrumentation/khttp/KHttpHttpClientHttpAttributesGetter.java b/instrumentation/khttp-0.1/src/main/java/com/splunk/opentelemetry/instrumentation/khttp/KHttpHttpClientHttpAttributesGetter.java index 76fffcb4d..0a30b36fb 100644 --- a/instrumentation/khttp-0.1/src/main/java/com/splunk/opentelemetry/instrumentation/khttp/KHttpHttpClientHttpAttributesGetter.java +++ b/instrumentation/khttp-0.1/src/main/java/com/splunk/opentelemetry/instrumentation/khttp/KHttpHttpClientHttpAttributesGetter.java @@ -22,6 +22,8 @@ import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesGetter; import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; import khttp.responses.Response; import org.jetbrains.annotations.Nullable; @@ -47,8 +49,10 @@ public String getMethod(RequestWrapper requestWrapper) { @Override public List getRequestHeader(RequestWrapper requestWrapper, String name) { - String header = requestWrapper.headers.get(name); - return header != null ? singletonList(header) : emptyList(); + return requestWrapper.headers.entrySet().stream() + .filter(e -> e.getKey().equalsIgnoreCase(name)) + .map(Map.Entry::getValue) + .collect(Collectors.toList()); } @Override diff --git a/instrumentation/khttp-0.1/src/main/java/com/splunk/opentelemetry/instrumentation/khttp/KHttpSingletons.java b/instrumentation/khttp-0.1/src/main/java/com/splunk/opentelemetry/instrumentation/khttp/KHttpSingletons.java index 3149e099d..b1fe3e340 100644 --- a/instrumentation/khttp-0.1/src/main/java/com/splunk/opentelemetry/instrumentation/khttp/KHttpSingletons.java +++ b/instrumentation/khttp-0.1/src/main/java/com/splunk/opentelemetry/instrumentation/khttp/KHttpSingletons.java @@ -23,7 +23,6 @@ import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientMetrics; import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanNameExtractor; import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanStatusExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.net.NetClientAttributesExtractor; import io.opentelemetry.instrumentation.api.instrumenter.net.PeerServiceAttributesExtractor; import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; import khttp.responses.Response; @@ -46,8 +45,10 @@ public final class KHttpSingletons { HttpSpanNameExtractor.create(httpAttributesGetter)) .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter)) .addAttributesExtractor( - HttpClientAttributesExtractor.create(httpAttributesGetter, netAttributesGetter)) - .addAttributesExtractor(NetClientAttributesExtractor.create(netAttributesGetter)) + HttpClientAttributesExtractor.builder(httpAttributesGetter, netAttributesGetter) + .setCapturedRequestHeaders(CommonConfig.get().getClientRequestHeaders()) + .setCapturedResponseHeaders(CommonConfig.get().getClientResponseHeaders()) + .build()) .addAttributesExtractor( PeerServiceAttributesExtractor.create( netAttributesGetter, CommonConfig.get().getPeerServiceMapping()))