Skip to content

Commit acd7c8c

Browse files
committed
Duplicate Spring Boot 2/3 starter and autoconfigure modules for Spring Boot 4
1 parent f5d6389 commit acd7c8c

File tree

82 files changed

+6594
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+6594
-0
lines changed

.fossa.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,9 @@ targets:
268268
- type: gradle
269269
path: ./
270270
target: ':instrumentation:spring:spring-boot-autoconfigure'
271+
- type: gradle
272+
path: ./
273+
target: ':instrumentation:spring:spring-boot-autoconfigure-4.0'
271274
- type: gradle
272275
path: ./
273276
target: ':instrumentation:spymemcached-2.12:javaagent'
@@ -937,6 +940,9 @@ targets:
937940
- type: gradle
938941
path: ./
939942
target: ':instrumentation:spring:starters:spring-boot-starter'
943+
- type: gradle
944+
path: ./
945+
target: ':instrumentation:spring:starters:spring-boot-starter-4.0'
940946
- type: gradle
941947
path: ./
942948
target: ':instrumentation:spring:starters:zipkin-spring-boot-starter'
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Comparing source compatibility of opentelemetry-spring-boot-autoconfigure-4.0-2.19.0-SNAPSHOT.jar against
2+
+++ NEW CLASS: PUBLIC(+) io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration (not serializable)
3+
+++ CLASS FILE FORMAT VERSION: 61.0 <- n.a.
4+
+++ NEW SUPERCLASS: java.lang.Object
5+
+++ NEW CONSTRUCTOR: PUBLIC(+) OpenTelemetryAutoConfiguration()
6+
+++ NEW ANNOTATION: org.springframework.context.annotation.Configuration
7+
+++ NEW ANNOTATION: org.springframework.boot.context.properties.EnableConfigurationProperties
8+
+++ NEW ELEMENT: value=io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtlpExporterProperties,io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtelResourceProperties,io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtelSpringProperties (+)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# OpenTelemetry Spring Auto-Configuration
2+
3+
Auto-configures OpenTelemetry instrumentation for [spring-web](../spring-web/spring-web-3.1/library)
4+
, [spring-webmvc](../spring-webmvc/spring-webmvc-5.3/library),
5+
and [spring-webflux](../spring-webflux/spring-webflux-5.3/library). Leverages Spring Aspect Oriented
6+
Programming, dependency injection, and bean post-processing to trace spring applications. To include
7+
all features listed below use the [opentelemetry-spring-boot-starter](https://opentelemetry.io/docs/zero-code/java/spring-boot-starter/).
8+
9+
Documentation for OpenTelemetry Spring Auto-Configuration can be found [here](https://opentelemetry.io/docs/zero-code/java/spring-boot-starter/out-of-the-box-instrumentation/).
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
plugins {
2+
id("otel.library-instrumentation")
3+
id("otel.japicmp-conventions")
4+
}
5+
6+
base.archivesName.set("opentelemetry-spring-boot-autoconfigure-4.0")
7+
group = "io.opentelemetry.instrumentation"
8+
9+
val springBootVersion = "4.0.0-M1"
10+
11+
// r2dbc-proxy is shadowed to prevent org.springframework.boot.autoconfigure.r2dbc.R2dbcAutoConfiguration
12+
// from being loaded by Spring Boot (by the presence of META-INF/services/io.r2dbc.spi.ConnectionFactoryProvider) - even if the user doesn't want to use R2DBC.
13+
sourceSets {
14+
main {
15+
val shadedDep = project(":instrumentation:r2dbc-1.0:library-instrumentation-shaded")
16+
output.dir(
17+
shadedDep.file("build/extracted/shadow-spring"),
18+
"builtBy" to ":instrumentation:r2dbc-1.0:library-instrumentation-shaded:extractShadowJarSpring",
19+
)
20+
}
21+
}
22+
23+
dependencies {
24+
compileOnly("org.springframework.boot:spring-boot-autoconfigure:$springBootVersion")
25+
annotationProcessor("org.springframework.boot:spring-boot-autoconfigure-processor:$springBootVersion")
26+
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor:$springBootVersion")
27+
implementation("javax.validation:validation-api")
28+
29+
implementation(project(":instrumentation-annotations-support"))
30+
implementation(project(":instrumentation:kafka:kafka-clients:kafka-clients-2.6:library"))
31+
implementation(project(":instrumentation:mongo:mongo-3.1:library"))
32+
compileOnly(project(path = ":instrumentation:r2dbc-1.0:library-instrumentation-shaded", configuration = "shadow"))
33+
implementation(project(":instrumentation:spring:spring-kafka-2.7:library"))
34+
implementation(project(":instrumentation:spring:spring-web:spring-web-3.1:library"))
35+
implementation(project(":instrumentation:spring:spring-webmvc:spring-webmvc-5.3:library"))
36+
compileOnly("jakarta.servlet:jakarta.servlet-api:5.0.0")
37+
implementation(project(":instrumentation:spring:spring-webflux:spring-webflux-5.3:library"))
38+
implementation(project(":instrumentation:micrometer:micrometer-1.5:library"))
39+
implementation(project(":instrumentation:log4j:log4j-appender-2.17:library"))
40+
compileOnly("org.apache.logging.log4j:log4j-core:2.17.0")
41+
implementation(project(":instrumentation:logback:logback-appender-1.0:library"))
42+
implementation(project(":instrumentation:logback:logback-mdc-1.0:library"))
43+
compileOnly("ch.qos.logback:logback-classic:1.0.0")
44+
implementation(project(":instrumentation:jdbc:library"))
45+
implementation(project(":instrumentation:runtime-telemetry:runtime-telemetry-java8:library"))
46+
implementation(project(":instrumentation:runtime-telemetry:runtime-telemetry-java17:library"))
47+
compileOnly("org.springframework.boot:spring-boot-starter-kafka:$springBootVersion")
48+
compileOnly("org.springframework.boot:spring-boot-starter-mongodb:$springBootVersion")
49+
compileOnly("org.springframework.boot:spring-boot-starter-jdbc:$springBootVersion")
50+
51+
library("org.springframework.kafka:spring-kafka:2.9.0")
52+
library("org.springframework.boot:spring-boot-starter-actuator:$springBootVersion")
53+
library("org.springframework.boot:spring-boot-starter-aop:$springBootVersion")
54+
library("org.springframework.boot:spring-boot-starter-web:$springBootVersion")
55+
library("org.springframework.boot:spring-boot-starter-webflux:$springBootVersion")
56+
library("org.springframework.boot:spring-boot-starter-data-mongodb:$springBootVersion")
57+
library("org.springframework.boot:spring-boot-starter-data-r2dbc:$springBootVersion")
58+
59+
implementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure")
60+
implementation(project(":sdk-autoconfigure-support"))
61+
compileOnly("io.opentelemetry:opentelemetry-extension-trace-propagators")
62+
compileOnly("io.opentelemetry.contrib:opentelemetry-aws-xray-propagator")
63+
compileOnly("io.opentelemetry:opentelemetry-exporter-logging")
64+
compileOnly("io.opentelemetry:opentelemetry-exporter-otlp")
65+
compileOnly("io.opentelemetry:opentelemetry-exporter-zipkin")
66+
compileOnly(project(":instrumentation-annotations"))
67+
68+
compileOnly(project(":instrumentation:resources:library"))
69+
annotationProcessor("com.google.auto.service:auto-service")
70+
compileOnly("com.google.auto.service:auto-service-annotations")
71+
72+
testLibrary("org.springframework.boot:spring-boot-starter-test:$springBootVersion") {
73+
exclude("org.junit.vintage", "junit-vintage-engine")
74+
}
75+
// testImplementation("javax.servlet:javax.servlet-api:3.1.0")
76+
testImplementation("jakarta.servlet:jakarta.servlet-api:5.0.0")
77+
testRuntimeOnly("com.h2database:h2:1.4.197")
78+
testRuntimeOnly("io.r2dbc:r2dbc-h2:1.0.0.RELEASE")
79+
80+
testImplementation(project(":testing-common"))
81+
testImplementation("io.opentelemetry:opentelemetry-sdk")
82+
testImplementation("io.opentelemetry:opentelemetry-sdk-testing")
83+
testImplementation(project(":instrumentation:resources:library"))
84+
testImplementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi")
85+
testImplementation("io.opentelemetry:opentelemetry-extension-trace-propagators")
86+
testImplementation("io.opentelemetry.contrib:opentelemetry-aws-xray-propagator")
87+
testImplementation("io.opentelemetry:opentelemetry-exporter-logging")
88+
testImplementation("io.opentelemetry:opentelemetry-exporter-otlp")
89+
testImplementation("io.opentelemetry:opentelemetry-exporter-zipkin")
90+
testImplementation(project(":instrumentation-annotations"))
91+
92+
implementation(project(":instrumentation:spring:spring-webmvc:spring-webmvc-6.0:library"))
93+
compileOnly("org.springframework.boot:spring-boot-starter-restclient:$springBootVersion")
94+
}
95+
96+
val latestDepTest = findProperty("testLatestDeps") as Boolean
97+
98+
// spring 6 (spring boot 3) requires java 17
99+
if (latestDepTest) {
100+
otelJava {
101+
minJavaVersionSupported.set(JavaVersion.VERSION_17)
102+
}
103+
}
104+
105+
val testJavaVersion = gradle.startParameter.projectProperties["testJavaVersion"]?.let(JavaVersion::toVersion)
106+
107+
testing {
108+
suites {
109+
val testLogbackAppender by registering(JvmTestSuite::class) {
110+
dependencies {
111+
implementation(project())
112+
implementation(project(":testing-common"))
113+
implementation("io.opentelemetry:opentelemetry-sdk")
114+
implementation("io.opentelemetry:opentelemetry-sdk-testing")
115+
implementation("org.mockito:mockito-inline")
116+
implementation("org.springframework.boot:spring-boot-autoconfigure:$springBootVersion")
117+
118+
implementation(project(":instrumentation:logback:logback-appender-1.0:library"))
119+
implementation(project(":instrumentation:logback:logback-mdc-1.0:library"))
120+
// using the same versions as in the spring-boot-autoconfigure
121+
implementation("ch.qos.logback:logback-classic") {
122+
version {
123+
strictly("1.2.11")
124+
}
125+
}
126+
implementation("org.slf4j:slf4j-api") {
127+
version {
128+
strictly("1.7.32")
129+
}
130+
}
131+
}
132+
}
133+
134+
val testLogbackMissing by registering(JvmTestSuite::class) {
135+
dependencies {
136+
implementation(project())
137+
implementation("org.springframework.boot:spring-boot-autoconfigure:$springBootVersion")
138+
139+
implementation("org.slf4j:slf4j-api") {
140+
version {
141+
strictly("1.7.32")
142+
}
143+
}
144+
}
145+
}
146+
}
147+
}
148+
149+
configurations.configureEach {
150+
if (name.contains("testLogbackMissing")) {
151+
exclude("ch.qos.logback", "logback-classic")
152+
}
153+
}
154+
155+
java {
156+
sourceCompatibility = JavaVersion.VERSION_17
157+
targetCompatibility = JavaVersion.VERSION_17
158+
// options.release.set(17)
159+
}
160+
161+
otelJava {
162+
minJavaVersionSupported.set(JavaVersion.VERSION_17)
163+
}
164+
165+
tasks {
166+
compileTestJava {
167+
options.compilerArgs.add("-parameters")
168+
}
169+
170+
withType<Test>().configureEach {
171+
systemProperty("testLatestDeps", latestDepTest)
172+
173+
// required on jdk17
174+
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
175+
jvmArgs("-XX:+IgnoreUnrecognizedVMOptions")
176+
}
177+
178+
val testStableSemconv by registering(Test::class) {
179+
jvmArgs("-Dotel.semconv-stability.opt-in=database")
180+
}
181+
182+
check {
183+
dependsOn(testing.suites)
184+
dependsOn(testStableSemconv)
185+
}
186+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
otel.stable=false
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
description: >
2+
This instrumentation auto-configures OpenTelemetry instrumentation for spring-web, spring-webmvc,
3+
and spring-webflux to instrument Spring Boot applications. It does not produce telemetry on its
4+
own. This instrumentation is mostly used as part of the Spring Boot starter.

0 commit comments

Comments
 (0)