This commit is contained in:
Marcin Grzejszczak
2019-01-21 10:59:27 +01:00
parent eda5781643
commit ab44f141e4
2 changed files with 14 additions and 3 deletions

View File

@@ -105,6 +105,17 @@ class ZipkinBackwardsCompatibilityAutoConfiguration {
return new InMemoryReporterMetrics();
}
/**
* Old approach:
* - one sender
* - one reporter
*
* This auto configuration verifies if we have the old approach. In which
* case we define the missing beans.
*
* In case of having more senders and more reporters, we don't need to
* use the backward compatiblity bean setup.
*/
static class BackwardsCompatibilityCondition extends SpringBootCondition
implements ConfigurationCondition {
@@ -126,9 +137,9 @@ class ZipkinBackwardsCompatibilityAutoConfiguration {
// Previously we supported 1 Sender bean at a time
// which could be overridden by another auto-configuration.
// Now we support both the overridden bean and our default zipkinSender bean.
if (foundSenders < 2) {
if (foundSenders > 1) {
return ConditionOutcome.noMatch(
"We don't support backwards compatibility for more than 2 Sender beans");
"We don't support backwards compatibility for more than 1 Sender beans");
}
int foundReporters = listableBeanFactory
.getBeanNamesForType(Reporter.class).length;

View File

@@ -1,4 +1,4 @@
# Auto Configuration
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.springframework.cloud.sleuth.zipkin2.ZipkinAutoConfiguration,\
org.springframework.cloud.sleuth.zipkin2.ZipkinBackwardsCompatibilityAutoConfiguration
org.springframework.cloud.sleuth.zipkin2.ZipkinBackwardsCompatibilityAutoConfiguration