ensure no warnings are emitted in spring starter startup (#11201)
This commit is contained in:
parent
8ffecc9cfc
commit
c370aef658
|
@ -34,7 +34,7 @@ import org.springframework.web.client.RestClient;
|
||||||
public class RestClientInstrumentationAutoConfiguration {
|
public class RestClientInstrumentationAutoConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
RestClientBeanPostProcessor otelRestClientBeanPostProcessor(
|
static RestClientBeanPostProcessor otelRestClientBeanPostProcessor(
|
||||||
ObjectProvider<OpenTelemetry> openTelemetryProvider) {
|
ObjectProvider<OpenTelemetry> openTelemetryProvider) {
|
||||||
return new RestClientBeanPostProcessor(openTelemetryProvider);
|
return new RestClientBeanPostProcessor(openTelemetryProvider);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ public class KafkaInstrumentationAutoConfiguration {
|
||||||
return producerFactory -> producerFactory.addPostProcessor(kafkaTelemetry::wrap);
|
return producerFactory -> producerFactory.addPostProcessor(kafkaTelemetry::wrap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static to avoid "is not eligible for getting processed by all BeanPostProcessors" warning
|
||||||
@Bean
|
@Bean
|
||||||
static ConcurrentKafkaListenerContainerFactoryPostProcessor
|
static ConcurrentKafkaListenerContainerFactoryPostProcessor
|
||||||
otelKafkaListenerContainerFactoryBeanPostProcessor(
|
otelKafkaListenerContainerFactoryBeanPostProcessor(
|
||||||
|
|
|
@ -31,6 +31,7 @@ public class SpringWebInstrumentationAutoConfiguration {
|
||||||
|
|
||||||
public SpringWebInstrumentationAutoConfiguration() {}
|
public SpringWebInstrumentationAutoConfiguration() {}
|
||||||
|
|
||||||
|
// static to avoid "is not eligible for getting processed by all BeanPostProcessors" warning
|
||||||
@Bean
|
@Bean
|
||||||
static RestTemplateBeanPostProcessor otelRestTemplateBeanPostProcessor(
|
static RestTemplateBeanPostProcessor otelRestTemplateBeanPostProcessor(
|
||||||
ObjectProvider<OpenTelemetry> openTelemetryProvider) {
|
ObjectProvider<OpenTelemetry> openTelemetryProvider) {
|
||||||
|
@ -38,7 +39,7 @@ public class SpringWebInstrumentationAutoConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
static RestTemplateCustomizer otelRestTemplateCustomizer(
|
RestTemplateCustomizer otelRestTemplateCustomizer(
|
||||||
ObjectProvider<OpenTelemetry> openTelemetryProvider) {
|
ObjectProvider<OpenTelemetry> openTelemetryProvider) {
|
||||||
return restTemplate ->
|
return restTemplate ->
|
||||||
RestTemplateInstrumentation.addIfNotPresent(
|
RestTemplateInstrumentation.addIfNotPresent(
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class SpringWebfluxInstrumentationAutoConfiguration {
|
||||||
|
|
||||||
public SpringWebfluxInstrumentationAutoConfiguration() {}
|
public SpringWebfluxInstrumentationAutoConfiguration() {}
|
||||||
|
|
||||||
|
// static to avoid "is not eligible for getting processed by all BeanPostProcessors" warning
|
||||||
@Bean
|
@Bean
|
||||||
static WebClientBeanPostProcessor otelWebClientBeanPostProcessor(
|
static WebClientBeanPostProcessor otelWebClientBeanPostProcessor(
|
||||||
ObjectProvider<OpenTelemetry> openTelemetryProvider) {
|
ObjectProvider<OpenTelemetry> openTelemetryProvider) {
|
||||||
|
|
|
@ -16,6 +16,8 @@ dependencies {
|
||||||
implementation("com.h2database:h2")
|
implementation("com.h2database:h2")
|
||||||
implementation("org.apache.commons:commons-dbcp2")
|
implementation("org.apache.commons:commons-dbcp2")
|
||||||
implementation(project(":instrumentation:jdbc:library"))
|
implementation(project(":instrumentation:jdbc:library"))
|
||||||
|
implementation("org.springframework.kafka:spring-kafka") // not tested here, just make sure there are no warnings when it's included
|
||||||
|
implementation("org.springframework.boot:spring-boot-starter-webflux") // not tested here, just make sure there are no warnings when it's included
|
||||||
implementation("io.opentelemetry:opentelemetry-extension-trace-propagators")
|
implementation("io.opentelemetry:opentelemetry-extension-trace-propagators")
|
||||||
implementation(project(":instrumentation:spring:starters:spring-boot-starter"))
|
implementation(project(":instrumentation:spring:starters:spring-boot-starter"))
|
||||||
implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
|
implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
|
||||||
|
@ -25,6 +27,10 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
|
test {
|
||||||
|
// suppress warning about byte-buddy-agent being loaded dynamically
|
||||||
|
jvmArgs("-XX:+EnableDynamicAgentLoading")
|
||||||
|
}
|
||||||
compileAotJava {
|
compileAotJava {
|
||||||
with(options) {
|
with(options) {
|
||||||
compilerArgs.add("-Xlint:-deprecation,-unchecked,none")
|
compilerArgs.add("-Xlint:-deprecation,-unchecked,none")
|
||||||
|
|
|
@ -48,19 +48,24 @@ import org.assertj.core.api.AbstractCharSequenceAssert;
|
||||||
import org.awaitility.core.ConditionEvaluationLogger;
|
import org.awaitility.core.ConditionEvaluationLogger;
|
||||||
import org.awaitility.core.EvaluatedCondition;
|
import org.awaitility.core.EvaluatedCondition;
|
||||||
import org.awaitility.core.TimeoutEvent;
|
import org.awaitility.core.TimeoutEvent;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.MethodOrderer;
|
import org.junit.jupiter.api.MethodOrderer;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.TestMethodOrder;
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.boot.test.system.CapturedOutput;
|
||||||
|
import org.springframework.boot.test.system.OutputCaptureExtension;
|
||||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
|
|
||||||
|
@ExtendWith(OutputCaptureExtension.class)
|
||||||
@SpringBootTest(
|
@SpringBootTest(
|
||||||
classes = {
|
classes = {
|
||||||
OtelSpringStarterSmokeTestApplication.class,
|
OtelSpringStarterSmokeTestApplication.class,
|
||||||
|
@ -176,6 +181,11 @@ class OtelSpringStarterSmokeTest {
|
||||||
LOG_RECORD_EXPORTER.reset();
|
LOG_RECORD_EXPORTER.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AfterEach
|
||||||
|
void tearDown(CapturedOutput output) {
|
||||||
|
assertThat(output).doesNotContain("WARN").doesNotContain("ERROR");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@org.junit.jupiter.api.Order(10)
|
@org.junit.jupiter.api.Order(10)
|
||||||
void propertyConversion() {
|
void propertyConversion() {
|
||||||
|
|
Loading…
Reference in New Issue