From b611a9b24d8aefe02979213f54d7e7ca79c2d67a Mon Sep 17 00:00:00 2001 From: buildmaster Date: Wed, 4 Apr 2018 15:11:16 +0000 Subject: [PATCH] Sync docs from 1.3.x to gh-pages --- .../multi/multi__sending_spans_to_zipkin.html | 19 ++++++++++++++++- 1.3.x/single/spring-cloud-sleuth.html | 19 ++++++++++++++++- 1.3.x/spring-cloud-sleuth.xml | 21 +++++++++++++++++++ 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/1.3.x/multi/multi__sending_spans_to_zipkin.html b/1.3.x/multi/multi__sending_spans_to_zipkin.html index a73a5d731..a749b0b1b 100644 --- a/1.3.x/multi/multi__sending_spans_to_zipkin.html +++ b/1.3.x/multi/multi__sending_spans_to_zipkin.html @@ -16,4 +16,21 @@ that you can set up the load balancing configuration e.g. via Ribbon.

    ListOfServers: host1,host2

If you have web, rabbit or kafka together on the classpath, you might need to pick the means by which you would like to send spans to zipkin. To do that just set either web, rabbit or kafka to the spring.zipkin.sender.type property. -Example for web:

spring.zipkin.sender.type: web
\ No newline at end of file +Example for web:

spring.zipkin.sender.type: web

To customize the RestTemplate that sends spans to Zipkin via HTTP, you can register +the ZipkinRestTemplateCustomizer bean.

@Configuration
+class MyConfig {
+	@Bean ZipkinRestTemplateCustomizer myCustomizer() {
+		return new ZipkinRestTemplateCustomizer() {
+			@Override
+			void customize(RestTemplate restTemplate) {
+				// customize the RestTemplate
+			}
+		};
+	}
+}

If, however, you would like to control the full process of creating the RestTemplate +object, you will have to create a bean of zipkin2.reporter.Sender type.

	@Bean Sender myRestTemplateSender(ZipkinProperties zipkin,
+			ZipkinRestTemplateCustomizer zipkinRestTemplateCustomizer) {
+		RestTemplate restTemplate = mySuperCustomRestTemplate();
+		zipkinRestTemplateCustomizer.customize(restTemplate);
+		return new RestTemplateSender(restTemplate, zipkin.getBaseUrl(), zipkin.getEncoder());
+	}
\ No newline at end of file diff --git a/1.3.x/single/spring-cloud-sleuth.html b/1.3.x/single/spring-cloud-sleuth.html index 8834a9e15..cceba2481 100644 --- a/1.3.x/single/spring-cloud-sleuth.html +++ b/1.3.x/single/spring-cloud-sleuth.html @@ -579,7 +579,24 @@ that you can set up the load balancing configuration e.g. via Ribbon.

    ListOfServers: host1,host2

If you have web, rabbit or kafka together on the classpath, you might need to pick the means by which you would like to send spans to zipkin. To do that just set either web, rabbit or kafka to the spring.zipkin.sender.type property. -Example for web:

spring.zipkin.sender.type: web

11. Span Data as Messages

You can accumulate and send span data over +Example for web:

spring.zipkin.sender.type: web

To customize the RestTemplate that sends spans to Zipkin via HTTP, you can register +the ZipkinRestTemplateCustomizer bean.

@Configuration
+class MyConfig {
+	@Bean ZipkinRestTemplateCustomizer myCustomizer() {
+		return new ZipkinRestTemplateCustomizer() {
+			@Override
+			void customize(RestTemplate restTemplate) {
+				// customize the RestTemplate
+			}
+		};
+	}
+}

If, however, you would like to control the full process of creating the RestTemplate +object, you will have to create a bean of zipkin2.reporter.Sender type.

	@Bean Sender myRestTemplateSender(ZipkinProperties zipkin,
+			ZipkinRestTemplateCustomizer zipkinRestTemplateCustomizer) {
+		RestTemplate restTemplate = mySuperCustomRestTemplate();
+		zipkinRestTemplateCustomizer.customize(restTemplate);
+		return new RestTemplateSender(restTemplate, zipkin.getBaseUrl(), zipkin.getEncoder());
+	}

11. Span Data as Messages

You can accumulate and send span data over Spring Cloud Stream by including the spring-cloud-sleuth-stream jar as a dependency, and adding a Channel Binder implementation diff --git a/1.3.x/spring-cloud-sleuth.xml b/1.3.x/spring-cloud-sleuth.xml index 4713722b2..e381541c6 100644 --- a/1.3.x/spring-cloud-sleuth.xml +++ b/1.3.x/spring-cloud-sleuth.xml @@ -1317,6 +1317,27 @@ to pick the means by which you would like to send spans to zipkin. To do that just set either web, rabbit or kafka to the spring.zipkin.sender.type property. Example for web: spring.zipkin.sender.type: web +To customize the RestTemplate that sends spans to Zipkin via HTTP, you can register +the ZipkinRestTemplateCustomizer bean. +@Configuration +class MyConfig { + @Bean ZipkinRestTemplateCustomizer myCustomizer() { + return new ZipkinRestTemplateCustomizer() { + @Override + void customize(RestTemplate restTemplate) { + // customize the RestTemplate + } + }; + } +} +If, however, you would like to control the full process of creating the RestTemplate +object, you will have to create a bean of zipkin2.reporter.Sender type. + @Bean Sender myRestTemplateSender(ZipkinProperties zipkin, + ZipkinRestTemplateCustomizer zipkinRestTemplateCustomizer) { + RestTemplate restTemplate = mySuperCustomRestTemplate(); + zipkinRestTemplateCustomizer.customize(restTemplate); + return new RestTemplateSender(restTemplate, zipkin.getBaseUrl(), zipkin.getEncoder()); + } Span Data as Messages