From aabae5668512a6b3951cf3d26ffa8609e6a5cb14 Mon Sep 17 00:00:00 2001 From: buildmaster Date: Sun, 22 Oct 2017 16:37:54 +0000 Subject: [PATCH] Sync docs from 2.0.x to gh-pages --- 2.0.x/multi/multi__features.html | 6 +- 2.0.x/multi/multi__introduction.html | 89 ++--------- 2.0.x/multi/multi_spring-cloud-sleuth.html | 2 +- 2.0.x/single/spring-cloud-sleuth.html | 97 +++--------- 2.0.x/spring-cloud-sleuth.xml | 162 ++++----------------- 5 files changed, 63 insertions(+), 293 deletions(-) diff --git a/2.0.x/multi/multi__features.html b/2.0.x/multi/multi__features.html index c577c4ff2..d3502ab6d 100644 --- a/2.0.x/multi/multi__features.html +++ b/2.0.x/multi/multi__features.html @@ -10,11 +10,9 @@ latency in your applications. Sleuth is written to not log too much, and to not rest template, scheduled actions, message channels, zuul filters, feign client).
  • Sleuth includes default logic to join a trace across http or messaging boundaries. For example, http propagation works via Zipkin-compatible request headers. This propagation logic is defined and customized via SpanInjector and SpanExtractor implementations.
  • Sleuth gives you the possibility to propagate context (also known as baggage) between processes. That means that if you set on a Span -a baggage element then it will be sent downstream either via HTTP or messaging to other processes.
  • Provides a way to create / continue spans and add tags and logs via annotations.
  • Provides simple metrics of accepted / dropped spans.
  • If spring-cloud-sleuth-zipkin then the app will generate and collect Zipkin-compatible traces. +a baggage element then it will be sent downstream either via HTTP or messaging to other processes.
  • Provides a way to create / continue spans and add tags and logs via annotations.
  • Provides simple metrics of accepted / dropped spans.
  • If spring-cloud-sleuth-zipkin2 then the app will generate and collect Zipkin-compatible traces. By default it sends them via HTTP to a Zipkin server on localhost (port 9411). -Configure the location of the service using spring.zipkin.baseUrl.

  • If spring-cloud-sleuth-stream then the app will generate and collect traces via Spring Cloud Stream. -Your app automatically becomes a producer of tracer messages that are sent over your broker of choice -(e.g. RabbitMQ, Apache Kafka, Redis).
  • [Important]Important

    If using Zipkin or Stream, configure the percentage of spans exported using spring.sleuth.sampler.percentage +Configure the location of the service using spring.zipkin.baseUrl.

    • If you depend on spring-rabbit or spring-kafka your app will send traces to a broker instead of http.
    • Note: spring-cloud-sleuth-stream is deprecated and should no longer be used.
    [Important]Important

    If using Zipkin, configure the percentage of spans exported using spring.sleuth.sampler.percentage (default 0.1, i.e. 10%). Otherwise you might think that Sleuth is not working cause it’s omitting some spans.

    [Note]Note

    the SLF4J MDC is always set and logback users will immediately see the trace and span ids in logs per the example above. Other logging systems have to configure their own formatter to get the same result. The default is logging.pattern.level set to %5p [${spring.zipkin.service.name:${spring.application.name:-}},%X{X-B3-TraceId:-},%X{X-B3-SpanId:-},%X{X-Span-Export:-}] diff --git a/2.0.x/multi/multi__introduction.html b/2.0.x/multi/multi__introduction.html index 6926954b2..6e7437f80 100644 --- a/2.0.x/multi/multi__introduction.html +++ b/2.0.x/multi/multi__introduction.html @@ -169,7 +169,7 @@ dependencies { "org.springframework.cloud:spring-cloud-starter-sleuth" }

    1

    In order not to pick versions by yourself it’s much better if you add the dependency management via -the Spring BOM

    2

    Add the dependency to spring-cloud-starter-sleuth

    1.3.2 Sleuth with Zipkin via HTTP

    If you want both Sleuth and Zipkin just add the spring-cloud-starter-zipkin dependency.

    Maven.  +the Spring BOM

    2

    Add the dependency to spring-cloud-starter-sleuth

    1.3.2 Sleuth with Zipkin via HTTP

    If you want both Sleuth and Zipkin just add the spring-cloud-starter-zipkin2 dependency.

    Maven. 

    <dependencyManagement> 1
              <dependencies>
                  <dependency>
    @@ -184,10 +184,10 @@ the Spring BOM

    <dependency> 2 <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-zipkin</artifactId> + <artifactId>spring-cloud-starter-zipkin2</artifactId> </dependency>

    1

    In order not to pick versions by yourself it’s much better if you add the dependency management via -the Spring BOM

    2

    Add the dependency to spring-cloud-starter-zipkin

    Gradle.  +the Spring BOM

    2

    Add the dependency to spring-cloud-starter-zipkin2

    Gradle. 

    dependencyManagement { 1
         imports {
             mavenBom "org.springframework.cloud:spring-cloud-dependencies:${releaseTrainVersion}"
    @@ -195,10 +195,12 @@ the Spring BOM

    2 - compile "org.springframework.cloud:spring-cloud-starter-zipkin" + compile "org.springframework.cloud:spring-cloud-starter-zipkin2" }

    1

    In order not to pick versions by yourself it’s much better if you add the dependency management via -the Spring BOM

    2

    Add the dependency to spring-cloud-starter-zipkin

    1.3.3 Sleuth with Zipkin via Spring Cloud Stream

    If you want both Sleuth and Zipkin just add the spring-cloud-sleuth-stream dependency.

    Maven.  +the Spring BOM

    2

    Add the dependency to spring-cloud-starter-zipkin2

    1.3.3 Sleuth with Zipkin via RabbitMQ or Kafka

    If you want to use RabbitMQ or Kafka instead of http, add the spring-rabbit or spring-kafka +dependencies. The default destination name is zipkin.

    Note: spring-cloud-sleuth-stream is deprecated and incompatible with these destinations

    If you want Sleuth over RabbitMQ add the spring-cloud-sleuth-starter-zipkin2 and spring-rabbit +dependencies.

    Maven. 

    <dependencyManagement> 1
              <dependencies>
                  <dependency>
    @@ -213,19 +215,14 @@ the Spring BOM

    <dependency> 2 <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-sleuth-stream</artifactId> + <artifactId>spring-cloud-sleuth-starter-zipkin2</artifactId> </dependency> <dependency> 3 - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-sleuth</artifactId> - </dependency> - <!-- EXAMPLE FOR RABBIT BINDING --> - <dependency> 4 - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-stream-binder-rabbit</artifactId> + <groupId>org.springframework.amqp</groupId> + <artifactId>spring-rabbit</artifactId> </dependency>

    1

    In order not to pick versions by yourself it’s much better if you add the dependency management via -the Spring BOM

    2

    Add the dependency to spring-cloud-sleuth-stream

    3

    Add the dependency to spring-cloud-starter-sleuth - that way all dependant dependencies will be downloaded

    4

    Add a binder (e.g. Rabbit binder) to tell Spring Cloud Stream what it should bind to

    Gradle.  +the Spring BOM

    2

    Add the dependency to spring-cloud-starter-sleuth-zipkin2 - that way all dependent dependencies will be downloaded

    3

    To automatically configure rabbit, simply add the spring-rabbit dependency

    Gradle. 

    dependencyManagement { 1
         imports {
             mavenBom "org.springframework.cloud:spring-cloud-dependencies:${releaseTrainVersion}"
    @@ -233,66 +230,8 @@ the Spring BOM

    "org.springframework.cloud:spring-cloud-sleuth-stream" 2 - compile "org.springframework.cloud:spring-cloud-starter-sleuth" 3 - // Example for Rabbit binding - compile "org.springframework.cloud:spring-cloud-stream-binder-rabbit" 4 + compile "org.springframework.cloud:spring-cloud-starter-sleuth-zipkin2" 2 + compile "org.springframework.amqp:spring-rabbit" 3 }

    1

    In order not to pick versions by yourself it’s much better if you add the dependency management via -the Spring BOM

    2

    Add the dependency to spring-cloud-sleuth-stream

    3

    Add the dependency to spring-cloud-starter-sleuth - that way all dependant dependencies will be downloaded

    4

    Add a binder (e.g. Rabbit binder) to tell Spring Cloud Stream what it should bind to

    1.3.4 Spring Cloud Sleuth Stream Zipkin Collector

    If you want to start a Spring Cloud Sleuth Stream Zipkin collector just add the spring-cloud-sleuth-zipkin-stream -dependency

    Maven.  -

    <dependencyManagement> 1
    -         <dependencies>
    -             <dependency>
    -                 <groupId>org.springframework.cloud</groupId>
    -                 <artifactId>spring-cloud-dependencies</artifactId>
    -                 <version>${release.train.version}</version>
    -                 <type>pom</type>
    -                 <scope>import</scope>
    -             </dependency>
    -         </dependencies>
    -   </dependencyManagement>
    -
    -   <dependency> 2
    -       <groupId>org.springframework.cloud</groupId>
    -       <artifactId>spring-cloud-sleuth-zipkin-stream</artifactId>
    -   </dependency>
    -   <dependency> 3
    -       <groupId>org.springframework.cloud</groupId>
    -       <artifactId>spring-cloud-starter-sleuth</artifactId>
    -   </dependency>
    -   <!-- EXAMPLE FOR RABBIT BINDING -->
    -   <dependency> 4
    -       <groupId>org.springframework.cloud</groupId>
    -       <artifactId>spring-cloud-stream-binder-rabbit</artifactId>
    -   </dependency>

    -

    1

    In order not to pick versions by yourself it’s much better if you add the dependency management via -the Spring BOM

    2

    Add the dependency to spring-cloud-sleuth-zipkin-stream

    3

    Add the dependency to spring-cloud-starter-sleuth - that way all dependant dependencies will be downloaded

    4

    Add a binder (e.g. Rabbit binder) to tell Spring Cloud Stream what it should bind to

    Gradle.  -

    dependencyManagement { 1
    -    imports {
    -        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${releaseTrainVersion}"
    -    }
    -}
    -
    -dependencies {
    -    compile "org.springframework.cloud:spring-cloud-sleuth-zipkin-stream" 2
    -    compile "org.springframework.cloud:spring-cloud-starter-sleuth" 3
    -    // Example for Rabbit binding
    -    compile "org.springframework.cloud:spring-cloud-stream-binder-rabbit" 4
    -}

    -

    1

    In order not to pick versions by yourself it’s much better if you add the dependency management via -the Spring BOM

    2

    Add the dependency to spring-cloud-sleuth-zipkin-stream

    3

    Add the dependency to spring-cloud-starter-sleuth - that way all dependant dependencies will be downloaded

    4

    Add a binder (e.g. Rabbit binder) to tell Spring Cloud Stream what it should bind to

    and then just annotate your main class with @EnableZipkinStreamServer annotation:

    package example;
    -
    -import org.springframework.boot.SpringApplication;
    -import org.springframework.boot.autoconfigure.SpringBootApplication;
    -import org.springframework.cloud.sleuth.zipkin.stream.EnableZipkinStreamServer;
    -
    -@SpringBootApplication
    -@EnableZipkinStreamServer
    -public class ZipkinStreamServerApplication {
    -
    -	public static void main(String[] args) throws Exception {
    -		SpringApplication.run(ZipkinStreamServerApplication.class, args);
    -	}
    -
    -}
    \ No newline at end of file +the Spring BOM

    2

    Add the dependency to spring-cloud-starter-sleuth-zipkin2 - that way all dependent dependencies will be downloaded

    3

    To automatically configure rabbit, simply add the spring-rabbit dependency

    \ No newline at end of file diff --git a/2.0.x/multi/multi_spring-cloud-sleuth.html b/2.0.x/multi/multi_spring-cloud-sleuth.html index 8877ab3da..a735595ec 100644 --- a/2.0.x/multi/multi_spring-cloud-sleuth.html +++ b/2.0.x/multi/multi_spring-cloud-sleuth.html @@ -1,3 +1,3 @@ - Spring Cloud Sleuth

    Spring Cloud Sleuth

    Adrian Cole, Spencer Gibb, Marcin Grzejszczak, Dave Syer

    Table of Contents

    1. Introduction
    1.1. Terminology
    1.2. Purpose
    1.2.1. Distributed tracing with Zipkin
    1.2.2. Visualizing errors
    1.2.3. Live examples
    1.2.4. Log correlation
    JSON Logback with Logstash
    1.2.5. Propagating Span Context
    Baggage vs. Span Tags
    1.3. Adding to the project
    1.3.1. Only Sleuth (log correlation)
    1.3.2. Sleuth with Zipkin via HTTP
    1.3.3. Sleuth with Zipkin via Spring Cloud Stream
    1.3.4. Spring Cloud Sleuth Stream Zipkin Collector
    2. Additional resources
    3. Features
    4. Sampling
    5. Instrumentation
    6. Span lifecycle
    6.1. Creating and closing spans
    6.2. Continuing spans
    6.3. Creating spans with an explicit parent
    7. Naming spans
    7.1. @SpanName annotation
    7.2. toString() method
    8. Managing spans with annotations
    8.1. Rationale
    8.2. Creating new spans
    8.3. Continuing spans
    8.4. More advanced tag setting
    8.4.1. Custom extractor
    8.4.2. Resolving expressions for value
    8.4.3. Using toString method
    9. Customizations
    9.1. Spring Integration
    9.2. HTTP
    9.3. Example
    9.4. TraceFilter
    9.5. Custom SA tag in Zipkin
    9.6. Custom service name
    9.7. Customization of reported spans
    9.8. Host locator
    10. Sending spans to Zipkin
    11. Span Data as Messages
    11.1. Zipkin Consumer
    11.2. Custom Consumer
    12. Metrics
    13. Integrations
    13.1. Runnable and Callable
    13.2. Hystrix
    13.2.1. Custom Concurrency Strategy
    13.2.2. Manual Command setting
    13.3. RxJava
    13.4. HTTP integration
    13.4.1. HTTP Filter
    13.4.2. HandlerInterceptor
    13.4.3. Async Servlet support
    13.4.4. WebFlux support
    13.5. HTTP client integration
    13.5.1. Synchronous Rest Template
    13.5.2. Asynchronous Rest Template
    Multiple Asynchronous Rest Templates
    13.5.3. WebClient
    13.5.4. Traverson
    13.6. Feign
    13.7. Asynchronous communication
    13.7.1. @Async annotated methods
    13.7.2. @Scheduled annotated methods
    13.7.3. Executor, ExecutorService and ScheduledExecutorService
    Customization of Executors
    13.8. Messaging
    13.9. Zuul
    14. Running examples
    \ No newline at end of file + Spring Cloud Sleuth

    Spring Cloud Sleuth

    Adrian Cole, Spencer Gibb, Marcin Grzejszczak, Dave Syer

    Table of Contents

    1. Introduction
    1.1. Terminology
    1.2. Purpose
    1.2.1. Distributed tracing with Zipkin
    1.2.2. Visualizing errors
    1.2.3. Live examples
    1.2.4. Log correlation
    JSON Logback with Logstash
    1.2.5. Propagating Span Context
    Baggage vs. Span Tags
    1.3. Adding to the project
    1.3.1. Only Sleuth (log correlation)
    1.3.2. Sleuth with Zipkin via HTTP
    1.3.3. Sleuth with Zipkin via RabbitMQ or Kafka
    2. Additional resources
    3. Features
    4. Sampling
    5. Instrumentation
    6. Span lifecycle
    6.1. Creating and closing spans
    6.2. Continuing spans
    6.3. Creating spans with an explicit parent
    7. Naming spans
    7.1. @SpanName annotation
    7.2. toString() method
    8. Managing spans with annotations
    8.1. Rationale
    8.2. Creating new spans
    8.3. Continuing spans
    8.4. More advanced tag setting
    8.4.1. Custom extractor
    8.4.2. Resolving expressions for value
    8.4.3. Using toString method
    9. Customizations
    9.1. Spring Integration
    9.2. HTTP
    9.3. Example
    9.4. TraceFilter
    9.5. Custom SA tag in Zipkin
    9.6. Custom service name
    9.7. Customization of reported spans
    9.8. Host locator
    10. Sending spans to Zipkin
    11. Span Data as Messages
    11.1. Zipkin Consumer
    11.2. Custom Consumer
    12. Metrics
    13. Integrations
    13.1. Runnable and Callable
    13.2. Hystrix
    13.2.1. Custom Concurrency Strategy
    13.2.2. Manual Command setting
    13.3. RxJava
    13.4. HTTP integration
    13.4.1. HTTP Filter
    13.4.2. HandlerInterceptor
    13.4.3. Async Servlet support
    13.4.4. WebFlux support
    13.5. HTTP client integration
    13.5.1. Synchronous Rest Template
    13.5.2. Asynchronous Rest Template
    Multiple Asynchronous Rest Templates
    13.5.3. WebClient
    13.5.4. Traverson
    13.6. Feign
    13.7. Asynchronous communication
    13.7.1. @Async annotated methods
    13.7.2. @Scheduled annotated methods
    13.7.3. Executor, ExecutorService and ScheduledExecutorService
    Customization of Executors
    13.8. Messaging
    13.9. Zuul
    14. Running examples
    \ No newline at end of file diff --git a/2.0.x/single/spring-cloud-sleuth.html b/2.0.x/single/spring-cloud-sleuth.html index 61af6c1d0..ae2296665 100644 --- a/2.0.x/single/spring-cloud-sleuth.html +++ b/2.0.x/single/spring-cloud-sleuth.html @@ -1,6 +1,6 @@ - Spring Cloud Sleuth

    Spring Cloud Sleuth

    Adrian Cole, Spencer Gibb, Marcin Grzejszczak, Dave Syer

    Table of Contents

    1. Introduction
    1.1. Terminology
    1.2. Purpose
    1.2.1. Distributed tracing with Zipkin
    1.2.2. Visualizing errors
    1.2.3. Live examples
    1.2.4. Log correlation
    JSON Logback with Logstash
    1.2.5. Propagating Span Context
    Baggage vs. Span Tags
    1.3. Adding to the project
    1.3.1. Only Sleuth (log correlation)
    1.3.2. Sleuth with Zipkin via HTTP
    1.3.3. Sleuth with Zipkin via Spring Cloud Stream
    1.3.4. Spring Cloud Sleuth Stream Zipkin Collector
    2. Additional resources
    3. Features
    4. Sampling
    5. Instrumentation
    6. Span lifecycle
    6.1. Creating and closing spans
    6.2. Continuing spans
    6.3. Creating spans with an explicit parent
    7. Naming spans
    7.1. @SpanName annotation
    7.2. toString() method
    8. Managing spans with annotations
    8.1. Rationale
    8.2. Creating new spans
    8.3. Continuing spans
    8.4. More advanced tag setting
    8.4.1. Custom extractor
    8.4.2. Resolving expressions for value
    8.4.3. Using toString method
    9. Customizations
    9.1. Spring Integration
    9.2. HTTP
    9.3. Example
    9.4. TraceFilter
    9.5. Custom SA tag in Zipkin
    9.6. Custom service name
    9.7. Customization of reported spans
    9.8. Host locator
    10. Sending spans to Zipkin
    11. Span Data as Messages
    11.1. Zipkin Consumer
    11.2. Custom Consumer
    12. Metrics
    13. Integrations
    13.1. Runnable and Callable
    13.2. Hystrix
    13.2.1. Custom Concurrency Strategy
    13.2.2. Manual Command setting
    13.3. RxJava
    13.4. HTTP integration
    13.4.1. HTTP Filter
    13.4.2. HandlerInterceptor
    13.4.3. Async Servlet support
    13.4.4. WebFlux support
    13.5. HTTP client integration
    13.5.1. Synchronous Rest Template
    13.5.2. Asynchronous Rest Template
    Multiple Asynchronous Rest Templates
    13.5.3. WebClient
    13.5.4. Traverson
    13.6. Feign
    13.7. Asynchronous communication
    13.7.1. @Async annotated methods
    13.7.2. @Scheduled annotated methods
    13.7.3. Executor, ExecutorService and ScheduledExecutorService
    Customization of Executors
    13.8. Messaging
    13.9. Zuul
    14. Running examples

    2.0.0.BUILD-SNAPSHOT

    1. Introduction

    Spring Cloud Sleuth implements a distributed tracing solution for Spring Cloud.

    1.1 Terminology

    Spring Cloud Sleuth borrows Dapper’s terminology.

    Span: The basic unit of work. For example, sending an RPC is a new span, as is sending a response to an + Spring Cloud Sleuth

    Spring Cloud Sleuth

    Adrian Cole, Spencer Gibb, Marcin Grzejszczak, Dave Syer

    Table of Contents

    1. Introduction
    1.1. Terminology
    1.2. Purpose
    1.2.1. Distributed tracing with Zipkin
    1.2.2. Visualizing errors
    1.2.3. Live examples
    1.2.4. Log correlation
    JSON Logback with Logstash
    1.2.5. Propagating Span Context
    Baggage vs. Span Tags
    1.3. Adding to the project
    1.3.1. Only Sleuth (log correlation)
    1.3.2. Sleuth with Zipkin via HTTP
    1.3.3. Sleuth with Zipkin via RabbitMQ or Kafka
    2. Additional resources
    3. Features
    4. Sampling
    5. Instrumentation
    6. Span lifecycle
    6.1. Creating and closing spans
    6.2. Continuing spans
    6.3. Creating spans with an explicit parent
    7. Naming spans
    7.1. @SpanName annotation
    7.2. toString() method
    8. Managing spans with annotations
    8.1. Rationale
    8.2. Creating new spans
    8.3. Continuing spans
    8.4. More advanced tag setting
    8.4.1. Custom extractor
    8.4.2. Resolving expressions for value
    8.4.3. Using toString method
    9. Customizations
    9.1. Spring Integration
    9.2. HTTP
    9.3. Example
    9.4. TraceFilter
    9.5. Custom SA tag in Zipkin
    9.6. Custom service name
    9.7. Customization of reported spans
    9.8. Host locator
    10. Sending spans to Zipkin
    11. Span Data as Messages
    11.1. Zipkin Consumer
    11.2. Custom Consumer
    12. Metrics
    13. Integrations
    13.1. Runnable and Callable
    13.2. Hystrix
    13.2.1. Custom Concurrency Strategy
    13.2.2. Manual Command setting
    13.3. RxJava
    13.4. HTTP integration
    13.4.1. HTTP Filter
    13.4.2. HandlerInterceptor
    13.4.3. Async Servlet support
    13.4.4. WebFlux support
    13.5. HTTP client integration
    13.5.1. Synchronous Rest Template
    13.5.2. Asynchronous Rest Template
    Multiple Asynchronous Rest Templates
    13.5.3. WebClient
    13.5.4. Traverson
    13.6. Feign
    13.7. Asynchronous communication
    13.7.1. @Async annotated methods
    13.7.2. @Scheduled annotated methods
    13.7.3. Executor, ExecutorService and ScheduledExecutorService
    Customization of Executors
    13.8. Messaging
    13.9. Zuul
    14. Running examples

    2.0.0.BUILD-SNAPSHOT

    1. Introduction

    Spring Cloud Sleuth implements a distributed tracing solution for Spring Cloud.

    1.1 Terminology

    Spring Cloud Sleuth borrows Dapper’s terminology.

    Span: The basic unit of work. For example, sending an RPC is a new span, as is sending a response to an RPC. Span’s are identified by a unique 64-bit ID for the span and another 64-bit ID for the trace the span is a part of. Spans also have other data, such as descriptions, timestamped events, key-value annotations (tags), the ID of the span that caused them, and process ID’s (normally IP address).

    Spans are started and stopped, and they keep track of their timing information. Once you create a @@ -169,7 +169,7 @@ dependencies { "org.springframework.cloud:spring-cloud-starter-sleuth" }

    1

    In order not to pick versions by yourself it’s much better if you add the dependency management via -the Spring BOM

    2

    Add the dependency to spring-cloud-starter-sleuth

    1.3.2 Sleuth with Zipkin via HTTP

    If you want both Sleuth and Zipkin just add the spring-cloud-starter-zipkin dependency.

    Maven.  +the Spring BOM

    2

    Add the dependency to spring-cloud-starter-sleuth

    1.3.2 Sleuth with Zipkin via HTTP

    If you want both Sleuth and Zipkin just add the spring-cloud-starter-zipkin2 dependency.

    Maven. 

    <dependencyManagement> 1
              <dependencies>
                  <dependency>
    @@ -184,10 +184,10 @@ the Spring BOM

    <dependency> 2 <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-zipkin</artifactId> + <artifactId>spring-cloud-starter-zipkin2</artifactId> </dependency>

    1

    In order not to pick versions by yourself it’s much better if you add the dependency management via -the Spring BOM

    2

    Add the dependency to spring-cloud-starter-zipkin

    Gradle.  +the Spring BOM

    2

    Add the dependency to spring-cloud-starter-zipkin2

    Gradle. 

    dependencyManagement { 1
         imports {
             mavenBom "org.springframework.cloud:spring-cloud-dependencies:${releaseTrainVersion}"
    @@ -195,10 +195,12 @@ the Spring BOM

    2 - compile "org.springframework.cloud:spring-cloud-starter-zipkin" + compile "org.springframework.cloud:spring-cloud-starter-zipkin2" }

    1

    In order not to pick versions by yourself it’s much better if you add the dependency management via -the Spring BOM

    2

    Add the dependency to spring-cloud-starter-zipkin

    1.3.3 Sleuth with Zipkin via Spring Cloud Stream

    If you want both Sleuth and Zipkin just add the spring-cloud-sleuth-stream dependency.

    Maven.  +the Spring BOM

    2

    Add the dependency to spring-cloud-starter-zipkin2

    1.3.3 Sleuth with Zipkin via RabbitMQ or Kafka

    If you want to use RabbitMQ or Kafka instead of http, add the spring-rabbit or spring-kafka +dependencies. The default destination name is zipkin.

    Note: spring-cloud-sleuth-stream is deprecated and incompatible with these destinations

    If you want Sleuth over RabbitMQ add the spring-cloud-sleuth-starter-zipkin2 and spring-rabbit +dependencies.

    Maven. 

    <dependencyManagement> 1
              <dependencies>
                  <dependency>
    @@ -213,19 +215,14 @@ the Spring BOM

    <dependency> 2 <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-sleuth-stream</artifactId> + <artifactId>spring-cloud-sleuth-starter-zipkin2</artifactId> </dependency> <dependency> 3 - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-sleuth</artifactId> - </dependency> - <!-- EXAMPLE FOR RABBIT BINDING --> - <dependency> 4 - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-stream-binder-rabbit</artifactId> + <groupId>org.springframework.amqp</groupId> + <artifactId>spring-rabbit</artifactId> </dependency>

    1

    In order not to pick versions by yourself it’s much better if you add the dependency management via -the Spring BOM

    2

    Add the dependency to spring-cloud-sleuth-stream

    3

    Add the dependency to spring-cloud-starter-sleuth - that way all dependant dependencies will be downloaded

    4

    Add a binder (e.g. Rabbit binder) to tell Spring Cloud Stream what it should bind to

    Gradle.  +the Spring BOM

    2

    Add the dependency to spring-cloud-starter-sleuth-zipkin2 - that way all dependent dependencies will be downloaded

    3

    To automatically configure rabbit, simply add the spring-rabbit dependency

    Gradle. 

    dependencyManagement { 1
         imports {
             mavenBom "org.springframework.cloud:spring-cloud-dependencies:${releaseTrainVersion}"
    @@ -233,69 +230,11 @@ the Spring BOM

    "org.springframework.cloud:spring-cloud-sleuth-stream" 2 - compile "org.springframework.cloud:spring-cloud-starter-sleuth" 3 - // Example for Rabbit binding - compile "org.springframework.cloud:spring-cloud-stream-binder-rabbit" 4 + compile "org.springframework.cloud:spring-cloud-starter-sleuth-zipkin2" 2 + compile "org.springframework.amqp:spring-rabbit" 3 }

    1

    In order not to pick versions by yourself it’s much better if you add the dependency management via -the Spring BOM

    2

    Add the dependency to spring-cloud-sleuth-stream

    3

    Add the dependency to spring-cloud-starter-sleuth - that way all dependant dependencies will be downloaded

    4

    Add a binder (e.g. Rabbit binder) to tell Spring Cloud Stream what it should bind to

    1.3.4 Spring Cloud Sleuth Stream Zipkin Collector

    If you want to start a Spring Cloud Sleuth Stream Zipkin collector just add the spring-cloud-sleuth-zipkin-stream -dependency

    Maven.  -

    <dependencyManagement> 1
    -         <dependencies>
    -             <dependency>
    -                 <groupId>org.springframework.cloud</groupId>
    -                 <artifactId>spring-cloud-dependencies</artifactId>
    -                 <version>${release.train.version}</version>
    -                 <type>pom</type>
    -                 <scope>import</scope>
    -             </dependency>
    -         </dependencies>
    -   </dependencyManagement>
    -
    -   <dependency> 2
    -       <groupId>org.springframework.cloud</groupId>
    -       <artifactId>spring-cloud-sleuth-zipkin-stream</artifactId>
    -   </dependency>
    -   <dependency> 3
    -       <groupId>org.springframework.cloud</groupId>
    -       <artifactId>spring-cloud-starter-sleuth</artifactId>
    -   </dependency>
    -   <!-- EXAMPLE FOR RABBIT BINDING -->
    -   <dependency> 4
    -       <groupId>org.springframework.cloud</groupId>
    -       <artifactId>spring-cloud-stream-binder-rabbit</artifactId>
    -   </dependency>

    -

    1

    In order not to pick versions by yourself it’s much better if you add the dependency management via -the Spring BOM

    2

    Add the dependency to spring-cloud-sleuth-zipkin-stream

    3

    Add the dependency to spring-cloud-starter-sleuth - that way all dependant dependencies will be downloaded

    4

    Add a binder (e.g. Rabbit binder) to tell Spring Cloud Stream what it should bind to

    Gradle.  -

    dependencyManagement { 1
    -    imports {
    -        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${releaseTrainVersion}"
    -    }
    -}
    -
    -dependencies {
    -    compile "org.springframework.cloud:spring-cloud-sleuth-zipkin-stream" 2
    -    compile "org.springframework.cloud:spring-cloud-starter-sleuth" 3
    -    // Example for Rabbit binding
    -    compile "org.springframework.cloud:spring-cloud-stream-binder-rabbit" 4
    -}

    -

    1

    In order not to pick versions by yourself it’s much better if you add the dependency management via -the Spring BOM

    2

    Add the dependency to spring-cloud-sleuth-zipkin-stream

    3

    Add the dependency to spring-cloud-starter-sleuth - that way all dependant dependencies will be downloaded

    4

    Add a binder (e.g. Rabbit binder) to tell Spring Cloud Stream what it should bind to

    and then just annotate your main class with @EnableZipkinStreamServer annotation:

    package example;
    -
    -import org.springframework.boot.SpringApplication;
    -import org.springframework.boot.autoconfigure.SpringBootApplication;
    -import org.springframework.cloud.sleuth.zipkin.stream.EnableZipkinStreamServer;
    -
    -@SpringBootApplication
    -@EnableZipkinStreamServer
    -public class ZipkinStreamServerApplication {
    -
    -	public static void main(String[] args) throws Exception {
    -		SpringApplication.run(ZipkinStreamServerApplication.class, args);
    -	}
    -
    -}

    2. Additional resources

    Marcin Grzejszczak talking about Spring Cloud Sleuth and Zipkin

    click here to see the video

    3. Features

    • Adds trace and span ids to the Slf4J MDC, so you can extract all the logs from a given trace or span in a log aggregator. Example logs:

      2016-02-02 15:30:57.902  INFO [bar,6bfd228dc00d216b,6bfd228dc00d216b,false] 23030 --- [nio-8081-exec-3] ...
      +the Spring BOM

      2

      Add the dependency to spring-cloud-starter-sleuth-zipkin2 - that way all dependent dependencies will be downloaded

      3

      To automatically configure rabbit, simply add the spring-rabbit dependency

    2. Additional resources

    Marcin Grzejszczak talking about Spring Cloud Sleuth and Zipkin

    click here to see the video

    3. Features

    • Adds trace and span ids to the Slf4J MDC, so you can extract all the logs from a given trace or span in a log aggregator. Example logs:

      2016-02-02 15:30:57.902  INFO [bar,6bfd228dc00d216b,6bfd228dc00d216b,false] 23030 --- [nio-8081-exec-3] ...
       2016-02-02 15:30:58.372 ERROR [bar,6bfd228dc00d216b,6bfd228dc00d216b,false] 23030 --- [nio-8081-exec-3] ...
       2016-02-02 15:31:01.936  INFO [bar,46ab0d418373cbc9,46ab0d418373cbc9,false] 23030 --- [nio-8081-exec-4] ...

      notice the [appname,traceId,spanId,exportable] entries from the MDC:

      • spanId - the id of a specific operation that took place
      • appname - the name of the application that logged the span
      • traceId - the id of the latency graph that contains the span
      • exportable - whether the log should be exported to Zipkin or not. When would you like the span not to be exportable? In the case in which you want to wrap some operation in a Span and have it written to the logs @@ -305,11 +244,9 @@ latency in your applications. Sleuth is written to not log too much, and to not rest template, scheduled actions, message channels, zuul filters, feign client).
      • Sleuth includes default logic to join a trace across http or messaging boundaries. For example, http propagation works via Zipkin-compatible request headers. This propagation logic is defined and customized via SpanInjector and SpanExtractor implementations.
      • Sleuth gives you the possibility to propagate context (also known as baggage) between processes. That means that if you set on a Span -a baggage element then it will be sent downstream either via HTTP or messaging to other processes.
      • Provides a way to create / continue spans and add tags and logs via annotations.
      • Provides simple metrics of accepted / dropped spans.
      • If spring-cloud-sleuth-zipkin then the app will generate and collect Zipkin-compatible traces. +a baggage element then it will be sent downstream either via HTTP or messaging to other processes.
      • Provides a way to create / continue spans and add tags and logs via annotations.
      • Provides simple metrics of accepted / dropped spans.
      • If spring-cloud-sleuth-zipkin2 then the app will generate and collect Zipkin-compatible traces. By default it sends them via HTTP to a Zipkin server on localhost (port 9411). -Configure the location of the service using spring.zipkin.baseUrl.

      • If spring-cloud-sleuth-stream then the app will generate and collect traces via Spring Cloud Stream. -Your app automatically becomes a producer of tracer messages that are sent over your broker of choice -(e.g. RabbitMQ, Apache Kafka, Redis).
      [Important]Important

      If using Zipkin or Stream, configure the percentage of spans exported using spring.sleuth.sampler.percentage +Configure the location of the service using spring.zipkin.baseUrl.

      • If you depend on spring-rabbit or spring-kafka your app will send traces to a broker instead of http.
      • Note: spring-cloud-sleuth-stream is deprecated and should no longer be used.
      [Important]Important

      If using Zipkin, configure the percentage of spans exported using spring.sleuth.sampler.percentage (default 0.1, i.e. 10%). Otherwise you might think that Sleuth is not working cause it’s omitting some spans.

      [Note]Note

      the SLF4J MDC is always set and logback users will immediately see the trace and span ids in logs per the example above. Other logging systems have to configure their own formatter to get the same result. The default is logging.pattern.level set to %5p [${spring.zipkin.service.name:${spring.application.name:-}},%X{X-B3-TraceId:-},%X{X-B3-SpanId:-},%X{X-Span-Export:-}] diff --git a/2.0.x/spring-cloud-sleuth.xml b/2.0.x/spring-cloud-sleuth.xml index 200d9a333..f31619f8d 100644 --- a/2.0.x/spring-cloud-sleuth.xml +++ b/2.0.x/spring-cloud-sleuth.xml @@ -434,7 +434,7 @@ the Spring BOM

      Sleuth with Zipkin via HTTP -If you want both Sleuth and Zipkin just add the spring-cloud-starter-zipkin dependency. +If you want both Sleuth and Zipkin just add the spring-cloud-starter-zipkin2 dependency. Maven @@ -452,7 +452,7 @@ the Spring BOM <dependency> <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-zipkin</artifactId> + <artifactId>spring-cloud-starter-zipkin2</artifactId> </dependency> @@ -462,7 +462,7 @@ the Spring BOM the Spring BOM -Add the dependency to spring-cloud-starter-zipkin +Add the dependency to spring-cloud-starter-zipkin2 @@ -475,7 +475,7 @@ the Spring BOM } dependencies { - compile "org.springframework.cloud:spring-cloud-starter-zipkin" + compile "org.springframework.cloud:spring-cloud-starter-zipkin2" } @@ -485,13 +485,17 @@ dependencies { the Spring BOM -Add the dependency to spring-cloud-starter-zipkin +Add the dependency to spring-cloud-starter-zipkin2
      -
      -Sleuth with Zipkin via Spring Cloud Stream -If you want both Sleuth and Zipkin just add the spring-cloud-sleuth-stream dependency. +
      +Sleuth with Zipkin via RabbitMQ or Kafka +If you want to use RabbitMQ or Kafka instead of http, add the spring-rabbit or spring-kafka +dependencies. The default destination name is zipkin. +Note: spring-cloud-sleuth-stream is deprecated and incompatible with these destinations +If you want Sleuth over RabbitMQ add the spring-cloud-sleuth-starter-zipkin2 and spring-rabbit +dependencies. Maven @@ -509,16 +513,11 @@ the Spring BOM <dependency> <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-sleuth-stream</artifactId> + <artifactId>spring-cloud-sleuth-starter-zipkin2</artifactId> </dependency> <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-sleuth</artifactId> - </dependency> - <!-- EXAMPLE FOR RABBIT BINDING --> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-stream-binder-rabbit</artifactId> + <groupId>org.springframework.amqp</groupId> + <artifactId>spring-rabbit</artifactId> </dependency> @@ -528,13 +527,10 @@ the Spring BOM the Spring BOM -Add the dependency to spring-cloud-sleuth-stream +Add the dependency to spring-cloud-starter-sleuth-zipkin2 - that way all dependent dependencies will be downloaded -Add the dependency to spring-cloud-starter-sleuth - that way all dependant dependencies will be downloaded - - -Add a binder (e.g. Rabbit binder) to tell Spring Cloud Stream what it should bind to +To automatically configure rabbit, simply add the spring-rabbit dependency @@ -547,10 +543,8 @@ the Spring BOM } dependencies { - compile "org.springframework.cloud:spring-cloud-sleuth-stream" - compile "org.springframework.cloud:spring-cloud-starter-sleuth" - // Example for Rabbit binding - compile "org.springframework.cloud:spring-cloud-stream-binder-rabbit" + compile "org.springframework.cloud:spring-cloud-starter-sleuth-zipkin2" + compile "org.springframework.amqp:spring-rabbit" } @@ -560,114 +554,13 @@ dependencies { the Spring BOM -Add the dependency to spring-cloud-sleuth-stream +Add the dependency to spring-cloud-starter-sleuth-zipkin2 - that way all dependent dependencies will be downloaded -Add the dependency to spring-cloud-starter-sleuth - that way all dependant dependencies will be downloaded - - -Add a binder (e.g. Rabbit binder) to tell Spring Cloud Stream what it should bind to +To automatically configure rabbit, simply add the spring-rabbit dependency
      -
      -Spring Cloud Sleuth Stream Zipkin Collector -If you want to start a Spring Cloud Sleuth Stream Zipkin collector just add the spring-cloud-sleuth-zipkin-stream -dependency - -Maven - -<dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>${release.train.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-sleuth-zipkin-stream</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-sleuth</artifactId> - </dependency> - <!-- EXAMPLE FOR RABBIT BINDING --> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-stream-binder-rabbit</artifactId> - </dependency> - - - - -In order not to pick versions by yourself it’s much better if you add the dependency management via -the Spring BOM - - -Add the dependency to spring-cloud-sleuth-zipkin-stream - - -Add the dependency to spring-cloud-starter-sleuth - that way all dependant dependencies will be downloaded - - -Add a binder (e.g. Rabbit binder) to tell Spring Cloud Stream what it should bind to - - - -Gradle - -dependencyManagement { - imports { - mavenBom "org.springframework.cloud:spring-cloud-dependencies:${releaseTrainVersion}" - } -} - -dependencies { - compile "org.springframework.cloud:spring-cloud-sleuth-zipkin-stream" - compile "org.springframework.cloud:spring-cloud-starter-sleuth" - // Example for Rabbit binding - compile "org.springframework.cloud:spring-cloud-stream-binder-rabbit" -} - - - - -In order not to pick versions by yourself it’s much better if you add the dependency management via -the Spring BOM - - -Add the dependency to spring-cloud-sleuth-zipkin-stream - - -Add the dependency to spring-cloud-starter-sleuth - that way all dependant dependencies will be downloaded - - -Add a binder (e.g. Rabbit binder) to tell Spring Cloud Stream what it should bind to - - -and then just annotate your main class with @EnableZipkinStreamServer annotation: -package example; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.sleuth.zipkin.stream.EnableZipkinStreamServer; - -@SpringBootApplication -@EnableZipkinStreamServer -public class ZipkinStreamServerApplication { - - public static void main(String[] args) throws Exception { - SpringApplication.run(ZipkinStreamServerApplication.class, args); - } - -} -
      @@ -744,18 +637,21 @@ a baggage element then it will be sent downstream either via HTTP or messaging t Provides simple metrics of accepted / dropped spans. -If spring-cloud-sleuth-zipkin then the app will generate and collect Zipkin-compatible traces. +If spring-cloud-sleuth-zipkin2 then the app will generate and collect Zipkin-compatible traces. By default it sends them via HTTP to a Zipkin server on localhost (port 9411). Configure the location of the service using spring.zipkin.baseUrl. + + +If you depend on spring-rabbit or spring-kafka your app will send traces to a broker instead of http. -If spring-cloud-sleuth-stream then the app will generate and collect traces via Spring Cloud Stream. -Your app automatically becomes a producer of tracer messages that are sent over your broker of choice -(e.g. RabbitMQ, Apache Kafka, Redis). +Note: spring-cloud-sleuth-stream is deprecated and should no longer be used. + + -If using Zipkin or Stream, configure the percentage of spans exported using spring.sleuth.sampler.percentage +If using Zipkin, configure the percentage of spans exported using spring.sleuth.sampler.percentage (default 0.1, i.e. 10%). Otherwise you might think that Sleuth is not working cause it’s omitting some spans.