diff --git a/1.0.x/index.html b/1.0.x/index.html index 3aa9fca1d..bd48a8215 100644 --- a/1.0.x/index.html +++ b/1.0.x/index.html @@ -451,6 +451,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
  • Spring Integration
  • HTTP
  • Example
  • +
  • Custom SA tag in Zipkin
  • Span Data as Messages @@ -1804,6 +1805,44 @@ SpanInjector<HttpServletResponse> customHttpServletResponseSpanInjector() +
    +

    Custom SA tag in Zipkin

    +
    +

    Sometimes you want to create a manual Span that will wrap a call to an external service which is not instrumented. +What you can do is to create a span with the peer.service tag that will contain a value of the service that you want to call. +Below you can see an example of a call to Redis that is wrapped in such a span.

    +
    +
    +
    +
    org.springframework.cloud.sleuth.Span newSpan = tracer.createSpan("redis");
    +try {
    +	newSpan.tag("redis.op", "get");
    +	newSpan.tag("lc", "redis");
    +	newSpan.logEvent(org.springframework.cloud.sleuth.Span.CLIENT_SEND);
    +	// call redis service e.g
    +	// return (SomeObj) redisTemplate.opsForHash().get("MYHASH", someObjKey);
    +} finally {
    +	newSpan.tag("peer.service", "redisService");
    +	newSpan.tag("peer.ipv4", "1.2.3.4");
    +	newSpan.tag("peer.port", "1234");
    +	newSpan.logEvent(org.springframework.cloud.sleuth.Span.CLIENT_RECV);
    +	tracer.close(newSpan);
    +}
    +
    +
    +
    + + + + + +
    +
    Important
    +
    +Remember not to add both peer.service tag and the SA tag! You have to add only peer.service. +
    +
    +
    @@ -2260,7 +2299,7 @@ To disable Zuul support set the spring.sleuth.zuul.enabled property