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
  • Example
  • Custom SA tag in Zipkin
  • Custom service name
  • +
  • Customization of reported spans
  • Host locator
  • @@ -2389,6 +2390,31 @@ Remember not to add both peer.service tag and the SA t
    +

    Customization of reported spans

    +
    +

    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.

    +
    +
    +

    Host locator

    In order to define the host that is corresponding to a particular span we need to resolve the host name