Hides exposed configuration and properties types (#1642)
This completes #1638 by addressing deprecations on master (3.x)
This commit is contained in:
@@ -21,7 +21,7 @@ import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.cloud.sleuth.util.SpanNameUtil;
|
||||
import org.springframework.cloud.sleuth.internal.SpanNameUtil;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,7 +45,7 @@ import org.springframework.context.annotation.Role;
|
||||
@ConditionalOnBean(Tracing.class)
|
||||
@ConditionalOnProperty(name = "spring.sleuth.annotation.enabled", matchIfMissing = true)
|
||||
@AutoConfigureAfter(TraceAutoConfiguration.class)
|
||||
public class SleuthAnnotationAutoConfiguration {
|
||||
class SleuthAnnotationAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.sleuth.annotation;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* Sleuth annotation settings.
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@ConfigurationProperties("spring.sleuth.annotation")
|
||||
// TODO: Hide in 3.x, if it isn't already deleted
|
||||
public class SleuthAnnotationProperties {
|
||||
|
||||
private boolean enabled = true;
|
||||
|
||||
public boolean isEnabled() {
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.sleuth.baggage;
|
||||
package org.springframework.cloud.sleuth.autoconfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -34,7 +34,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @since 3.0
|
||||
*/
|
||||
@ConfigurationProperties("spring.sleuth.baggage")
|
||||
public class SleuthBaggageProperties {
|
||||
class SleuthBaggageProperties {
|
||||
|
||||
/**
|
||||
* Adds a {@link CorrelationScopeDecorator} to put baggage values into the correlation
|
||||
@@ -25,8 +25,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @since 1.0.11
|
||||
*/
|
||||
@ConfigurationProperties("spring.sleuth")
|
||||
// TODO: Hide in 3.x, if it isn't already deleted
|
||||
public class SleuthProperties {
|
||||
class SleuthProperties {
|
||||
|
||||
private boolean enabled = true;
|
||||
|
||||
|
||||
@@ -45,10 +45,9 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.sleuth.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.LocalServiceName;
|
||||
import org.springframework.cloud.sleuth.SpanNamer;
|
||||
import org.springframework.cloud.sleuth.baggage.TraceBaggageConfiguration;
|
||||
import org.springframework.cloud.sleuth.internal.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.sampler.SamplerAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -14,13 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.sleuth.baggage;
|
||||
package org.springframework.cloud.sleuth.autoconfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import brave.Tags;
|
||||
import brave.baggage.BaggageField;
|
||||
import brave.baggage.BaggagePropagation;
|
||||
import brave.baggage.BaggagePropagationConfig.SingleBaggageField;
|
||||
@@ -29,15 +30,16 @@ import brave.baggage.CorrelationScopeConfig.SingleCorrelationField;
|
||||
import brave.baggage.CorrelationScopeCustomizer;
|
||||
import brave.baggage.CorrelationScopeDecorator;
|
||||
import brave.context.slf4j.MDCScopeDecorator;
|
||||
import brave.handler.FinishedSpanHandler;
|
||||
import brave.handler.MutableSpan;
|
||||
import brave.handler.SpanHandler;
|
||||
import brave.propagation.B3Propagation;
|
||||
import brave.propagation.CurrentTraceContext.ScopeDecorator;
|
||||
import brave.propagation.Propagation;
|
||||
import brave.propagation.TraceContext;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.slf4j.MDC;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.autoconfigure.condition.AnyNestedCondition;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
@@ -49,6 +51,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* {@link Configuration} for {@link BaggagePropagation}.
|
||||
@@ -60,7 +63,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties(SleuthBaggageProperties.class)
|
||||
public class TraceBaggageConfiguration {
|
||||
class TraceBaggageConfiguration {
|
||||
|
||||
static final Log logger = LogFactory.getLog(TraceBaggageConfiguration.class);
|
||||
|
||||
@@ -97,12 +100,6 @@ public class TraceBaggageConfiguration {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Autowired(required = false)
|
||||
List<BaggagePropagationCustomizer> baggagePropagationCustomizers = new ArrayList<>();
|
||||
|
||||
@Autowired(required = false)
|
||||
List<CorrelationScopeCustomizer> correlationScopeCustomizers = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* To override the underlying context format, override this bean and set the delegate
|
||||
* to what you need. {@link BaggagePropagation.FactoryBuilder} will unwrap itself if
|
||||
@@ -126,7 +123,8 @@ public class TraceBaggageConfiguration {
|
||||
@Qualifier(BAGGAGE_KEYS) List<String> baggageKeys,
|
||||
@Qualifier(LOCAL_KEYS) List<String> localKeys,
|
||||
@Qualifier(PROPAGATION_KEYS) List<String> propagationKeys,
|
||||
SleuthBaggageProperties sleuthBaggageProperties) {
|
||||
SleuthBaggageProperties sleuthBaggageProperties,
|
||||
@Nullable List<BaggagePropagationCustomizer> baggagePropagationCustomizers) {
|
||||
|
||||
Set<String> localFields = redirectOldPropertyToNew(LOCAL_KEYS, localKeys,
|
||||
"spring.sleuth.baggage.local-fields",
|
||||
@@ -155,8 +153,10 @@ public class TraceBaggageConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
for (BaggagePropagationCustomizer customizer : this.baggagePropagationCustomizers) {
|
||||
customizer.customize(factoryBuilder);
|
||||
if (baggagePropagationCustomizers != null) {
|
||||
for (BaggagePropagationCustomizer customizer : baggagePropagationCustomizers) {
|
||||
customizer.customize(factoryBuilder);
|
||||
}
|
||||
}
|
||||
return factoryBuilder.build();
|
||||
}
|
||||
@@ -187,7 +187,8 @@ public class TraceBaggageConfiguration {
|
||||
matchIfMissing = true)
|
||||
ScopeDecorator correlationScopeDecorator(
|
||||
@Qualifier(WHITELISTED_MDC_KEYS) List<String> whiteListedMDCKeys,
|
||||
SleuthBaggageProperties sleuthBaggageProperties) {
|
||||
SleuthBaggageProperties sleuthBaggageProperties,
|
||||
@Nullable List<CorrelationScopeCustomizer> correlationScopeCustomizers) {
|
||||
|
||||
Set<String> correlationFields = redirectOldPropertyToNew(WHITELISTED_MDC_KEYS,
|
||||
whiteListedMDCKeys, "spring.sleuth.baggage.correlation-fields",
|
||||
@@ -201,24 +202,25 @@ public class TraceBaggageConfiguration {
|
||||
}
|
||||
|
||||
// handle user overrides
|
||||
for (CorrelationScopeCustomizer customizer : this.correlationScopeCustomizers) {
|
||||
customizer.customize(builder);
|
||||
if (correlationScopeCustomizers != null) {
|
||||
for (CorrelationScopeCustomizer customizer : correlationScopeCustomizers) {
|
||||
customizer.customize(builder);
|
||||
}
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* This has to be conditional as it creates a bean of type
|
||||
* {@link FinishedSpanHandler}.
|
||||
* This has to be conditional as it creates a bean of type {@link SpanHandler}.
|
||||
*
|
||||
* <p>
|
||||
* {@link FinishedSpanHandler} beans, even if {@link FinishedSpanHandler#NOOP}, can
|
||||
* trigger {@code org.springframework.cloud.sleuth.sampler.SamplerCondition}
|
||||
* {@link SpanHandler} beans, even if {@link SpanHandler#NOOP}, can trigger
|
||||
* {@code org.springframework.cloud.sleuth.sampler.SamplerCondition}
|
||||
*/
|
||||
@Configuration
|
||||
@Conditional(BaggageTagFinishedSpanHandlerCondition.class)
|
||||
@Conditional(BaggageTagSpanHandlerCondition.class)
|
||||
@EnableConfigurationProperties(SleuthBaggageProperties.class)
|
||||
static class BaggageTagFinishedSpanHandlerConfiguration {
|
||||
static class BaggageTagSpanHandlerConfiguration {
|
||||
|
||||
@Bean(WHITELISTED_KEYS)
|
||||
@ConfigurationProperties(WHITELISTED_KEYS)
|
||||
@@ -227,7 +229,7 @@ public class TraceBaggageConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
FinishedSpanHandler baggageTagFinishedSpanHandler(
|
||||
SpanHandler baggageTagSpanHandler(
|
||||
@Qualifier(WHITELISTED_KEYS) List<String> whiteListedKeys,
|
||||
SleuthBaggageProperties sleuthBaggageProperties) {
|
||||
|
||||
@@ -236,11 +238,11 @@ public class TraceBaggageConfiguration {
|
||||
sleuthBaggageProperties.getTagFields());
|
||||
|
||||
if (tagFields.isEmpty()) {
|
||||
return FinishedSpanHandler.NOOP; // Brave ignores these
|
||||
return SpanHandler.NOOP; // Brave ignores these
|
||||
}
|
||||
|
||||
return new BaggageTagFinishedSpanHandler(tagFields.stream()
|
||||
.map(BaggageField::create).toArray(BaggageField[]::new));
|
||||
return new BaggageTagSpanHandler(tagFields.stream().map(BaggageField::create)
|
||||
.toArray(BaggageField[]::new));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -249,9 +251,9 @@ public class TraceBaggageConfiguration {
|
||||
* We need a special condition as it users could use either comma or yaml encoding,
|
||||
* possibly with a deprecated prefix.
|
||||
*/
|
||||
static class BaggageTagFinishedSpanHandlerCondition extends AnyNestedCondition {
|
||||
static class BaggageTagSpanHandlerCondition extends AnyNestedCondition {
|
||||
|
||||
BaggageTagFinishedSpanHandlerCondition() {
|
||||
BaggageTagSpanHandlerCondition() {
|
||||
super(ConfigurationPhase.PARSE_CONFIGURATION);
|
||||
}
|
||||
|
||||
@@ -277,4 +279,22 @@ public class TraceBaggageConfiguration {
|
||||
|
||||
}
|
||||
|
||||
static final class BaggageTagSpanHandler extends SpanHandler {
|
||||
|
||||
final BaggageField[] fieldsToTag;
|
||||
|
||||
BaggageTagSpanHandler(BaggageField[] fieldsToTag) {
|
||||
this.fieldsToTag = fieldsToTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean end(TraceContext context, MutableSpan span, Cause cause) {
|
||||
for (BaggageField field : fieldsToTag) {
|
||||
Tags.BAGGAGE_FIELD.tag(field, context, span);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,11 +33,8 @@ import org.springframework.core.env.PropertySource;
|
||||
* @author Dave Syer
|
||||
* @author Marcin Grzejszczak
|
||||
* @since 2.0.0
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
public class TraceEnvironmentPostProcessor implements EnvironmentPostProcessor {
|
||||
class TraceEnvironmentPostProcessor implements EnvironmentPostProcessor {
|
||||
|
||||
private static final String PROPERTY_SOURCE_NAME = "defaultProperties";
|
||||
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.sleuth.baggage;
|
||||
|
||||
import brave.Tags;
|
||||
import brave.baggage.BaggageField;
|
||||
import brave.handler.FinishedSpanHandler;
|
||||
import brave.handler.MutableSpan;
|
||||
import brave.propagation.TraceContext;
|
||||
|
||||
/**
|
||||
* Finish span handler which adds baggage to span tags, so spans could be looked up by a
|
||||
* baggage name.
|
||||
*
|
||||
* @author Taras Danylchuk
|
||||
* @since 2.1.0
|
||||
*/
|
||||
class BaggageTagFinishedSpanHandler extends FinishedSpanHandler {
|
||||
|
||||
final BaggageField[] fieldsToTag;
|
||||
|
||||
BaggageTagFinishedSpanHandler(BaggageField[] fieldsToTag) {
|
||||
this.fieldsToTag = fieldsToTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(TraceContext context, MutableSpan span) {
|
||||
for (BaggageField field : fieldsToTag) {
|
||||
Tags.BAGGAGE_FIELD.tag(field, context, span);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,7 +18,6 @@ package org.springframework.cloud.sleuth.instrument.async;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.sleuth.instrument.scheduling.SleuthSchedulingProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -28,15 +27,11 @@ import org.springframework.context.annotation.Configuration;
|
||||
*
|
||||
* @author Jesus Alonso
|
||||
* @since 2.1.0
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(value = "spring.sleuth.scheduled.enabled", matchIfMissing = true)
|
||||
@EnableConfigurationProperties({ SleuthAsyncProperties.class,
|
||||
SleuthSchedulingProperties.class })
|
||||
public class AsyncAutoConfiguration {
|
||||
@EnableConfigurationProperties(SleuthAsyncProperties.class)
|
||||
class AsyncAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
SleuthContextListener traceContextClosedListener() {
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.cloud.sleuth.instrument.scheduling.TraceSchedulingAutoConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.AsyncConfigurer;
|
||||
|
||||
@@ -35,16 +34,14 @@ import org.springframework.scheduling.annotation.AsyncConfigurer;
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @since 1.0.0
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnBean(AsyncConfigurer.class)
|
||||
@AutoConfigureBefore(AsyncDefaultAutoConfiguration.class)
|
||||
@ConditionalOnProperty(value = "spring.sleuth.async.enabled", matchIfMissing = true)
|
||||
@AutoConfigureAfter(TraceSchedulingAutoConfiguration.class)
|
||||
public class AsyncCustomAutoConfiguration implements BeanPostProcessor {
|
||||
@AutoConfigureAfter(
|
||||
name = "org.springframework.cloud.sleuth.instrument.scheduling.TraceSchedulingAutoConfiguration")
|
||||
class AsyncCustomAutoConfiguration implements BeanPostProcessor {
|
||||
|
||||
@Autowired
|
||||
private BeanFactory beanFactory;
|
||||
|
||||
@@ -34,7 +34,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.sleuth.SpanNamer;
|
||||
import org.springframework.cloud.sleuth.instrument.scheduling.SleuthSchedulingProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Role;
|
||||
@@ -52,16 +51,12 @@ import org.springframework.scheduling.annotation.AsyncConfigurerSupport;
|
||||
* @since 1.0.0
|
||||
* @see LazyTraceExecutor
|
||||
* @see TraceAsyncAspect
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties({ SleuthAsyncProperties.class,
|
||||
SleuthSchedulingProperties.class })
|
||||
@EnableConfigurationProperties(SleuthAsyncProperties.class)
|
||||
@ConditionalOnProperty(value = "spring.sleuth.async.enabled", matchIfMissing = true)
|
||||
@ConditionalOnBean(Tracing.class)
|
||||
public class AsyncDefaultAutoConfiguration {
|
||||
class AsyncDefaultAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "spring.sleuth.scheduled.enabled",
|
||||
|
||||
@@ -25,8 +25,8 @@ import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.cloud.sleuth.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.SpanNamer;
|
||||
import org.springframework.cloud.sleuth.internal.DefaultSpanNamer;
|
||||
import org.springframework.core.task.AsyncTaskExecutor;
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,8 +24,8 @@ import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.cloud.sleuth.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.SpanNamer;
|
||||
import org.springframework.cloud.sleuth.internal.DefaultSpanNamer;
|
||||
|
||||
/**
|
||||
* {@link Executor} that wraps {@link Runnable} in a trace representation.
|
||||
|
||||
@@ -39,8 +39,8 @@ import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.cloud.sleuth.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.SpanNamer;
|
||||
import org.springframework.cloud.sleuth.internal.DefaultSpanNamer;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,8 +28,8 @@ import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.cloud.sleuth.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.SpanNamer;
|
||||
import org.springframework.cloud.sleuth.internal.DefaultSpanNamer;
|
||||
import org.springframework.core.task.TaskDecorator;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.util.concurrent.ListenableFuture;
|
||||
|
||||
@@ -35,8 +35,8 @@ import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.cloud.sleuth.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.SpanNamer;
|
||||
import org.springframework.cloud.sleuth.internal.DefaultSpanNamer;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.scheduling.Trigger;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
|
||||
@@ -28,8 +28,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @since 2.1.0
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "spring.sleuth.async")
|
||||
// TODO: Hide in 3.x, if it isn't already deleted
|
||||
public class SleuthAsyncProperties {
|
||||
class SleuthAsyncProperties {
|
||||
|
||||
/**
|
||||
* List of {@link java.util.concurrent.Executor} bean names that should be ignored and
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
|
||||
import org.springframework.cloud.sleuth.SpanNamer;
|
||||
import org.springframework.cloud.sleuth.util.SpanNameUtil;
|
||||
import org.springframework.cloud.sleuth.internal.SpanNameUtil;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
@@ -36,12 +36,9 @@ import org.springframework.util.ReflectionUtils;
|
||||
* @author Marcin Grzejszczak
|
||||
* @since 1.0.0
|
||||
* @see Tracer
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Aspect
|
||||
public class TraceAsyncAspect {
|
||||
class TraceAsyncAspect {
|
||||
|
||||
private static final String CLASS_KEY = "class";
|
||||
|
||||
@@ -51,7 +48,7 @@ public class TraceAsyncAspect {
|
||||
|
||||
private final SpanNamer spanNamer;
|
||||
|
||||
public TraceAsyncAspect(Tracer tracer, SpanNamer spanNamer) {
|
||||
TraceAsyncAspect(Tracer tracer, SpanNamer spanNamer) {
|
||||
this.tracer = tracer;
|
||||
this.spanNamer = spanNamer;
|
||||
}
|
||||
|
||||
@@ -32,10 +32,8 @@ import org.springframework.util.concurrent.ListenableFuture;
|
||||
* @since 1.0.0
|
||||
* @see brave.propagation.CurrentTraceContext#wrap(Runnable)
|
||||
* @see brave.propagation.CurrentTraceContext#wrap(Callable)
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
// public as most types in this package were documented for use
|
||||
public class TraceAsyncListenableTaskExecutor implements AsyncListenableTaskExecutor {
|
||||
|
||||
private final AsyncListenableTaskExecutor delegate;
|
||||
|
||||
@@ -42,10 +42,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
* @since 2.2.1
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfigureAfter(TraceAutoConfiguration.class)
|
||||
@ConditionalOnClass(CircuitBreaker.class)
|
||||
@@ -53,7 +50,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
@ConditionalOnProperty(value = "spring.sleuth.circuitbreaker.enabled",
|
||||
matchIfMissing = true)
|
||||
@EnableConfigurationProperties(SleuthCircuitBreakerProperties.class)
|
||||
public class SleuthCircuitBreakerAutoConfiguration {
|
||||
class SleuthCircuitBreakerAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
TraceCircuitBreakerFactoryAspect traceCircuitBreakerFactoryAspect(Tracer tracer) {
|
||||
|
||||
@@ -24,9 +24,8 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @author Marcin Grzejszczak
|
||||
* @since 2.2.1
|
||||
*/
|
||||
// TODO: Hide in 3.x, if it isn't already deleted
|
||||
@ConfigurationProperties("spring.sleuth.circuitbreaker")
|
||||
public class SleuthCircuitBreakerProperties {
|
||||
class SleuthCircuitBreakerProperties {
|
||||
|
||||
/**
|
||||
* Enable Spring Cloud CircuitBreaker instrumentation.
|
||||
|
||||
@@ -27,11 +27,8 @@ import brave.Tracer;
|
||||
*
|
||||
* @param <T> type returned by the fallback
|
||||
* @since 2.2.1
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
public class TraceFunction<T> implements Function<Throwable, T> {
|
||||
class TraceFunction<T> implements Function<Throwable, T> {
|
||||
|
||||
private final Tracer tracer;
|
||||
|
||||
@@ -39,7 +36,7 @@ public class TraceFunction<T> implements Function<Throwable, T> {
|
||||
|
||||
private final AtomicReference<Span> span;
|
||||
|
||||
public TraceFunction(Tracer tracer, Function<Throwable, T> delegate) {
|
||||
TraceFunction(Tracer tracer, Function<Throwable, T> delegate) {
|
||||
this.tracer = tracer;
|
||||
this.delegate = delegate;
|
||||
this.span = new AtomicReference<>(this.tracer.nextSpan());
|
||||
|
||||
@@ -27,11 +27,8 @@ import brave.Tracer;
|
||||
*
|
||||
* @param <T> type returned by the supplier
|
||||
* @since 2.2.1
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
public class TraceSupplier<T> implements Supplier<T> {
|
||||
class TraceSupplier<T> implements Supplier<T> {
|
||||
|
||||
private final Tracer tracer;
|
||||
|
||||
@@ -39,7 +36,7 @@ public class TraceSupplier<T> implements Supplier<T> {
|
||||
|
||||
private final AtomicReference<Span> span;
|
||||
|
||||
public TraceSupplier(Tracer tracer, Supplier<T> delegate) {
|
||||
TraceSupplier(Tracer tracer, Supplier<T> delegate) {
|
||||
this.tracer = tracer;
|
||||
this.delegate = delegate;
|
||||
this.span = new AtomicReference<>(this.tracer.nextSpan());
|
||||
|
||||
@@ -40,15 +40,12 @@ import org.springframework.context.annotation.Bean;
|
||||
* brave-instrumentation-grpc are on the classpath.
|
||||
*
|
||||
* @author Tyler Van Gorder
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@ConditionalOnClass({ GrpcTracing.class, GRpcGlobalInterceptor.class })
|
||||
@ConditionalOnProperty(value = "spring.sleuth.grpc.enabled", matchIfMissing = true)
|
||||
@ConditionalOnBean(RpcTracing.class)
|
||||
@AutoConfigureAfter(TraceRpcAutoConfiguration.class)
|
||||
public class TraceGrpcAutoConfiguration {
|
||||
class TraceGrpcAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public GrpcTracing grpcTracing(RpcTracing rpcTracing) {
|
||||
|
||||
@@ -40,10 +40,7 @@ import org.springframework.kafka.config.StreamsBuilderFactoryBean;
|
||||
* Auto-configuration} enables Kafka Streams span creation and reporting.
|
||||
*
|
||||
* @author Tim te Beek
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnBean(Tracing.class)
|
||||
@AutoConfigureAfter({ TraceAutoConfiguration.class })
|
||||
@@ -51,7 +48,7 @@ import org.springframework.kafka.config.StreamsBuilderFactoryBean;
|
||||
@ConditionalOnProperty(value = "spring.sleuth.messaging.kafka.streams.enabled",
|
||||
matchIfMissing = true)
|
||||
@ConditionalOnClass(KafkaStreams.class)
|
||||
public class SleuthKafkaStreamsConfiguration {
|
||||
class SleuthKafkaStreamsConfiguration {
|
||||
|
||||
protected SleuthKafkaStreamsConfiguration() {
|
||||
}
|
||||
|
||||
@@ -24,9 +24,8 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @author Marcin Grzejszczak
|
||||
* @since 2.0.0
|
||||
*/
|
||||
// TODO: Hide in 3.x, if it isn't already deleted
|
||||
@ConfigurationProperties("spring.sleuth")
|
||||
public class SleuthMessagingProperties {
|
||||
class SleuthMessagingProperties {
|
||||
|
||||
private Integration integration = new Integration();
|
||||
|
||||
|
||||
@@ -39,10 +39,7 @@ import org.springframework.messaging.support.MessageHeaderAccessor;
|
||||
* @author Spencer Gibb
|
||||
* @since 1.0.0
|
||||
* @see TracingChannelInterceptor
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass(GlobalChannelInterceptor.class)
|
||||
@ConditionalOnBean(Tracing.class)
|
||||
@@ -51,7 +48,7 @@ import org.springframework.messaging.support.MessageHeaderAccessor;
|
||||
@OnMessagingEnabled
|
||||
@ConditionalOnProperty(value = "spring.sleuth.integration.enabled", matchIfMissing = true)
|
||||
@EnableConfigurationProperties(SleuthMessagingProperties.class)
|
||||
public class TraceSpringIntegrationAutoConfiguration {
|
||||
class TraceSpringIntegrationAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public GlobalChannelInterceptorWrapper tracingGlobalChannelInterceptorWrapper(
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.sleuth.instrument.messaging.websocket;
|
||||
package org.springframework.cloud.sleuth.instrument.messaging;
|
||||
|
||||
import brave.Tracing;
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.cloud.sleuth.instrument.messaging.TracingChannelInterceptor;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.messaging.simp.config.ChannelRegistration;
|
||||
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
|
||||
@@ -37,17 +36,13 @@ import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
|
||||
* @author Dave Syer
|
||||
* @since 1.0.0
|
||||
* @see AbstractWebSocketMessageBrokerConfigurer
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass(DelegatingWebSocketMessageBrokerConfiguration.class)
|
||||
@ConditionalOnBean(Tracing.class)
|
||||
@ConditionalOnProperty(value = "spring.sleuth.integration.websockets.enabled",
|
||||
matchIfMissing = true)
|
||||
public class TraceWebSocketAutoConfiguration
|
||||
extends AbstractWebSocketMessageBrokerConfigurer {
|
||||
class TraceWebSocketAutoConfiguration extends AbstractWebSocketMessageBrokerConfigurer {
|
||||
|
||||
@Autowired
|
||||
Tracing tracing;
|
||||
@@ -29,7 +29,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.sleuth.util.SpanNameUtil;
|
||||
import org.springframework.cloud.sleuth.internal.SpanNameUtil;
|
||||
import org.springframework.integration.channel.AbstractMessageChannel;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.context.IntegrationObjectSupport;
|
||||
@@ -56,11 +56,8 @@ import org.springframework.util.ClassUtils;
|
||||
* manipulation by other interceptors.
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
|
||||
final class TracingChannelInterceptor extends ChannelInterceptorAdapter
|
||||
implements ExecutorChannelInterceptor {
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,17 +37,14 @@ import org.springframework.context.annotation.Configuration;
|
||||
* @author Spencer Gibb
|
||||
* @author Marcin Grzejszczak
|
||||
* @since 2.0.0
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(value = "spring.sleuth.opentracing.enabled", matchIfMissing = true)
|
||||
@ConditionalOnBean(Tracing.class)
|
||||
@ConditionalOnClass(Tracer.class)
|
||||
@AutoConfigureAfter(TraceAutoConfiguration.class)
|
||||
@EnableConfigurationProperties(SleuthOpentracingProperties.class)
|
||||
public class OpentracingAutoConfiguration {
|
||||
class OpentracingAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
|
||||
@@ -24,9 +24,8 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @author Marcin Grzejszczak
|
||||
* @since 2.0.0
|
||||
*/
|
||||
// TODO: Hide in 3.x, if it isn't already deleted
|
||||
@ConfigurationProperties("spring.sleuth.opentracing")
|
||||
public class SleuthOpentracingProperties {
|
||||
class SleuthOpentracingProperties {
|
||||
|
||||
private boolean enabled = true;
|
||||
|
||||
|
||||
@@ -36,21 +36,18 @@ import org.springframework.context.annotation.Configuration;
|
||||
*
|
||||
* @author Branden Cash
|
||||
* @since 2.2.0
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnBean({ Tracing.class, Scheduler.class })
|
||||
@AutoConfigureAfter({ TraceAutoConfiguration.class, QuartzAutoConfiguration.class })
|
||||
@ConditionalOnProperty(value = "spring.sleuth.quartz.enabled", matchIfMissing = true)
|
||||
public class TraceQuartzAutoConfiguration implements InitializingBean {
|
||||
class TraceQuartzAutoConfiguration implements InitializingBean {
|
||||
|
||||
private Scheduler scheduler;
|
||||
|
||||
private Tracing tracing;
|
||||
|
||||
public TraceQuartzAutoConfiguration(Scheduler scheduler, Tracing tracing) {
|
||||
TraceQuartzAutoConfiguration(Scheduler scheduler, Tracing tracing) {
|
||||
this.scheduler = scheduler;
|
||||
this.tracing = tracing;
|
||||
}
|
||||
|
||||
@@ -25,8 +25,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @since 2.0.2
|
||||
*/
|
||||
@ConfigurationProperties("spring.sleuth.reactor")
|
||||
// TODO: Hide in 3.x, if it isn't already deleted
|
||||
public class SleuthReactorProperties {
|
||||
class SleuthReactorProperties {
|
||||
|
||||
/**
|
||||
* When true enables instrumentation for reactor.
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
||||
import org.springframework.cloud.context.scope.refresh.RefreshScope;
|
||||
import org.springframework.cloud.context.scope.refresh.RefreshScopeRefreshedEvent;
|
||||
import org.springframework.cloud.sleuth.instrument.async.TraceableScheduledExecutorService;
|
||||
import org.springframework.cloud.sleuth.instrument.web.TraceWebFluxAutoConfiguration;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -55,16 +54,14 @@ import static org.springframework.cloud.sleuth.instrument.reactor.TraceReactorAu
|
||||
* @author Stephane Maldini
|
||||
* @author Marcin Grzejszczak
|
||||
* @since 2.0.0
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(value = "spring.sleuth.reactor.enabled", matchIfMissing = true)
|
||||
@ConditionalOnClass(Mono.class)
|
||||
@AutoConfigureAfter(TraceWebFluxAutoConfiguration.class)
|
||||
@AutoConfigureAfter(
|
||||
name = "org.springframework.cloud.sleuth.instrument.web.TraceWebFluxAutoConfiguration")
|
||||
@EnableConfigurationProperties(SleuthReactorProperties.class)
|
||||
public class TraceReactorAutoConfiguration {
|
||||
class TraceReactorAutoConfiguration {
|
||||
|
||||
static final String SLEUTH_REACTOR_EXECUTOR_SERVICE_KEY = "sleuth";
|
||||
|
||||
|
||||
@@ -39,16 +39,13 @@ import org.springframework.context.annotation.Configuration;
|
||||
*
|
||||
* @author Chao Chang
|
||||
* @since 2.2.0
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(value = "spring.sleuth.redis.enabled", matchIfMissing = true)
|
||||
@ConditionalOnBean({ Tracing.class, ClientResources.class })
|
||||
@AutoConfigureAfter({ TraceAutoConfiguration.class })
|
||||
@EnableConfigurationProperties(TraceRedisProperties.class)
|
||||
public class TraceRedisAutoConfiguration {
|
||||
class TraceRedisAutoConfiguration {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class LettuceConfig {
|
||||
|
||||
@@ -24,8 +24,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @author Daniel Albuquerque
|
||||
*/
|
||||
@ConfigurationProperties("spring.sleuth.redis")
|
||||
// TODO: Hide in 3.x, if it isn't already deleted
|
||||
public class TraceRedisProperties {
|
||||
class TraceRedisProperties {
|
||||
|
||||
/**
|
||||
* Enable span information propagation when using Redis.
|
||||
|
||||
@@ -37,10 +37,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
*
|
||||
* @author Shivang Shah
|
||||
* @since 1.0.0
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfigureAfter(TraceAutoConfiguration.class)
|
||||
@ConditionalOnBean(Tracing.class)
|
||||
@@ -48,7 +45,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
@ConditionalOnProperty(value = "spring.sleuth.rxjava.schedulers.hook.enabled",
|
||||
matchIfMissing = true)
|
||||
@EnableConfigurationProperties(SleuthRxJavaSchedulersProperties.class)
|
||||
public class RxJavaAutoConfiguration {
|
||||
class RxJavaAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
SleuthRxJavaSchedulersHook sleuthRxJavaSchedulersHook(Tracer tracer,
|
||||
|
||||
@@ -25,8 +25,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @since 1.0.12
|
||||
*/
|
||||
@ConfigurationProperties("spring.sleuth.rxjava.schedulers")
|
||||
// TODO: Hide in 3.x, if it isn't already deleted
|
||||
public class SleuthRxJavaSchedulersProperties {
|
||||
class SleuthRxJavaSchedulersProperties {
|
||||
|
||||
/**
|
||||
* Thread names for which spans will not be sampled.
|
||||
|
||||
@@ -26,8 +26,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @since 1.0.12
|
||||
*/
|
||||
@ConfigurationProperties("spring.sleuth.scheduled")
|
||||
// TODO: Hide in 3.x, if it isn't already deleted
|
||||
public class SleuthSchedulingProperties {
|
||||
class SleuthSchedulingProperties {
|
||||
|
||||
/**
|
||||
* Enable tracing for {@link org.springframework.scheduling.annotation.Scheduled}.
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
|
||||
import org.springframework.cloud.sleuth.util.SpanNameUtil;
|
||||
import org.springframework.cloud.sleuth.internal.SpanNameUtil;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
@@ -41,12 +41,9 @@ import org.springframework.lang.Nullable;
|
||||
* @author Spencer Gibb
|
||||
* @since 1.0.0
|
||||
* @see Tracing
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Aspect
|
||||
public class TraceSchedulingAspect {
|
||||
class TraceSchedulingAspect {
|
||||
|
||||
private static final String CLASS_KEY = "class";
|
||||
|
||||
@@ -57,7 +54,7 @@ public class TraceSchedulingAspect {
|
||||
@Nullable
|
||||
private final Pattern skipPattern;
|
||||
|
||||
public TraceSchedulingAspect(Tracer tracer, Pattern skipPattern) {
|
||||
TraceSchedulingAspect(Tracer tracer, Pattern skipPattern) {
|
||||
this.tracer = tracer;
|
||||
this.skipPattern = skipPattern;
|
||||
}
|
||||
|
||||
@@ -37,17 +37,14 @@ import org.springframework.context.annotation.Configuration;
|
||||
* @author Spencer Gibb
|
||||
* @since 1.0.0
|
||||
* @see TraceSchedulingAspect
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass(name = "org.aspectj.lang.ProceedingJoinPoint")
|
||||
@ConditionalOnProperty(value = "spring.sleuth.scheduled.enabled", matchIfMissing = true)
|
||||
@ConditionalOnBean(Tracing.class)
|
||||
@AutoConfigureAfter(TraceAutoConfiguration.class)
|
||||
@EnableConfigurationProperties(SleuthSchedulingProperties.class)
|
||||
public class TraceSchedulingAutoConfiguration {
|
||||
class TraceSchedulingAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public TraceSchedulingAspect traceSchedulingAspect(Tracer tracer,
|
||||
|
||||
@@ -53,16 +53,13 @@ import org.springframework.util.StringUtils;
|
||||
* @author Marcin Grzejszczak
|
||||
* @author Tim Ysewyn
|
||||
* @since 1.0.0
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(value = "spring.sleuth.web.enabled", matchIfMissing = true)
|
||||
@ConditionalOnBean(Tracing.class)
|
||||
@AutoConfigureAfter(TraceAutoConfiguration.class)
|
||||
@EnableConfigurationProperties(SleuthWebProperties.class)
|
||||
public class TraceWebAutoConfiguration {
|
||||
class SkipPatternConfiguration {
|
||||
|
||||
@Autowired(required = false)
|
||||
List<SingleSkipPattern> patterns = new ArrayList<>();
|
||||
@@ -25,8 +25,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@ConfigurationProperties("spring.sleuth.http")
|
||||
// TODO: Hide in 3.x, if it isn't already deleted
|
||||
public class SleuthHttpProperties {
|
||||
class SleuthHttpProperties {
|
||||
|
||||
private boolean enabled = true;
|
||||
|
||||
|
||||
@@ -26,8 +26,7 @@ import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
||||
* @since 1.0.12
|
||||
*/
|
||||
@ConfigurationProperties("spring.sleuth.web")
|
||||
// TODO: Hide in 3.x, if it isn't already deleted
|
||||
public class SleuthWebProperties {
|
||||
class SleuthWebProperties {
|
||||
|
||||
/**
|
||||
* Default set of skip patterns.
|
||||
@@ -71,7 +70,7 @@ public class SleuthWebProperties {
|
||||
|
||||
/**
|
||||
* If set to true, auto-configured skip patterns will be ignored.
|
||||
* @see TraceWebAutoConfiguration
|
||||
* @see SkipPatternConfiguration
|
||||
*/
|
||||
private boolean ignoreAutoConfiguredSkipPatterns = false;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ import org.springframework.lang.Nullable;
|
||||
@ConditionalOnBean(Tracing.class)
|
||||
@ConditionalOnClass(HttpTracing.class)
|
||||
@AutoConfigureAfter(TraceAutoConfiguration.class)
|
||||
@Import(TraceWebAutoConfiguration.class)
|
||||
@Import(SkipPatternConfiguration.class)
|
||||
// public allows @AutoConfigureAfter(TraceHttpAutoConfiguration)
|
||||
// for components needing HttpTracing
|
||||
public class TraceHttpAutoConfiguration {
|
||||
|
||||
@@ -51,13 +51,10 @@ import org.springframework.web.context.request.async.WebAsyncTask;
|
||||
* @since 1.0.0
|
||||
* @see org.springframework.stereotype.Controller
|
||||
* @see org.springframework.web.client.RestOperations
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("ArgNamesWarningsInspection")
|
||||
@Aspect
|
||||
public class TraceWebAspect {
|
||||
class TraceWebAspect {
|
||||
|
||||
private static final Log log = org.apache.commons.logging.LogFactory
|
||||
.getLog(TraceWebAspect.class);
|
||||
@@ -66,7 +63,7 @@ public class TraceWebAspect {
|
||||
|
||||
private final SpanNamer spanNamer;
|
||||
|
||||
public TraceWebAspect(Tracing tracing, SpanNamer spanNamer) {
|
||||
TraceWebAspect(Tracing tracing, SpanNamer spanNamer) {
|
||||
this.tracing = tracing;
|
||||
this.spanNamer = spanNamer;
|
||||
}
|
||||
|
||||
@@ -51,11 +51,8 @@ import org.springframework.web.server.WebFilterChain;
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
* @since 2.0.0
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
public final class TraceWebFilter implements WebFilter, Ordered {
|
||||
final class TraceWebFilter implements WebFilter, Ordered {
|
||||
|
||||
/**
|
||||
* If you register your filter before the {@link TraceWebFilter} then you will not
|
||||
|
||||
@@ -32,16 +32,13 @@ import org.springframework.context.annotation.Configuration;
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
* @since 2.0.0
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(value = "spring.sleuth.web.enabled", matchIfMissing = true)
|
||||
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
|
||||
@ConditionalOnBean(Tracing.class)
|
||||
@AutoConfigureAfter(TraceWebAutoConfiguration.class)
|
||||
public class TraceWebFluxAutoConfiguration {
|
||||
@AutoConfigureAfter(SkipPatternConfiguration.class)
|
||||
class TraceWebFluxAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public TraceWebFilter traceFilter(BeanFactory beanFactory) {
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.cloud.sleuth.SpanNamer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -52,17 +53,15 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
* @author Marcin Grzejszczak
|
||||
* @author Spencer Gibb
|
||||
* @since 1.0.0
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(value = "spring.sleuth.web.enabled", matchIfMissing = true)
|
||||
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
|
||||
@ConditionalOnBean(HttpTracing.class)
|
||||
@AutoConfigureAfter(TraceHttpAutoConfiguration.class)
|
||||
@EnableConfigurationProperties(SleuthWebProperties.class)
|
||||
@Import(SpanCustomizingAsyncHandlerInterceptor.class)
|
||||
public class TraceWebServletAutoConfiguration {
|
||||
class TraceWebServletAutoConfiguration {
|
||||
|
||||
/**
|
||||
* Default filter order for the Http tracing filter.
|
||||
|
||||
@@ -44,10 +44,7 @@ import org.springframework.web.client.AsyncRestTemplate;
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
* @since 1.0.0
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@SleuthWebClientEnabled
|
||||
@ConditionalOnProperty(value = "spring.sleuth.web.async.client.enabled",
|
||||
@@ -55,7 +52,7 @@ import org.springframework.web.client.AsyncRestTemplate;
|
||||
@ConditionalOnClass(AsyncRestTemplate.class)
|
||||
@ConditionalOnBean(HttpTracing.class)
|
||||
@AutoConfigureAfter(TraceHttpAutoConfiguration.class)
|
||||
public class TraceWebAsyncClientAutoConfiguration {
|
||||
class TraceWebAsyncClientAutoConfiguration {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnBean(AsyncRestTemplate.class)
|
||||
|
||||
@@ -62,16 +62,13 @@ import org.springframework.web.reactive.function.client.WebClient;
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
* @since 1.0.0
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@SleuthWebClientEnabled
|
||||
@ConditionalOnBean(HttpTracing.class)
|
||||
@AutoConfigureAfter(TraceHttpAutoConfiguration.class)
|
||||
@AutoConfigureBefore(HttpClientConfiguration.class)
|
||||
public class TraceWebClientAutoConfiguration {
|
||||
class TraceWebClientAutoConfiguration {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass(RestTemplate.class)
|
||||
|
||||
@@ -25,8 +25,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @since 2.0.2
|
||||
*/
|
||||
@ConfigurationProperties("spring.sleuth.feign")
|
||||
// TODO: Hide in 3.x, if it isn't already deleted
|
||||
public class SleuthFeignProperties {
|
||||
class SleuthFeignProperties {
|
||||
|
||||
/**
|
||||
* When true enables instrumentation for feign.
|
||||
|
||||
@@ -37,12 +37,8 @@ import org.springframework.cloud.openfeign.loadbalancer.FeignBlockingLoadBalance
|
||||
* @author Olga Maciaszek-Sharma
|
||||
* @since 2.2.0
|
||||
* @see FeignBlockingLoadBalancerClient
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
public class TraceFeignBlockingLoadBalancerClient
|
||||
extends FeignBlockingLoadBalancerClient {
|
||||
class TraceFeignBlockingLoadBalancerClient extends FeignBlockingLoadBalancerClient {
|
||||
|
||||
private static final Log LOG = LogFactory
|
||||
.getLog(TraceFeignBlockingLoadBalancerClient.class);
|
||||
|
||||
@@ -41,17 +41,14 @@ import org.springframework.context.annotation.Scope;
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
* @since 1.0.0
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(value = "spring.sleuth.feign.enabled", matchIfMissing = true)
|
||||
@ConditionalOnClass({ Client.class, FeignContext.class })
|
||||
@ConditionalOnBean(HttpTracing.class)
|
||||
@AutoConfigureBefore(FeignAutoConfiguration.class)
|
||||
@AutoConfigureAfter({ TraceHttpAutoConfiguration.class })
|
||||
public class TraceFeignClientAutoConfiguration {
|
||||
@AutoConfigureAfter(TraceHttpAutoConfiguration.class)
|
||||
class TraceFeignClientAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
|
||||
@@ -14,10 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.sleuth;
|
||||
package org.springframework.cloud.sleuth.internal;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.cloud.sleuth.SpanName;
|
||||
import org.springframework.cloud.sleuth.SpanNamer;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
|
||||
/**
|
||||
@@ -36,10 +38,7 @@ import org.springframework.core.annotation.AnnotationUtils;
|
||||
* @author Marcin Grzejszczak
|
||||
* @since 1.0.0
|
||||
* @see SpanName
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
public class DefaultSpanNamer implements SpanNamer {
|
||||
|
||||
private static boolean isDefaultToString(Object delegate, String spanName) {
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.sleuth.util;
|
||||
package org.springframework.cloud.sleuth.internal;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -23,9 +23,7 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author Adrian Cole
|
||||
* @since 1.0.2
|
||||
* @deprecated This type should have been internal. It will be hidden or removed in 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
public final class SpanNameUtil {
|
||||
|
||||
static final int MAX_NAME_LENGTH = 50;
|
||||
@@ -42,11 +42,8 @@ import org.springframework.util.Assert;
|
||||
* @author Marcin Grzejszczak
|
||||
* @author Adrian Cole
|
||||
* @since 1.0.0
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
public class ProbabilityBasedSampler extends Sampler {
|
||||
class ProbabilityBasedSampler extends Sampler {
|
||||
|
||||
private final AtomicInteger counter = new AtomicInteger(0);
|
||||
|
||||
@@ -54,7 +51,7 @@ public class ProbabilityBasedSampler extends Sampler {
|
||||
|
||||
private final SamplerProperties configuration;
|
||||
|
||||
public ProbabilityBasedSampler(SamplerProperties configuration) {
|
||||
ProbabilityBasedSampler(SamplerProperties configuration) {
|
||||
Assert.notNull(configuration.getProbability(),
|
||||
"probability property is required for ProbabilityBasedSampler");
|
||||
int outOf100 = (int) (configuration.getProbability() * 100.0f);
|
||||
|
||||
@@ -26,8 +26,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@ConfigurationProperties("spring.sleuth.sampler")
|
||||
// TODO: Hide in 3.x, if it isn't already deleted
|
||||
public class SamplerProperties {
|
||||
class SamplerProperties {
|
||||
|
||||
/**
|
||||
* Probability of requests that should be sampled. E.g. 1.0 - 100% requests should be
|
||||
|
||||
@@ -21,7 +21,7 @@ org.springframework.cloud.sleuth.instrument.messaging.SleuthKafkaStreamsConfigur
|
||||
org.springframework.cloud.sleuth.instrument.messaging.TraceMessagingAutoConfiguration,\
|
||||
org.springframework.cloud.sleuth.instrument.messaging.TraceSpringIntegrationAutoConfiguration,\
|
||||
org.springframework.cloud.sleuth.instrument.messaging.TraceSpringMessagingAutoConfiguration,\
|
||||
org.springframework.cloud.sleuth.instrument.messaging.websocket.TraceWebSocketAutoConfiguration,\
|
||||
org.springframework.cloud.sleuth.instrument.messaging.TraceWebSocketAutoConfiguration,\
|
||||
org.springframework.cloud.sleuth.instrument.opentracing.OpentracingAutoConfiguration,\
|
||||
org.springframework.cloud.sleuth.instrument.redis.TraceRedisAutoConfiguration,\
|
||||
org.springframework.cloud.sleuth.instrument.quartz.TraceQuartzAutoConfiguration
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@Order(99)
|
||||
public class PermitAllServletConfiguration extends WebSecurityConfigurerAdapter {
|
||||
class PermitAllServletConfiguration extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.security.config.web.server.ServerHttpSecurity;
|
||||
import org.springframework.security.web.server.SecurityWebFilterChain;
|
||||
|
||||
@Configuration
|
||||
public class PermitAllWebFluxSecurityConfiguration {
|
||||
class PermitAllWebFluxSecurityConfiguration {
|
||||
|
||||
@Bean
|
||||
SecurityWebFilterChain springWebFilterChain(ServerHttpSecurity http)
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.context.annotation.Import;
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@Configuration
|
||||
public class SleuthTestAutoConfiguration {
|
||||
class SleuthTestAutoConfiguration {
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
|
||||
|
||||
@@ -32,7 +32,6 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.cloud.sleuth.instrument.messaging.TraceMessagingAutoConfiguration;
|
||||
import org.springframework.cloud.sleuth.instrument.rpc.TraceRpcAutoConfiguration;
|
||||
import org.springframework.cloud.sleuth.instrument.web.TraceHttpAutoConfiguration;
|
||||
import org.springframework.cloud.sleuth.instrument.web.TraceWebAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.messaging.support.MessageHeaderAccessor;
|
||||
@@ -43,10 +42,9 @@ public class TraceAutoConfigurationCustomizersTests {
|
||||
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(TraceAutoConfiguration.class,
|
||||
TraceWebAutoConfiguration.class, TraceHttpAutoConfiguration.class,
|
||||
TraceRpcAutoConfiguration.class,
|
||||
FakeSpringMessagingAutoConfiguration.class,
|
||||
TraceMessagingAutoConfiguration.class))
|
||||
TraceHttpAutoConfiguration.class, TraceRpcAutoConfiguration.class,
|
||||
TraceMessagingAutoConfiguration.class,
|
||||
FakeSpringMessagingAutoConfiguration.class))
|
||||
.withUserConfiguration(Customizers.class);
|
||||
|
||||
@Test
|
||||
|
||||
@@ -27,11 +27,8 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.cloud.sleuth.instrument.web.TraceHttpAutoConfiguration;
|
||||
import org.springframework.cloud.sleuth.instrument.web.TraceWebAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
|
||||
public class TraceAutoConfigurationPropagationCustomizationTests {
|
||||
|
||||
@@ -71,18 +68,6 @@ public class TraceAutoConfigurationPropagationCustomizationTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hasNoCycles() {
|
||||
this.contextRunner
|
||||
.withConfiguration(AutoConfigurations.of(TraceWebAutoConfiguration.class,
|
||||
TraceHttpAutoConfiguration.class))
|
||||
.withInitializer(c -> ((GenericApplicationContext) c)
|
||||
.setAllowCircularReferences(false))
|
||||
.run((context) -> {
|
||||
BDDAssertions.then(context.isRunning()).isEqualTo(true);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void allowsCustomizationOfBuilder() {
|
||||
this.contextRunner
|
||||
|
||||
@@ -61,8 +61,8 @@ public class TraceAutoConfigurationWithDisabledSleuthTests {
|
||||
public void shouldNotContainAnyTracingInfoInTheLogs(CapturedOutput capture) {
|
||||
log.info("hello");
|
||||
|
||||
assertThat(applicationName).isEqualTo("foo"); // prove bootstrap-disabled.yml
|
||||
// loaded
|
||||
// prove bootstrap-disabled.yml loaded
|
||||
assertThat(applicationName).isEqualTo("foo");
|
||||
|
||||
// spring.application.name is put in the log format by
|
||||
// TraceEnvironmentPostProcessor
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.sleuth.baggage;
|
||||
package org.springframework.cloud.sleuth.autoconfig;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -27,7 +27,7 @@ import brave.baggage.CorrelationScopeConfig;
|
||||
import brave.baggage.CorrelationScopeConfig.SingleCorrelationField;
|
||||
import brave.baggage.CorrelationScopeCustomizer;
|
||||
import brave.baggage.CorrelationScopeDecorator;
|
||||
import brave.handler.FinishedSpanHandler;
|
||||
import brave.handler.SpanHandler;
|
||||
import brave.propagation.Propagation;
|
||||
import org.assertj.core.api.AbstractListAssert;
|
||||
import org.assertj.core.api.InstanceOfAssertFactories;
|
||||
@@ -39,6 +39,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.cloud.sleuth.autoconfig.TraceBaggageConfiguration.BaggageTagSpanHandler;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -152,18 +153,17 @@ public class TraceBaggageConfigurationTests {
|
||||
|
||||
static AbstractListAssert<?, List<? extends String>, String, ObjectAssert<String>> assertThatFieldNamesToTag(
|
||||
AssertableApplicationContext context) {
|
||||
return assertThat(context.getBean(FinishedSpanHandler.class))
|
||||
.isInstanceOf(BaggageTagFinishedSpanHandler.class)
|
||||
.extracting("fieldsToTag").asInstanceOf(array(BaggageField[].class))
|
||||
.extracting(BaggageField::name);
|
||||
return assertThat(context.getBean(SpanHandler.class))
|
||||
.isInstanceOf(BaggageTagSpanHandler.class).extracting("fieldsToTag")
|
||||
.asInstanceOf(array(BaggageField[].class)).extracting(BaggageField::name);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noopOnNoTagFields() {
|
||||
this.contextRunner.withPropertyValues("spring.sleuth.baggage.tag-fields=")
|
||||
.run((context) -> {
|
||||
assertThat(context.getBean(FinishedSpanHandler.class))
|
||||
.isSameAs(FinishedSpanHandler.NOOP);
|
||||
assertThat(context.getBean(SpanHandler.class))
|
||||
.isSameAs(SpanHandler.NOOP);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -42,9 +42,9 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@SpringBootTest(
|
||||
// WebEnvironment.NONE will not read a Yaml profile
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||
classes = BaggageTagFinishedSpanHandlerTest.Config.class)
|
||||
classes = BaggageTagSpanHandlerTest.Config.class)
|
||||
@ActiveProfiles("baggage") // application-baggage.yml
|
||||
public class BaggageTagFinishedSpanHandlerTest {
|
||||
public class BaggageTagSpanHandlerTest {
|
||||
|
||||
static final BaggageField COUNTRY_CODE = BaggageField.create("country-code");
|
||||
static final BaggageField REQUEST_ID = BaggageField.create("x-vcap-request-id");
|
||||
@@ -34,11 +34,11 @@ import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.cloud.sleuth.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.SpanName;
|
||||
import org.springframework.cloud.sleuth.SpanNamer;
|
||||
import org.springframework.cloud.sleuth.instrument.async.TraceCallable;
|
||||
import org.springframework.cloud.sleuth.instrument.async.TraceRunnable;
|
||||
import org.springframework.cloud.sleuth.internal.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -289,7 +289,7 @@ public class SpringCloudSleuthDocTests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
public class SamplingConfiguration {
|
||||
static class SamplingConfiguration {
|
||||
|
||||
// tag::always_sampler[]
|
||||
@Bean
|
||||
|
||||
@@ -34,8 +34,8 @@ import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.cloud.sleuth.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.SpanNamer;
|
||||
import org.springframework.cloud.sleuth.internal.DefaultSpanNamer;
|
||||
import org.springframework.scheduling.Trigger;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import org.springframework.util.ErrorHandler;
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.mockito.BDDMockito;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.cloud.sleuth.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.internal.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,8 +29,8 @@ import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.cloud.sleuth.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.SpanName;
|
||||
import org.springframework.cloud.sleuth.internal.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@@ -29,8 +29,8 @@ import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.cloud.sleuth.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.SpanName;
|
||||
import org.springframework.cloud.sleuth.internal.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@@ -45,8 +45,8 @@ import org.mockito.Mockito;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.cloud.sleuth.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.SpanNamer;
|
||||
import org.springframework.cloud.sleuth.internal.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
@@ -34,8 +34,8 @@ import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.cloud.sleuth.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.SpanNamer;
|
||||
import org.springframework.cloud.sleuth.internal.DefaultSpanNamer;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyLong;
|
||||
|
||||
@@ -57,7 +57,7 @@ public class SkipPatternProviderConfigTest {
|
||||
InfoEndpointAutoConfiguration.class,
|
||||
HealthEndpointAutoConfiguration.class,
|
||||
EndpointAutoConfiguration.class, WebEndpointAutoConfiguration.class,
|
||||
TraceAutoConfiguration.class, TraceWebAutoConfiguration.class));
|
||||
TraceAutoConfiguration.class, SkipPatternConfiguration.class));
|
||||
|
||||
@Test
|
||||
public void should_return_null_when_cleared() throws Exception {
|
||||
@@ -89,7 +89,7 @@ public class SkipPatternProviderConfigTest {
|
||||
@Test
|
||||
public void should_return_empty_when_management_context_has_no_context_path()
|
||||
throws Exception {
|
||||
Optional<Pattern> pattern = new TraceWebAutoConfiguration.ManagementSkipPatternProviderConfig()
|
||||
Optional<Pattern> pattern = new SkipPatternConfiguration.ManagementSkipPatternProviderConfig()
|
||||
.skipPatternForManagementServerProperties(
|
||||
new ManagementServerProperties())
|
||||
.skipPattern();
|
||||
@@ -114,7 +114,7 @@ public class SkipPatternProviderConfigTest {
|
||||
@Test
|
||||
public void should_return_empty_when_no_endpoints() {
|
||||
EndpointsSupplier<ExposableWebEndpoint> endpointsSupplier = Collections::emptyList;
|
||||
Optional<Pattern> pattern = new TraceWebAutoConfiguration.ActuatorSkipPatternProviderConfig()
|
||||
Optional<Pattern> pattern = new SkipPatternConfiguration.ActuatorSkipPatternProviderConfig()
|
||||
.skipPatternForActuatorEndpointsSamePort(new ServerProperties(),
|
||||
new WebEndpointProperties(), endpointsSupplier)
|
||||
.skipPattern();
|
||||
@@ -236,7 +236,7 @@ public class SkipPatternProviderConfigTest {
|
||||
|
||||
@Test
|
||||
public void should_combine_skip_patterns_from_list() throws Exception {
|
||||
TraceWebAutoConfiguration configuration = new TraceWebAutoConfiguration();
|
||||
SkipPatternConfiguration configuration = new SkipPatternConfiguration();
|
||||
configuration.patterns.addAll(Arrays.asList(foo(), bar()));
|
||||
|
||||
Pattern pattern = configuration.sleuthSkipPatternProvider().skipPattern();
|
||||
|
||||
@@ -22,6 +22,7 @@ import brave.http.HttpResponseParser;
|
||||
import brave.http.HttpTracing;
|
||||
import brave.sampler.SamplerFunction;
|
||||
import brave.sampler.SamplerFunctions;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
@@ -31,6 +32,7 @@ import org.springframework.boot.test.context.runner.ContextConsumer;
|
||||
import org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@@ -191,11 +193,23 @@ public class TraceHttpAutoConfigurationTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hasNoCycles() {
|
||||
contextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(SkipPatternConfiguration.class,
|
||||
TraceHttpAutoConfiguration.class))
|
||||
.withInitializer(c -> ((GenericApplicationContext) c)
|
||||
.setAllowCircularReferences(false))
|
||||
.run((context) -> {
|
||||
BDDAssertions.then(context.isRunning()).isEqualTo(true);
|
||||
});
|
||||
}
|
||||
|
||||
private ApplicationContextRunner contextRunner(String... propertyValues) {
|
||||
return new ApplicationContextRunner().withPropertyValues(propertyValues)
|
||||
.withConfiguration(AutoConfigurations.of(TraceAutoConfiguration.class,
|
||||
TraceHttpAutoConfiguration.class,
|
||||
TraceWebAutoConfiguration.class));
|
||||
SkipPatternConfiguration.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ import org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplier;
|
||||
import org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -129,8 +128,9 @@ public class WebClientDiscoveryExceptionTests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration(exclude = { EurekaClientAutoConfiguration.class,
|
||||
TraceWebServletAutoConfiguration.class })
|
||||
@EnableAutoConfiguration(
|
||||
excludeName = "org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration",
|
||||
exclude = EurekaClientAutoConfiguration.class)
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients
|
||||
@LoadBalancerClient("exceptionservice")
|
||||
|
||||
@@ -75,7 +75,6 @@ import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
|
||||
import org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplier;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -520,9 +519,10 @@ public class WebClientTests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration(exclude = { TraceWebServletAutoConfiguration.class,
|
||||
GatewayClassPathWarningAutoConfiguration.class,
|
||||
GatewayAutoConfiguration.class })
|
||||
@EnableAutoConfiguration(
|
||||
excludeName = "org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration",
|
||||
exclude = { GatewayClassPathWarningAutoConfiguration.class,
|
||||
GatewayAutoConfiguration.class })
|
||||
@EnableFeignClients
|
||||
@LoadBalancerClient(value = "fooservice",
|
||||
configuration = SimpleLoadBalancerClientConfiguration.class)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.sleuth.util;
|
||||
package org.springframework.cloud.sleuth.internal;
|
||||
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -32,15 +32,12 @@ import org.springframework.web.client.RestTemplate;
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
* @since 1.1.0
|
||||
* @deprecated This type should have never been public and will be hidden or removed in
|
||||
* 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
public class DefaultZipkinRestTemplateCustomizer implements ZipkinRestTemplateCustomizer {
|
||||
class DefaultZipkinRestTemplateCustomizer implements ZipkinRestTemplateCustomizer {
|
||||
|
||||
private final ZipkinProperties zipkinProperties;
|
||||
|
||||
public DefaultZipkinRestTemplateCustomizer(ZipkinProperties zipkinProperties) {
|
||||
DefaultZipkinRestTemplateCustomizer(ZipkinProperties zipkinProperties) {
|
||||
this.zipkinProperties = zipkinProperties;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @since 1.3.1
|
||||
*/
|
||||
@ConfigurationProperties("spring.zipkin.sender")
|
||||
// TODO: Hide in 3.x, if it isn't already deleted
|
||||
public class ZipkinSenderProperties {
|
||||
class ZipkinSenderProperties {
|
||||
|
||||
/**
|
||||
* Means of sending spans to Zipkin.
|
||||
|
||||
@@ -43,7 +43,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -135,7 +134,10 @@ public class Issue362Tests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration(exclude = TraceWebServletAutoConfiguration.class)
|
||||
@EnableAutoConfiguration(
|
||||
// spring boot test will otherwise instrument the client and server with the
|
||||
// same bean factory which isn't expected
|
||||
excludeName = "org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration")
|
||||
@EnableFeignClients(basePackageClasses = { SleuthTestController.class })
|
||||
class Application {
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -95,7 +94,10 @@ public class Issue393Tests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration(exclude = TraceWebServletAutoConfiguration.class)
|
||||
@EnableAutoConfiguration(
|
||||
// spring boot test will otherwise instrument the client and server with the
|
||||
// same bean factory which isn't expected
|
||||
excludeName = "org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration")
|
||||
@EnableFeignClients
|
||||
@EnableDiscoveryClient
|
||||
class Application {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.sleuth.instrument.messaging.websocket;
|
||||
package org.springframework.cloud.sleuth.instrument.messaging;
|
||||
|
||||
import brave.sampler.Sampler;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -22,7 +22,6 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.sleuth.instrument.messaging.TracingChannelInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
|
||||
@@ -16,11 +16,9 @@
|
||||
|
||||
package org.springframework.cloud.sleuth.instrument.web;
|
||||
|
||||
import brave.Tracing;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.sleuth.autoconfig.SleuthProperties;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
@@ -45,12 +43,6 @@ public abstract class AbstractMvcIntegrationTest {
|
||||
|
||||
protected MockMvc mockMvc;
|
||||
|
||||
@Autowired
|
||||
protected SleuthProperties properties;
|
||||
|
||||
@Autowired
|
||||
protected Tracing tracing;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
DefaultMockMvcBuilder mockMvcBuilder = MockMvcBuilders
|
||||
|
||||
@@ -47,7 +47,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.system.CapturedOutput;
|
||||
import org.springframework.boot.test.system.OutputCaptureExtension;
|
||||
import org.springframework.cloud.sleuth.instrument.web.client.TraceWebClientAutoConfiguration;
|
||||
import org.springframework.cloud.sleuth.util.BlockingQueueSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -160,7 +159,10 @@ public class TraceFilterWebIntegrationTests {
|
||||
return this.environment.getProperty("local.server.port", Integer.class);
|
||||
}
|
||||
|
||||
@EnableAutoConfiguration(exclude = TraceWebClientAutoConfiguration.class)
|
||||
@EnableAutoConfiguration(
|
||||
// spring boot test will otherwise instrument the client and server with the
|
||||
// same bean factory which isn't expected
|
||||
excludeName = "org.springframework.cloud.sleuth.instrument.web.client.TraceWebClientAutoConfiguration")
|
||||
@Configuration
|
||||
public static class Config {
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class TraceWebServletAutoConfigurationTests {
|
||||
|
||||
private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(TraceAutoConfiguration.class,
|
||||
TraceHttpAutoConfiguration.class, TraceWebAutoConfiguration.class,
|
||||
TraceHttpAutoConfiguration.class,
|
||||
TraceWebServletAutoConfiguration.class));
|
||||
|
||||
@Test
|
||||
|
||||
@@ -34,7 +34,6 @@ import zipkin2.Span;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Import;
|
||||
@@ -184,7 +183,10 @@ public class RestTemplateTraceAspectIntegrationTests {
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
|
||||
@EnableAutoConfiguration(exclude = TraceWebServletAutoConfiguration.class)
|
||||
@EnableAutoConfiguration(
|
||||
// spring boot test will otherwise instrument the client and server with the
|
||||
// same bean factory which isn't expected
|
||||
excludeName = "org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration")
|
||||
@Import(AspectTestingController.class)
|
||||
public static class Config {
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ import zipkin2.Span;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -127,9 +126,8 @@ public class TraceWebAsyncClientAutoConfigurationTests {
|
||||
|
||||
@EnableAutoConfiguration(
|
||||
// spring boot test will otherwise instrument the client and server with the
|
||||
// same bean factory
|
||||
// which isn't expected
|
||||
exclude = TraceWebServletAutoConfiguration.class)
|
||||
// same bean factory which isn't expected
|
||||
excludeName = "org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration")
|
||||
@Configuration
|
||||
public static class TestConfiguration {
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import reactor.netty.ByteBufFlux;
|
||||
import reactor.netty.http.client.HttpClient;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.cloud.sleuth.instrument.reactor.TraceReactorAutoConfiguration;
|
||||
import org.springframework.cloud.sleuth.instrument.reactor.TraceReactorAutoConfigurationAccessorConfiguration;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
@@ -37,8 +36,10 @@ import org.springframework.web.reactive.function.client.WebClient;
|
||||
public class ReactorNettyHttpClientBraveTests extends ITSpringConfiguredReactorClient {
|
||||
|
||||
/**
|
||||
* This borrows hooks from {@link TraceReactorAutoConfiguration} to ensure that the
|
||||
* invocation trace context is set in scope for hooks like {@link Subscriber#onNext}.
|
||||
* This borrows hooks from
|
||||
* {@code org.springframework.cloud.sleuth.instrument.reactor.TraceReactorAutoConfiguration}
|
||||
* to ensure that the invocation trace context is set in scope for hooks like
|
||||
* {@link Subscriber#onNext}.
|
||||
*
|
||||
* <p>
|
||||
* We do this implicitly until
|
||||
|
||||
@@ -33,7 +33,6 @@ import reactor.core.publisher.Mono;
|
||||
import org.springframework.boot.WebApplicationType;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.cloud.sleuth.instrument.web.client.TraceWebClientAutoConfiguration;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -161,7 +160,7 @@ public class TraceWebFluxTests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration(exclude = { TraceWebClientAutoConfiguration.class })
|
||||
@EnableAutoConfiguration
|
||||
static class Config {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(Config.class);
|
||||
|
||||
Reference in New Issue
Block a user