Added docs related to customization of zipkin rest template; fixes gh-924

This commit is contained in:
Marcin Grzejszczak
2018-04-04 17:09:05 +02:00
parent 1c1b963862
commit 50c81da505

View File

@@ -548,6 +548,37 @@ 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.
[source,java]
----
@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.
[source,java]
----
@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
You can accumulate and send span data over