Trace Id = X
+Trace Id = X
Span Id = D
Client Sent
diff --git a/spring-cloud-sleuth.html b/spring-cloud-sleuth.html index 2b9875a09..8ec321b4d 100644 --- a/spring-cloud-sleuth.html +++ b/spring-cloud-sleuth.html @@ -630,7 +630,7 @@ will receive the whole time needed by the client to receive the response from th
Trace Id = X
+Trace Id = X
Span Id = D
Client Sent
service1.log:2016-02-26 11:15:47.561 INFO [service1,2485ec27856c56f4,2485ec27856c56f4,true] 68058 --- [nio-8081-exec-1] i.s.c.sleuth.docs.service1.Application : Hello from service1. Calling service2
+service1.log:2016-02-26 11:15:47.561 INFO [service1,2485ec27856c56f4,2485ec27856c56f4,true] 68058 --- [nio-8081-exec-1] i.s.c.sleuth.docs.service1.Application : Hello from service1. Calling service2
service2.log:2016-02-26 11:15:47.710 INFO [service2,2485ec27856c56f4,9aa10ee6fbde75fa,true] 68059 --- [nio-8082-exec-1] i.s.c.sleuth.docs.service2.Application : Hello from service2. Calling service3 and then service4
service3.log:2016-02-26 11:15:47.895 INFO [service3,2485ec27856c56f4,1210be13194bfe5,true] 68060 --- [nio-8083-exec-1] i.s.c.sleuth.docs.service3.Application : Hello from service3
service2.log:2016-02-26 11:15:47.924 INFO [service2,2485ec27856c56f4,9aa10ee6fbde75fa,true] 68059 --- [nio-8082-exec-1] i.s.c.sleuth.docs.service2.Application : Got response from service3 [Hello from service3]
@@ -800,7 +800,7 @@ Kibana would look like this:
filter {
+filter {
# pattern matching logback pattern
grok {
match => { "message" => "%{TIMESTAMP_ISO8601:timestamp}\s+%{LOGLEVEL:severity}\s+\[%{DATA:service},%{DATA:trace},%{DATA:span},%{DATA:exportable}\]\s+%{DATA:pid}\s+---\s+\[%{DATA:thread}\]\s+%{DATA:class}\s+:\s+%{GREEDYDATA:rest}" }
@@ -822,7 +822,7 @@ If you want to use Grok together with the logs from Cloud Foundry you have to us
filter {
+filter {
# pattern matching logback pattern
grok {
match => { "message" => "(?m)OUT\s+%{TIMESTAMP_ISO8601:timestamp}\s+%{LOGLEVEL:severity}\s+\[%{DATA:service},%{DATA:trace},%{DATA:span},%{DATA:exportable}\]\s+%{DATA:pid}\s+---\s+\[%{DATA:thread}\]\s+%{DATA:class}\s+:\s+%{GREEDYDATA:rest}" }
@@ -870,7 +870,7 @@ we’re passing the dependencies in the groupId:artifactId:version
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
@@ -994,7 +994,7 @@ to exceeding transport-level message or header capacity.
-Span initialSpan = this.tracer.createSpan("span");
+Span initialSpan = this.tracer.createSpan("span");
initialSpan.setBaggageItem("foo", "bar");
@@ -1013,7 +1013,7 @@ can search by tag to find the trace, where there exists a span having the search
-@Autowired Tracer tracer;
+@Autowired Tracer tracer;
Span span = tracer.getCurrentSpan();
String baggageKey = "key";
@@ -1036,7 +1036,7 @@ the spring-cloud-starter-sleuth module to your project.
Maven
-<dependencyManagement> (1)
+<dependencyManagement> (1)
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
@@ -1068,7 +1068,7 @@ the Spring BOM
Gradle
-dependencyManagement { (1)
+dependencyManagement { (1)
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Camden.RELEASE"
}
@@ -1099,7 +1099,7 @@ the Spring BOM
Maven
-<dependencyManagement> (1)
+<dependencyManagement> (1)
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
@@ -1131,7 +1131,7 @@ the Spring BOM
Gradle
-dependencyManagement { (1)
+dependencyManagement { (1)
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Camden.RELEASE"
}
@@ -1162,7 +1162,7 @@ the Spring BOM
Maven
-<dependencyManagement> (1)
+<dependencyManagement> (1)
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
@@ -1209,7 +1209,7 @@ the Spring BOM
Gradle
-dependencyManagement { (1)
+dependencyManagement { (1)
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Camden.RELEASE"
}
@@ -1250,7 +1250,7 @@ dependency
Maven
-<dependencyManagement> (1)
+<dependencyManagement> (1)
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
@@ -1297,7 +1297,7 @@ the Spring BOM
Gradle
-dependencyManagement { (1)
+dependencyManagement { (1)
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Camden.RELEASE"
}
@@ -1333,7 +1333,7 @@ the Spring BOM
-package example;
+package example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -1531,7 +1531,7 @@ For backwards compatibility reasons we’re not changing the property name.
-@Bean
+@Bean
public Sampler defaultSampler() {
return new AlwaysSampler();
}
@@ -1650,7 +1650,7 @@ Spring creates the instance of Tracer for you. In order to use it a
-// Start a span. If there was a span present in this thread it will become
+// Start a span. If there was a span present in this thread it will become
// the `newSpan`'s parent.
Span newSpan = this.tracer.createSpan("calculateTax");
try {
@@ -1720,7 +1720,7 @@ only a technical implementation detail that you wouldn’t necessarily want
-Span continuedSpan = this.tracer.continueSpan(spanToContinue);
+Span continuedSpan = this.tracer.continueSpan(spanToContinue);
assertThat(continuedSpan).isEqualTo(spanToContinue);
@@ -1729,7 +1729,7 @@ assertThat(continuedSpan).isEqualTo(spanToContinue);
-// let's assume that we're in a thread Y and we've received
+// let's assume that we're in a thread Y and we've received
// the `initialSpan` from thread X
Span continuedSpan = this.tracer.continueSpan(initialSpan);
try {
@@ -1771,7 +1771,7 @@ Let’s assume that the parent of a span is in one thread and you want to st
-// let's assume that we're in a thread Y and we've received
+// let's assume that we're in a thread Y and we've received
// the `initialSpan` from thread X. `initialSpan` will be the parent
// of the `newSpan`
Span newSpan = this.tracer.createSpan("calculateCommission", initialSpan);
@@ -1841,7 +1841,7 @@ artificial like:
-@SpanName("calculateTax")
+@SpanName("calculateTax")
class TaxCountingRunnable implements Runnable {
@Override public void run() {
@@ -1855,7 +1855,7 @@ class TaxCountingRunnable implements Runnable {
-Runnable runnable = new TraceRunnable(tracer, spanNamer, new TaxCountingRunnable());
+Runnable runnable = new TraceRunnable(tracer, spanNamer, new TaxCountingRunnable());
Future<?> future = executorService.submit(runnable);
// ... some additional logic ...
future.get();
@@ -1877,7 +1877,7 @@ we’re checking if the class has a custom implementation of the toStr
-Runnable runnable = new TraceRunnable(tracer, spanNamer, new Runnable() {
+Runnable runnable = new TraceRunnable(tracer, spanNamer, new Runnable() {
@Override public void run() {
// perform logic
}
@@ -1957,7 +1957,7 @@ fashion.
-@NewSpan
+@NewSpan
void testMethod();
@@ -1967,7 +1967,7 @@ will be equal to annotated method name.
-@NewSpan("customNameOnTestMethod4")
+@NewSpan("customNameOnTestMethod4")
void testMethod4();
@@ -1977,7 +1977,7 @@ the created span will have the name as the provided value.
-// method declaration
+// method declaration
@NewSpan(name = "customNameOnTestMethod5")
void testMethod5(@SpanTag("testTag") String param);
@@ -1992,7 +1992,7 @@ the tag key will be testTag and the tag value will be test
-@NewSpan(name = "customNameOnTestMethod3")
+@NewSpan(name = "customNameOnTestMethod3")
@Override
public void testMethod3() {
}
@@ -2013,7 +2013,7 @@ with the @NewSpan annotation you can also add logs via the lo
-// method declaration
+// method declaration
@ContinueSpan(log = "testMethod11")
void testMethod11(@SpanTag("testTag11") String param);
@@ -2069,7 +2069,7 @@ Its class name has to be passed as the value of the resolver attrib
-@NewSpan
+@NewSpan
public void getAnnotationForTagValueResolver(@SpanTag(key = "test", resolver = TagValueResolver.class) String test) {
}
@@ -2079,7 +2079,7 @@ public void getAnnotationForTagValueResolver(@SpanTag(key = "test", resolver = T
-@Bean(name = "myCustomTagValueResolver")
+@Bean(name = "myCustomTagValueResolver")
public TagValueResolver tagValueResolver() {
return parameter -> "Value from myCustomTagValueResolver";
}
@@ -2096,7 +2096,7 @@ public TagValueResolver tagValueResolver() {
-@NewSpan
+@NewSpan
public void getAnnotationForTagValueExpression(@SpanTag(key = "test", expression = "length() + ' characters'") String test) {
}
@@ -2114,7 +2114,7 @@ of the bean.
-@NewSpan
+@NewSpan
public void getAnnotationForArgumentToString(@SpanTag("test") Long param) {
}
@@ -2222,7 +2222,7 @@ you have
-static class CustomHttpSpanExtractor implements HttpSpanExtractor {
+static class CustomHttpSpanExtractor implements HttpSpanExtractor {
@Override public Span joinTrace(SpanTextMap carrier) {
Map<String, String> map = TextMapUtil.asMap(carrier);
@@ -2250,7 +2250,7 @@ static class CustomHttpSpanInjector implements HttpSpanInjector {
-@Bean
+@Bean
HttpSpanInjector customHttpSpanInjector() {
return new CustomHttpSpanInjector();
}
@@ -2267,7 +2267,7 @@ that injects the headers into the Http Response and a Servlet filter which makes
-static class CustomHttpServletResponseSpanInjector extends ZipkinHttpSpanInjector {
+static class CustomHttpServletResponseSpanInjector extends ZipkinHttpSpanInjector {
@Override
public void inject(Span span, SpanTextMap carrier) {
@@ -2325,7 +2325,7 @@ static class HttpResponseInjectingTraceFilter extends GenericFilterBean {
-@Bean HttpSpanInjector customHttpServletResponseSpanInjector() {
+@Bean HttpSpanInjector customHttpServletResponseSpanInjector() {
return new CustomHttpServletResponseSpanInjector();
}
@@ -2345,7 +2345,7 @@ 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");
+org.springframework.cloud.sleuth.Span newSpan = tracer.createSpan("redis");
try {
newSpan.tag("redis.op", "get");
newSpan.tag("lc", "redis");
@@ -2385,7 +2385,7 @@ Remember not to add both peer.service tag and the SA t
-spring.zipkin.service.name: foo
+spring.zipkin.service.name: foo
@@ -2404,7 +2404,7 @@ of tags. Implementation of the SpanAdjuster interface can be used t
-@Bean
+@Bean
SpanAdjuster customSpanAdjuster() {
return span -> span.toBuilder().name(scrub(span.getName())).build();
}
@@ -2441,7 +2441,7 @@ Stream based span reporting).
-spring.zipkin.locator.discovery.enabled: true
+spring.zipkin.locator.discovery.enabled: true
@@ -2468,7 +2468,7 @@ for the Span data and pushing it into a Zipkin SpanStore. This appl
-@SpringBootApplication
+@SpringBootApplication
@EnableZipkinStreamServer
public class Consumer {
public static void main(String[] args) {
@@ -2485,7 +2485,7 @@ starters exist for Redis and Kafka). If you add the following UI dependency
-<groupId>io.zipkin.java</groupId>
+<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
@@ -2502,7 +2502,7 @@ started quickly). For a more robust solution you can add MySQL and
-spring:
+spring:
rabbitmq:
host: ${RABBIT_HOST:localhost}
datasource:
@@ -2544,7 +2544,7 @@ querying in the Zipkin Web UI.
-@EnableBinding(SleuthSink.class)
+@EnableBinding(SleuthSink.class)
@SpringBootApplication(exclude = SleuthStreamAutoConfiguration.class)
@MessageEndpoint
public class Consumer {
@@ -2577,7 +2577,7 @@ with name equal to StreamSpanReporter.POLLER. Here you can find an
-@Configuration
+@Configuration
public static class CustomPollerConfiguration {
@Bean(name = StreamSpanReporter.POLLER)
@@ -2618,7 +2618,7 @@ the number of dropped spans will get increased.
-Runnable runnable = new Runnable() {
+Runnable runnable = new Runnable() {
@Override
public void run() {
// do some work
@@ -2641,7 +2641,7 @@ Runnable traceRunnableFromTracer = tracer.wrap(runnable);
-Callable<String> callable = new Callable<String>() {
+Callable<String> callable = new Callable<String>() {
@Override
public String call() throws Exception {
return someLogic();
@@ -2681,7 +2681,7 @@ on before the Hystrix command was called. To disable the custom Hystrix Concurre
-HystrixCommand<String> hystrixCommand = new HystrixCommand<String>(setter) {
+HystrixCommand<String> hystrixCommand = new HystrixCommand<String>(setter) {
@Override
protected String run() throws Exception {
return someLogic();
@@ -2695,7 +2695,7 @@ on before the Hystrix command was called. To disable the custom Hystrix Concurre
-TraceCommand<String> traceCommand = new TraceCommand<String>(tracer, traceKeys, setter) {
+TraceCommand<String> traceCommand = new TraceCommand<String>(tracer, traceKeys, setter) {
@Override
public String doRun() throws Exception {
return someLogic();
@@ -2797,7 +2797,7 @@ wrap ThreadPoolTaskScheduler in a TraceAsyncListenableTaskExe
-@EnableAutoConfiguration
+@EnableAutoConfiguration
@Configuration
public static class TestConfiguration {
@@ -2826,7 +2826,7 @@ can see an example of how to set up such a custom AsyncRestTemplate
-@Configuration
+@Configuration
@EnableAutoConfiguration
static class Config {
@Autowired Tracer tracer;
@@ -2947,7 +2947,7 @@ are creating Spans each time a new task is submitted, invoked or scheduled.
-CompletableFuture<Long> completableFuture = CompletableFuture.supplyAsync(() -> {
+CompletableFuture<Long> completableFuture = CompletableFuture.supplyAsync(() -> {
// perform some logic
return 1_000_000L;
}, new TraceableExecutorService(executorService,
@@ -2963,7 +2963,7 @@ can see an example of how to set up such a custom Executor.
-@Configuration
+@Configuration
@EnableAutoConfiguration
@EnableAsync
static class CustomExecutorConfig extends AsyncConfigurerSupport {
@@ -3040,5 +3040,8 @@ To disable Zuul support set the spring.sleuth.zuul.enabled property
+
+
+