-
Notifications
You must be signed in to change notification settings - Fork 1k
[Spring Starter] Spring boot 4 support #15459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 43 commits
5b1236d
38d6dc4
ba32a8d
6c13ecb
330cd89
f100658
9c6f987
79629d2
30d0e2c
be14d94
6757a63
25b980b
6562745
7e75966
f37f691
a37c8a5
a406382
3113936
f86e06e
bc3519d
fcf6bce
cbc8b1e
1a83d20
c2d5230
9ce1a80
d17fed1
36c991a
10fef8c
103cecb
153195e
e6a8ae4
7ac8f91
59994b7
c7d5de8
0a5806f
c8516d7
d88ceef
e375143
8f75f72
fc726fe
0c6e263
088b920
3b18b94
24aac9a
879cdde
41879d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package io.opentelemetry.instrumentation.spring.autoconfigure.internal.instrumentation.kafka; | ||
|
|
||
| import io.opentelemetry.api.OpenTelemetry; | ||
| import io.opentelemetry.instrumentation.kafkaclients.v2_6.KafkaTelemetry; | ||
| import io.opentelemetry.instrumentation.spring.autoconfigure.internal.ConditionalOnEnabledInstrumentation; | ||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | ||
| import org.springframework.boot.autoconfigure.kafka.DefaultKafkaProducerFactoryCustomizer; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.kafka.core.DefaultKafkaProducerFactory; | ||
|
|
||
| /** | ||
| * This class is internal and is hence not for public use. Its APIs are unstable and can change at | ||
| * any time. | ||
| */ | ||
| @ConditionalOnEnabledInstrumentation(module = "kafka") | ||
| // package changed in Spring Boot 4 | ||
| @ConditionalOnClass({ | ||
| DefaultKafkaProducerFactoryCustomizer.class, | ||
| DefaultKafkaProducerFactory.class | ||
| }) | ||
| @Configuration | ||
| public class ProducerFactoryCustomizerConfiguration { | ||
| @Bean | ||
| DefaultKafkaProducerFactoryCustomizer otelKafkaProducerFactoryCustomizer( | ||
| OpenTelemetry openTelemetry) { | ||
| KafkaTelemetry kafkaTelemetry = KafkaTelemetry.create(openTelemetry); | ||
| return producerFactory -> producerFactory.addPostProcessor(kafkaTelemetry::wrap); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package io.opentelemetry.instrumentation.spring.autoconfigure.internal.instrumentation.jdbc; | ||
|
|
||
| import io.opentelemetry.api.OpenTelemetry; | ||
| import io.opentelemetry.instrumentation.api.incubator.config.internal.InstrumentationConfig; | ||
| import io.opentelemetry.instrumentation.spring.autoconfigure.internal.ConditionalOnEnabledInstrumentation; | ||
| import javax.sql.DataSource; | ||
| import org.springframework.beans.factory.ObjectProvider; | ||
| import org.springframework.boot.autoconfigure.AutoConfiguration; | ||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; | ||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | ||
| import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
|
|
||
| /** | ||
| * This class is internal and is hence not for public use. Its APIs are unstable and can change at | ||
| * any time. | ||
| */ | ||
| @ConditionalOnEnabledInstrumentation(module = "jdbc") | ||
| @AutoConfiguration(after = DataSourceAutoConfiguration.class) | ||
| @ConditionalOnBean({DataSource.class}) | ||
| @Configuration(proxyBeanMethods = false) | ||
| @ConditionalOnClass(DataSourceAutoConfiguration.class) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. condition looks identical to boot 3 |
||
| public class JdbcInstrumentationSpringBoot4AutoConfiguration { | ||
zeitlinger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // For error prone | ||
| public JdbcInstrumentationSpringBoot4AutoConfiguration() {} | ||
|
|
||
| @Bean | ||
| // static to avoid "is not eligible for getting processed by all BeanPostProcessors" warning | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not really for this PR but I suspect that
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you're right - that would be a nice follow-up PR |
||
| static DataSourcePostProcessor dataSourcePostProcessor( | ||
| ObjectProvider<OpenTelemetry> openTelemetryProvider, | ||
| ObjectProvider<InstrumentationConfig> configProvider) { | ||
| return new DataSourcePostProcessor(openTelemetryProvider, configProvider); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this does not involve any latest dep checks this will bump the version to latest spring 3 even in regular tests?