diff --git a/README.adoc b/README.adoc index b73b066ff..cb417443b 100644 --- a/README.adoc +++ b/README.adoc @@ -550,6 +550,64 @@ dependencies { <2> Add the dependency to `spring-cloud-starter-zipkin`. That way, all nested dependencies get downloaded. <3> To automatically configure RabbitMQ, add the `spring-rabbit` dependency. +=== Overriding the auto-configuration of Zipkin + +Spring Cloud Sleuth supports sending traces to multiple tracing systems as of version 2.1.0. +In order to get this to work, every tracing system needs to have a `Reporter` and `Sender`. +If you want to override the provided beans you need to give them a specific name. +To do this you can use respectively `ZipkinAutoConfiguration.REPORTER_BEAN_NAME` and `ZipkinAutoConfiguration.SENDER_BEAN_NAME`. + +[source,java] +---- + +@Configuration +protected static class MyConfig { + + @Bean(ZipkinAutoConfiguration.REPORTER_BEAN_NAME) + Reporter myReporter() { + return AsyncReporter.create(mySender()); + } + + @Bean(ZipkinAutoConfiguration.SENDER_BEAN_NAME) + MySender mySender() { + return new MySender(); + } + + static class MySender extends Sender { + + private boolean spanSent = false; + + boolean isSpanSent() { + return this.spanSent; + } + + @Override + public Encoding encoding() { + return Encoding.JSON; + } + + @Override + public int messageMaxBytes() { + return Integer.MAX_VALUE; + } + + @Override + public int messageSizeInBytes(List encodedSpans) { + return encoding().listSizeInBytes(encodedSpans); + } + + @Override + public Call sendSpans(List encodedSpans) { + this.spanSent = true; + return Call.create(null); + } + + } + +} + +---- + == Additional Resources You can watch a video of https://twitter.com/reshmi9k[Reshmi Krishna] and https://twitter.com/mgrzejszczak[Marcin Grzejszczak] talking about Spring Cloud diff --git a/pom.xml b/pom.xml index 1350df356..f1171f849 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,7 @@ org.springframework.cloud spring-cloud-build - 2.1.2.BUILD-SNAPSHOT + 2.1.3.BUILD-SNAPSHOT @@ -249,12 +249,12 @@ 1.8 1.8 1.8 - 2.1.2.BUILD-SNAPSHOT - 2.1.0.BUILD-SNAPSHOT - 2.1.0.BUILD-SNAPSHOT + 2.1.3.BUILD-SNAPSHOT + 2.1.1.BUILD-SNAPSHOT + 2.1.1.BUILD-SNAPSHOT Fishtown.BUILD-SNAPSHOT - 2.1.0.BUILD-SNAPSHOT - 2.1.0.BUILD-SNAPSHOT + 2.1.1.BUILD-SNAPSHOT + 2.1.1.BUILD-SNAPSHOT 5.6.1 2.1.2.RELEASE diff --git a/spring-cloud-sleuth-dependencies/pom.xml b/spring-cloud-sleuth-dependencies/pom.xml index bf9fcec4a..0c7c3c7c8 100644 --- a/spring-cloud-sleuth-dependencies/pom.xml +++ b/spring-cloud-sleuth-dependencies/pom.xml @@ -21,7 +21,7 @@ spring-cloud-dependencies-parent org.springframework.cloud - 2.1.2.BUILD-SNAPSHOT + 2.1.3.BUILD-SNAPSHOT spring-cloud-sleuth-dependencies