Skip to content

Commit f50dbb8

Browse files
committed
batch 1
1 parent 136efcb commit f50dbb8

File tree

10 files changed

+193
-85
lines changed

10 files changed

+193
-85
lines changed

instrumentation-api-incubator/build.gradle.kts

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,30 @@ dependencies {
2828
testImplementation("io.opentelemetry:opentelemetry-sdk-extension-incubator")
2929
}
3030

31+
testing {
32+
suites {
33+
val testStableSemconv by registering(JvmTestSuite::class) {
34+
targets {
35+
all {
36+
testTask.configure {
37+
jvmArgs("-Dotel.semconv-stability.opt-in=database,code")
38+
}
39+
}
40+
}
41+
}
42+
43+
val testBothSemconv by registering(JvmTestSuite::class) {
44+
targets {
45+
all {
46+
testTask.configure {
47+
jvmArgs("-Dotel.semconv-stability.opt-in=database/dup,code/dup")
48+
}
49+
}
50+
}
51+
}
52+
}
53+
}
54+
3155
tasks {
3256
// exclude auto-generated code
3357
named<Checkstyle>("checkstyleMain") {
@@ -45,16 +69,8 @@ tasks {
4569
dependsOn("generateJflex")
4670
}
4771

48-
val testStableSemconv by registering(Test::class) {
49-
jvmArgs("-Dotel.semconv-stability.opt-in=database,code")
50-
}
51-
52-
val testBothSemconv by registering(Test::class) {
53-
jvmArgs("-Dotel.semconv-stability.opt-in=database/dup,code/dup")
54-
}
55-
5672
check {
57-
dependsOn(testStableSemconv)
58-
dependsOn(testBothSemconv)
73+
dependsOn(testing.suites.named("testStableSemconv"))
74+
dependsOn(testing.suites.named("testBothSemconv"))
5975
}
6076
}

instrumentation/spring/spring-batch-3.0/javaagent/build.gradle.kts

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,40 @@ dependencies {
2424
latestDepTestLibrary("org.springframework.batch:spring-batch-core:4.+") // documented limitation
2525
}
2626

27-
tasks {
28-
val testChunkRootSpan by registering(Test::class) {
29-
filter {
30-
includeTestsMatching("*ChunkRootSpanTest")
27+
testing {
28+
suites {
29+
val testChunkRootSpan by registering(JvmTestSuite::class) {
30+
targets {
31+
all {
32+
testTask.configure {
33+
filter {
34+
includeTestsMatching("*ChunkRootSpanTest")
35+
}
36+
include("**/*ChunkRootSpanTest.*")
37+
jvmArgs("-Dotel.instrumentation.spring-batch.experimental.chunk.new-trace=true")
38+
}
39+
}
40+
}
3141
}
32-
include("**/*ChunkRootSpanTest.*")
33-
jvmArgs("-Dotel.instrumentation.spring-batch.experimental.chunk.new-trace=true")
34-
}
3542

36-
val testItemLevelSpan by registering(Test::class) {
37-
filter {
38-
includeTestsMatching("*ItemLevelSpanTest")
39-
includeTestsMatching("*CustomSpanEventTest")
43+
val testItemLevelSpan by registering(JvmTestSuite::class) {
44+
targets {
45+
all {
46+
testTask.configure {
47+
filter {
48+
includeTestsMatching("*ItemLevelSpanTest")
49+
includeTestsMatching("*CustomSpanEventTest")
50+
}
51+
include("**/*ItemLevelSpanTest.*", "**/*CustomSpanEventTest.*")
52+
jvmArgs("-Dotel.instrumentation.spring-batch.item.enabled=true")
53+
}
54+
}
55+
}
4056
}
41-
include("**/*ItemLevelSpanTest.*", "**/*CustomSpanEventTest.*")
42-
jvmArgs("-Dotel.instrumentation.spring-batch.item.enabled=true")
4357
}
58+
}
4459

60+
tasks {
4561
test {
4662
filter {
4763
excludeTestsMatching("*ChunkRootSpanTest")
@@ -54,8 +70,8 @@ tasks {
5470
}
5571

5672
check {
57-
dependsOn(testChunkRootSpan)
58-
dependsOn(testItemLevelSpan)
73+
dependsOn(testing.suites.named("testChunkRootSpan"))
74+
dependsOn(testing.suites.named("testItemLevelSpan"))
5975
}
6076

6177
withType<Test>().configureEach {

instrumentation/spring/spring-boot-autoconfigure/build.gradle.kts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,16 @@ testing {
174174
}
175175
}
176176
}
177+
178+
val testStableSemconv by registering(JvmTestSuite::class) {
179+
targets {
180+
all {
181+
testTask.configure {
182+
jvmArgs("-Dotel.semconv-stability.opt-in=database")
183+
}
184+
}
185+
}
186+
}
177187
}
178188
}
179189

@@ -220,12 +230,7 @@ tasks {
220230
from(sourceSets["javaSpring3"].java)
221231
}
222232

223-
val testStableSemconv by registering(Test::class) {
224-
jvmArgs("-Dotel.semconv-stability.opt-in=database")
225-
}
226-
227233
check {
228234
dependsOn(testing.suites)
229-
dependsOn(testStableSemconv)
230235
}
231236
}

instrumentation/spring/spring-data/spring-data-1.8/javaagent/build.gradle.kts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,21 @@ dependencies {
4545
latestDepTestLibrary("org.springframework:spring-test:5.+") // see spring-data-3.0:testing module
4646
}
4747

48+
testing {
49+
suites {
50+
val testStableSemconv by registering(JvmTestSuite::class) {
51+
targets {
52+
all {
53+
testTask.configure {
54+
jvmArgs("-Dotel.semconv-stability.opt-in=database")
55+
systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database")
56+
}
57+
}
58+
}
59+
}
60+
}
61+
}
62+
4863
tasks {
4964
withType<Test>().configureEach {
5065
jvmArgs("--add-opens=java.base/java.lang.invoke=ALL-UNNAMED")
@@ -55,12 +70,7 @@ tasks {
5570
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
5671
}
5772

58-
val testStableSemconv by registering(Test::class) {
59-
jvmArgs("-Dotel.semconv-stability.opt-in=database")
60-
systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database")
61-
}
62-
6373
check {
64-
dependsOn(testStableSemconv)
74+
dependsOn(testing.suites.named("testStableSemconv"))
6575
}
6676
}

instrumentation/spring/spring-data/spring-data-3.0/testing/build.gradle.kts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ testing {
3636
implementation("com.h2database:h2:1.4.197")
3737
}
3838
}
39+
40+
val testStableSemconv by registering(JvmTestSuite::class) {
41+
targets {
42+
all {
43+
testTask.configure {
44+
jvmArgs("-Dotel.semconv-stability.opt-in=database")
45+
}
46+
}
47+
}
48+
}
3949
}
4050
}
4151

@@ -47,12 +57,7 @@ tasks {
4757
jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true")
4858
}
4959

50-
val testStableSemconv by registering(Test::class) {
51-
jvmArgs("-Dotel.semconv-stability.opt-in=database")
52-
}
53-
5460
check {
5561
dependsOn(testing.suites)
56-
dependsOn(testStableSemconv)
5762
}
5863
}

instrumentation/spring/spring-integration-4.1/javaagent/build.gradle.kts

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,28 +40,44 @@ dependencies {
4040
latestDepTestLibrary("org.springframework.cloud:spring-cloud-stream-binder-rabbit:3.+") // documented limitation
4141
}
4242

43-
tasks {
44-
val testWithRabbitInstrumentation by registering(Test::class) {
45-
filter {
46-
includeTestsMatching("SpringIntegrationAndRabbitTest")
43+
testing {
44+
suites {
45+
val testWithRabbitInstrumentation by registering(JvmTestSuite::class) {
46+
targets {
47+
all {
48+
testTask.configure {
49+
filter {
50+
includeTestsMatching("SpringIntegrationAndRabbitTest")
51+
}
52+
include("**/SpringIntegrationAndRabbitTest.*")
53+
jvmArgs("-Dotel.instrumentation.rabbitmq.enabled=true")
54+
jvmArgs("-Dotel.instrumentation.spring-rabbit.enabled=true")
55+
systemProperty("metadataConfig", "otel.instrumentation.spring-rabbit.enabled=true")
56+
}
57+
}
58+
}
4759
}
48-
include("**/SpringIntegrationAndRabbitTest.*")
49-
jvmArgs("-Dotel.instrumentation.rabbitmq.enabled=true")
50-
jvmArgs("-Dotel.instrumentation.spring-rabbit.enabled=true")
51-
systemProperty("metadataConfig", "otel.instrumentation.spring-rabbit.enabled=true")
52-
}
5360

54-
val testWithProducerInstrumentation by registering(Test::class) {
55-
filter {
56-
includeTestsMatching("SpringCloudStreamProducerTest")
61+
val testWithProducerInstrumentation by registering(JvmTestSuite::class) {
62+
targets {
63+
all {
64+
testTask.configure {
65+
filter {
66+
includeTestsMatching("SpringCloudStreamProducerTest")
67+
}
68+
include("**/SpringCloudStreamProducerTest.*")
69+
jvmArgs("-Dotel.instrumentation.rabbitmq.enabled=false")
70+
jvmArgs("-Dotel.instrumentation.spring-rabbit.enabled=false")
71+
jvmArgs("-Dotel.instrumentation.spring-integration.producer.enabled=true")
72+
systemProperty("metadataConfig", "otel.instrumentation.spring-integration.producer.enabled=true")
73+
}
74+
}
75+
}
5776
}
58-
include("**/SpringCloudStreamProducerTest.*")
59-
jvmArgs("-Dotel.instrumentation.rabbitmq.enabled=false")
60-
jvmArgs("-Dotel.instrumentation.spring-rabbit.enabled=false")
61-
jvmArgs("-Dotel.instrumentation.spring-integration.producer.enabled=true")
62-
systemProperty("metadataConfig", "otel.instrumentation.spring-integration.producer.enabled=true")
6377
}
78+
}
6479

80+
tasks {
6581
test {
6682
filter {
6783
excludeTestsMatching("SpringIntegrationAndRabbitTest")
@@ -72,8 +88,8 @@ tasks {
7288
}
7389

7490
check {
75-
dependsOn(testWithRabbitInstrumentation)
76-
dependsOn(testWithProducerInstrumentation)
91+
dependsOn(testing.suites.named("testWithRabbitInstrumentation"))
92+
dependsOn(testing.suites.named("testWithProducerInstrumentation"))
7793
}
7894

7995
withType<Test>().configureEach {

instrumentation/spring/spring-jms/spring-jms-6.0/javaagent/build.gradle.kts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,29 @@ otelJava {
3434
minJavaVersionSupported.set(JavaVersion.VERSION_17)
3535
}
3636

37+
testing {
38+
suites {
39+
val testReceiveSpansDisabled by registering(JvmTestSuite::class) {
40+
targets {
41+
all {
42+
testTask.configure {
43+
filter {
44+
includeTestsMatching("SpringListenerSuppressReceiveSpansTest")
45+
}
46+
include("**/SpringListenerSuppressReceiveSpansTest.*")
47+
}
48+
}
49+
}
50+
}
51+
}
52+
}
53+
3754
tasks {
3855
withType<Test>().configureEach {
3956
usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service)
4057
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
4158
}
4259

43-
val testReceiveSpansDisabled by registering(Test::class) {
44-
filter {
45-
includeTestsMatching("SpringListenerSuppressReceiveSpansTest")
46-
}
47-
include("**/SpringListenerSuppressReceiveSpansTest.*")
48-
}
49-
5060
test {
5161
filter {
5262
excludeTestsMatching("SpringListenerSuppressReceiveSpansTest")
@@ -55,6 +65,6 @@ tasks {
5565
}
5666

5767
check {
58-
dependsOn(testReceiveSpansDisabled)
68+
dependsOn(testing.suites.named("testReceiveSpansDisabled"))
5969
}
6070
}

instrumentation/spring/spring-scheduling-3.1/javaagent/build.gradle.kts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ dependencies {
2020
testLibrary("org.springframework:spring-context:3.2.3.RELEASE")
2121
}
2222

23+
testing {
24+
suites {
25+
val testExperimental by registering(JvmTestSuite::class) {
26+
targets {
27+
all {
28+
testTask.configure {
29+
jvmArgs("-Dotel.instrumentation.spring-scheduling.experimental-span-attributes=true")
30+
systemProperty("metadataConfig", "otel.instrumentation.spring-scheduling.experimental-span-attributes=true")
31+
}
32+
}
33+
}
34+
}
35+
}
36+
}
37+
2338
tasks {
2439
withType<Test>().configureEach {
2540
// required on jdk17
@@ -28,11 +43,6 @@ tasks {
2843

2944
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
3045
}
31-
32-
val testExperimental by registering(Test::class) {
33-
jvmArgs("-Dotel.instrumentation.spring-scheduling.experimental-span-attributes=true")
34-
systemProperty("metadataConfig", "otel.instrumentation.spring-scheduling.experimental-span-attributes=true")
35-
}
3646
}
3747

3848
val latestDepTest = findProperty("testLatestDeps") as Boolean

instrumentation/spring/spring-webmvc/spring-webmvc-3.1/javaagent/build.gradle.kts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,21 @@ dependencies {
4343
latestDepTestLibrary("org.springframework.boot:spring-boot-starter-security:2.+") // see spring-webmvc-6.0 module
4444
}
4545

46+
testing {
47+
suites {
48+
val testExperimental by registering(JvmTestSuite::class) {
49+
targets {
50+
all {
51+
testTask.configure {
52+
systemProperty("metadataConfig", "otel.instrumentation.spring-webmvc.experimental-span-attributes=true")
53+
jvmArgs("-Dotel.instrumentation.spring-webmvc.experimental-span-attributes=true")
54+
}
55+
}
56+
}
57+
}
58+
}
59+
}
60+
4661
tasks {
4762
withType<Test>().configureEach {
4863
systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
@@ -56,13 +71,8 @@ tasks {
5671
jvmArgs("-Dotel.instrumentation.common.experimental.view-telemetry.enabled=true")
5772
}
5873

59-
val testExperimental by registering(Test::class) {
60-
systemProperty("metadataConfig", "otel.instrumentation.spring-webmvc.experimental-span-attributes=true")
61-
jvmArgs("-Dotel.instrumentation.spring-webmvc.experimental-span-attributes=true")
62-
}
63-
6474
check {
65-
dependsOn(testExperimental)
75+
dependsOn(testing.suites.named("testExperimental"))
6676
}
6777
}
6878

0 commit comments

Comments
 (0)