Moves responsibility to import SamplerAutoConfiguration to core
Before, spring-cloud-sleuth-zipkin had to import `SamplerAutoConfiguration` directly to unwind a sampler ordering problem caused by `TraceAutoConfiguration` defining the default `Sampler` bean. This fixes that by moving the default `Sampler` to where it belongs (`SamplerAutoConfiguration`) and having `TraceAutoConfiguration` import the sampling configuration directly as opposed to relying on auto-configuration ordering. Finally it removes the mistake of setting `SamplerAutoConfiguration` as auto-configuration in the first place. The name `SamplerAutoConfiguration` was left alone because changing it would interfere with 3rd party code that formerly imported it to correct this issue in their non-zipkin setups. Fixes #1618
This commit is contained in:
@@ -36,7 +36,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
||||
import org.springframework.cloud.client.serviceregistry.Registration;
|
||||
import org.springframework.cloud.commons.util.InetUtils;
|
||||
import org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration;
|
||||
import org.springframework.cloud.sleuth.sampler.SamplerAutoConfiguration;
|
||||
import org.springframework.cloud.sleuth.zipkin2.sender.ZipkinSenderConfigurationImportSelector;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -46,8 +45,7 @@ import org.springframework.web.client.RestTemplate;
|
||||
|
||||
/**
|
||||
* {@link org.springframework.boot.autoconfigure.EnableAutoConfiguration
|
||||
* Auto-configuration} enables reporting to Zipkin via HTTP. Has a default sampler set
|
||||
* from the {@link SamplerAutoConfiguration}
|
||||
* Auto-configuration} enables reporting to Zipkin via HTTP.
|
||||
*
|
||||
* The {@link ZipkinRestTemplateCustomizer} allows you to customize the
|
||||
* {@link RestTemplate} that is used to send Spans to Zipkin. Its default implementation -
|
||||
@@ -56,7 +54,6 @@ import org.springframework.web.client.RestTemplate;
|
||||
* @author Spencer Gibb
|
||||
* @author Tim Ysewyn
|
||||
* @since 1.0.0
|
||||
* @see SamplerAutoConfiguration
|
||||
* @see ZipkinRestTemplateCustomizer
|
||||
* @see DefaultZipkinRestTemplateCustomizer
|
||||
*/
|
||||
@@ -66,7 +63,7 @@ import org.springframework.web.client.RestTemplate;
|
||||
"spring.zipkin.enabled" }, matchIfMissing = true)
|
||||
@AutoConfigureBefore(TraceAutoConfiguration.class)
|
||||
@AutoConfigureAfter(name = "org.springframework.cloud.autoconfigure.RefreshAutoConfiguration")
|
||||
@Import({ ZipkinSenderConfigurationImportSelector.class, SamplerAutoConfiguration.class })
|
||||
@Import(ZipkinSenderConfigurationImportSelector.class)
|
||||
public class ZipkinAutoConfiguration {
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user