Merge branch '3.0.x'

See gh-35312
pull/35333/head
Stephane Nicoll 2 years ago
commit ae0efba523

@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.observation.graphql;
import graphql.GraphQL;
import io.micrometer.observation.Observation;
import io.micrometer.observation.ObservationRegistry;
import io.micrometer.tracing.propagation.Propagator;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.actuate.autoconfigure.observation.ObservationAutoConfiguration;
@ -29,15 +28,10 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.graphql.execution.GraphQlSource;
import org.springframework.graphql.observation.DataFetcherObservationConvention;
import org.springframework.graphql.observation.ExecutionRequestObservationConvention;
import org.springframework.graphql.observation.GraphQlObservationInstrumentation;
import org.springframework.graphql.observation.PropagationWebGraphQlInterceptor;
import org.springframework.graphql.server.WebGraphQlHandler;
/**
* {@link EnableAutoConfiguration Auto-configuration} for instrumentation of Spring
@ -61,19 +55,4 @@ public class GraphQlObservationAutoConfiguration {
dataFetcherConvention.getIfAvailable());
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(Propagator.class)
@ConditionalOnBean(WebGraphQlHandler.class)
static class TracingObservationConfiguration {
@Bean
@ConditionalOnBean(Propagator.class)
@ConditionalOnMissingBean
@Order(Ordered.HIGHEST_PRECEDENCE + 1)
PropagationWebGraphQlInterceptor propagationWebGraphQlInterceptor(Propagator propagator) {
return new PropagationWebGraphQlInterceptor(propagator);
}
}
}

@ -18,7 +18,6 @@ package org.springframework.boot.actuate.autoconfigure.observation.graphql;
import io.micrometer.observation.ObservationRegistry;
import io.micrometer.observation.tck.TestObservationRegistry;
import io.micrometer.tracing.propagation.Propagator;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations;
@ -28,7 +27,6 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.graphql.observation.DefaultDataFetcherObservationConvention;
import org.springframework.graphql.observation.DefaultExecutionRequestObservationConvention;
import org.springframework.graphql.observation.GraphQlObservationInstrumentation;
import org.springframework.graphql.observation.PropagationWebGraphQlInterceptor;
import org.springframework.graphql.server.WebGraphQlHandler;
import static org.assertj.core.api.Assertions.assertThat;
@ -76,24 +74,6 @@ class GraphQlObservationAutoConfigurationTests {
});
}
@Test
void propagationInterceptorNotContributedWhenPropagatorIsMissing() {
this.contextRunner.withUserConfiguration(WebGraphQlConfiguration.class)
.run((context) -> assertThat(context).doesNotHaveBean(PropagationWebGraphQlInterceptor.class));
}
@Test
void propagationInterceptorNotContributedWhenNotWebApplication() {
this.contextRunner.withUserConfiguration(TracingConfiguration.class)
.run((context) -> assertThat(context).doesNotHaveBean(PropagationWebGraphQlInterceptor.class));
}
@Test
void propagationInterceptorContributed() {
this.contextRunner.withUserConfiguration(WebGraphQlConfiguration.class, TracingConfiguration.class)
.run((context) -> assertThat(context).hasSingleBean(PropagationWebGraphQlInterceptor.class));
}
@Configuration(proxyBeanMethods = false)
static class InstrumentationConfiguration {
@ -137,14 +117,4 @@ class GraphQlObservationAutoConfigurationTests {
}
@Configuration(proxyBeanMethods = false)
static class TracingConfiguration {
@Bean
Propagator propagator() {
return mock(Propagator.class);
}
}
}

Loading…
Cancel
Save