@Bean
+SpanAdjuster customSpanAdjuster() {
+ return span -> span.toBuilder().name(scrub(span.getName())).build();
+}
+diff --git a/spring-cloud-sleuth.html b/spring-cloud-sleuth.html index 97c249f0d..cd8299e93 100644 --- a/spring-cloud-sleuth.html +++ b/spring-cloud-sleuth.html @@ -491,6 +491,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
peer.service tag and the SA t
Before reporting spans to e.g. Zipkin you can be interested in modifying that span in some way.
+ You can achieve that by using the SpanAdjuster interface.
Example of usage:
+In Sleuth we’re generating spans with a fixed name. Some users want to modify the name depending on values
+of tags. Implementation of the SpanAdjuster interface can be used to alter that name. Example:
@Bean
+SpanAdjuster customSpanAdjuster() {
+ return span -> span.toBuilder().name(scrub(span.getName())).build();
+}
+This will lead in changing the name of the reported span just before it gets sent to Zipkin.
+In order to define the host that is corresponding to a particular span we need to resolve the host name