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 {
|
||||
|
||||
@Bean
|
||||
RestClientBeanPostProcessor otelRestClientBeanPostProcessor(
|
||||
static RestClientBeanPostProcessor otelRestClientBeanPostProcessor(
|
||||
ObjectProvider<OpenTelemetry> openTelemetryProvider) {
|
||||
return new RestClientBeanPostProcessor(openTelemetryProvider);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ public class KafkaInstrumentationAutoConfiguration {
|
|||
return producerFactory -> producerFactory.addPostProcessor(kafkaTelemetry::wrap);
|
||||
}
|
||||
|
||||
// static to avoid "is not eligible for getting processed by all BeanPostProcessors" warning
|
||||
@Bean
|
||||
static ConcurrentKafkaListenerContainerFactoryPostProcessor
|
||||
otelKafkaListenerContainerFactoryBeanPostProcessor(
|
||||
|
|
|
@ -31,6 +31,7 @@ public class SpringWebInstrumentationAutoConfiguration {
|
|||
|
||||
public SpringWebInstrumentationAutoConfiguration() {}
|
||||
|
||||
// static to avoid "is not eligible for getting processed by all BeanPostProcessors" warning
|
||||
@Bean
|
||||
static RestTemplateBeanPostProcessor otelRestTemplateBeanPostProcessor(
|
||||
ObjectProvider<OpenTelemetry> openTelemetryProvider) {
|
||||
|
@ -38,7 +39,7 @@ public class SpringWebInstrumentationAutoConfiguration {
|
|||
}
|
||||
|
||||
@Bean
|
||||
static RestTemplateCustomizer otelRestTemplateCustomizer(
|
||||
RestTemplateCustomizer otelRestTemplateCustomizer(
|
||||
ObjectProvider<OpenTelemetry> openTelemetryProvider) {
|
||||
return restTemplate ->
|
||||
RestTemplateInstrumentation.addIfNotPresent(
|
||||
|
|
|
@ -30,6 +30,7 @@ public class SpringWebfluxInstrumentationAutoConfiguration {
|
|||
|
||||
public SpringWebfluxInstrumentationAutoConfiguration() {}
|
||||
|
||||
// static to avoid "is not eligible for getting processed by all BeanPostProcessors" warning
|
||||
@Bean
|
||||
static WebClientBeanPostProcessor otelWebClientBeanPostProcessor(
|
||||
ObjectProvider<OpenTelemetry> openTelemetryProvider) {
|
||||
|
|
|
@ -16,6 +16,8 @@ dependencies {
|
|||
implementation("com.h2database:h2")
|
||||
implementation("org.apache.commons:commons-dbcp2")
|
||||
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(project(":instrumentation:spring:starters:spring-boot-starter"))
|
||||
implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
|
||||
|
@ -25,6 +27,10 @@ dependencies {
|
|||
}
|
||||
|
||||
tasks {
|
||||
test {
|
||||
// suppress warning about byte-buddy-agent being loaded dynamically
|
||||
jvmArgs("-XX:+EnableDynamicAgentLoading")
|
||||
}
|
||||
compileAotJava {
|
||||
with(options) {
|
||||
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.EvaluatedCondition;
|
||||
import org.awaitility.core.TimeoutEvent;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.MethodOrderer;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
@ExtendWith(OutputCaptureExtension.class)
|
||||
@SpringBootTest(
|
||||
classes = {
|
||||
OtelSpringStarterSmokeTestApplication.class,
|
||||
|
@ -176,6 +181,11 @@ class OtelSpringStarterSmokeTest {
|
|||
LOG_RECORD_EXPORTER.reset();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
void tearDown(CapturedOutput output) {
|
||||
assertThat(output).doesNotContain("WARN").doesNotContain("ERROR");
|
||||
}
|
||||
|
||||
@Test
|
||||
@org.junit.jupiter.api.Order(10)
|
||||
void propertyConversion() {
|
||||
|
|
Loading…
Reference in New Issue