-
Notifications
You must be signed in to change notification settings - Fork 879
/
Copy pathbuild.gradle.kts
97 lines (84 loc) · 2.96 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
plugins {
id("otel.javaagent-instrumentation")
}
muzzle {
pass {
group.set("org.apache.logging.log4j")
module.set("log4j-core")
versions.set("[2.17.0,)")
assertInverse.set(true)
}
}
dependencies {
library("org.apache.logging.log4j:log4j-core:2.17.0")
implementation(project(":instrumentation:log4j:log4j-context-data:log4j-context-data-2.17:library-autoconfigure"))
testInstrumentation(project(":instrumentation:log4j:log4j-context-data:log4j-context-data-2.7:javaagent"))
testImplementation(project(":instrumentation:log4j:log4j-context-data:log4j-context-data-common:testing"))
}
testing {
suites {
// Very different codepaths when threadlocals are enabled or not so we check both.
// Regression test for https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/2403
val testDisableThreadLocals by registering(JvmTestSuite::class) {
sources {
java {
setSrcDirs(listOf("src/test/java"))
}
}
dependencies {
implementation(project(":instrumentation:log4j:log4j-context-data:log4j-context-data-common:testing"))
}
targets {
all {
testTask.configure {
jvmArgs("-Dlog4j2.is.webapp=false")
jvmArgs("-Dlog4j2.enable.threadlocals=false")
jvmArgs("-Dotel.instrumentation.common.mdc.resource-attributes=service.name,telemetry.sdk.language")
}
}
}
}
val testAddBaggage by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":instrumentation:log4j:log4j-context-data:log4j-context-data-common:testing"))
}
targets {
all {
testTask.configure {
jvmArgs("-Dotel.instrumentation.log4j-context-data.add-baggage=true")
jvmArgs("-Dlog4j2.is.webapp=false")
jvmArgs("-Dlog4j2.enable.threadlocals=true")
}
}
}
}
val testLoggingKeys by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":instrumentation:log4j:log4j-context-data:log4j-context-data-common:testing"))
}
targets {
all {
testTask.configure {
jvmArgs("-Dotel.instrumentation.common.logging.trace-id=trace_id_test")
jvmArgs("-Dotel.instrumentation.common.logging.span-id=span_id_test")
jvmArgs("-Dotel.instrumentation.common.logging.trace-flags=trace_flags_test")
jvmArgs("-Dlog4j2.is.webapp=false")
jvmArgs("-Dlog4j2.enable.threadlocals=true")
}
}
}
}
}
}
tasks {
// Threadlocals are always false if is.webapp is true, so we make sure to override it because as of
// now testing-common includes jetty / servlet.
test {
jvmArgs("-Dlog4j2.is.webapp=false")
jvmArgs("-Dlog4j2.enable.threadlocals=true")
jvmArgs("-Dotel.instrumentation.common.mdc.resource-attributes=service.name,telemetry.sdk.language")
}
named("check") {
dependsOn(testing.suites)
}
}