Sync docs from 1.0.x to gh-pages
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 161 KiB After Width: | Height: | Size: 218 KiB |
|
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 160 KiB After Width: | Height: | Size: 139 KiB |
164
1.0.x/index.html
@@ -428,9 +428,24 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
|
||||
<div id="toctitle">Table of Contents</div>
|
||||
<ul class="sectlevel2">
|
||||
<li><a href="#_terminology">Terminology</a></li>
|
||||
<li><a href="#_purpose">Purpose</a></li>
|
||||
<li><a href="#_adding_to_the_project">Adding to the project</a></li>
|
||||
<li><a href="#_additional_resources">Additional resources</a></li>
|
||||
<li><a href="#_purpose">Purpose</a>
|
||||
<ul class="sectlevel3">
|
||||
<li><a href="#_distributed_tracing_with_zipkin">Distributed tracing with Zipkin</a></li>
|
||||
<li><a href="#_log_correlation">Log correlation</a>
|
||||
<ul class="sectlevel4">
|
||||
<li><a href="#_json_logback_with_logstash">JSON Logback with Logstash</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#_adding_to_the_project">Adding to the project</a>
|
||||
<ul class="sectlevel3">
|
||||
<li><a href="#_only_sleuth_log_correlation">Only Sleuth (log correlation)</a></li>
|
||||
<li><a href="#_sleuth_with_zipkin_via_http">Sleuth with Zipkin via HTTP</a></li>
|
||||
<li><a href="#_sleuth_with_zipkin_via_spring_cloud_stream">Sleuth with Zipkin via Spring Cloud Stream</a></li>
|
||||
<li><a href="#_spring_cloud_sleuth_stream_zipkin_collector">Spring Cloud Sleuth Stream Zipkin Collector</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#_features">Features</a></li>
|
||||
<li><a href="#_sampling">Sampling</a></li>
|
||||
<li><a href="#_instrumentation">Instrumentation</a></li>
|
||||
@@ -465,12 +480,34 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
|
||||
<li><a href="#_integrations">Integrations</a>
|
||||
<ul class="sectlevel2">
|
||||
<li><a href="#_runnable_and_callable">Runnable and Callable</a></li>
|
||||
<li><a href="#_hystrix">Hystrix</a></li>
|
||||
<li><a href="#_hystrix">Hystrix</a>
|
||||
<ul class="sectlevel3">
|
||||
<li><a href="#_custom_concurrency_strategy">Custom Concurrency Strategy</a></li>
|
||||
<li><a href="#_manual_command_setting">Manual Command setting</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#_rxjava">RxJava</a></li>
|
||||
<li><a href="#_http_integration">HTTP integration</a></li>
|
||||
<li><a href="#_http_client_integration">HTTP client integration</a></li>
|
||||
<li><a href="#_http_integration">HTTP integration</a>
|
||||
<ul class="sectlevel3">
|
||||
<li><a href="#_http_filter">HTTP Filter</a></li>
|
||||
<li><a href="#_handlerinterceptor">HandlerInterceptor</a></li>
|
||||
<li><a href="#_async_servlet_support">Async Servlet support</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#_http_client_integration">HTTP client integration</a>
|
||||
<ul class="sectlevel3">
|
||||
<li><a href="#_synchronous_rest_template">Synchronous Rest Template</a></li>
|
||||
<li><a href="#_asynchronous_rest_template">Asynchronous Rest Template</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#_feign">Feign</a></li>
|
||||
<li><a href="#_asynchronous_communication">Asynchronous communication</a></li>
|
||||
<li><a href="#_asynchronous_communication">Asynchronous communication</a>
|
||||
<ul class="sectlevel3">
|
||||
<li><a href="#__async_annotated_methods">@Async annotated methods</a></li>
|
||||
<li><a href="#__scheduled_annotated_methods">@Scheduled annotated methods</a></li>
|
||||
<li><a href="#_executor_executorservice_and_scheduledexecutorservice">Executor, ExecutorService and ScheduledExecutorService</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#_messaging">Messaging</a></li>
|
||||
<li><a href="#_zuul">Zuul</a></li>
|
||||
</ul>
|
||||
@@ -483,7 +520,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
|
||||
<div id="preamble">
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<p><strong>1.1.0.BUILD-SNAPSHOT</strong></p>
|
||||
<p><strong>1.0.11.BUILD-SNAPSHOT</strong></p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>Spring Cloud Sleuth implements a distributed tracing solution for <a href="http://cloud.spring.io">Spring Cloud</a>.</p>
|
||||
@@ -1195,22 +1232,6 @@ public class ZipkinStreamServerApplication {
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_additional_resources">Additional resources</h2>
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<p><strong>Marcin Grzejszczak talking about Spring Cloud Sleuth and Zipkin</strong></p>
|
||||
</div>
|
||||
<div class="videoblock">
|
||||
<div class="content">
|
||||
<iframe src="https://www.youtube.com/embed/eQV71Mw1u1c?rel=0" frameborder="0" allowfullscreen></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p><a href="https://www.youtube.com/watch?v=eQV71Mw1u1c">click here to see the video</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_features">Features</h2>
|
||||
<div class="sectionbody">
|
||||
<div class="ulist">
|
||||
@@ -1354,7 +1375,9 @@ fixed fraction of spans.</p>
|
||||
<td class="content">
|
||||
the <code>PercentageBasedSampler</code> is the default if you are using
|
||||
<code>spring-cloud-sleuth-zipkin</code> or <code>spring-cloud-sleuth-stream</code>. You can
|
||||
configure the exports using <code>spring.sleuth.sampler.percentage</code>.
|
||||
configure the exports using <code>spring.sleuth.sampler.percentage</code>. The passed
|
||||
value needs to be a double from <code>0.0</code> to <code>1.0</code> so it’s not a percentage.
|
||||
For backwards compatibility reasons we’re not changing the property name.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -1754,19 +1777,13 @@ to your bean definition.</p>
|
||||
<div class="sect2">
|
||||
<h3 id="_http">HTTP</h3>
|
||||
<div class="paragraph">
|
||||
<p>For HTTP these are the beans responsible for creation of a Span from a <code>HttpServletRequest</code>
|
||||
and filling in the <code>HttpServletResponse</code> with tracing information.</p>
|
||||
<p>For HTTP these are the beans responsible for creation of a Span from a <code>HttpServletRequest</code>.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlight"><code class="language-java" data-lang="java">@Bean
|
||||
public SpanExtractor<HttpServletRequest> httpServletRequestSpanExtractor() {
|
||||
...
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SpanInjector<HttpServletResponse> httpServletResponseSpanInjector() {
|
||||
...
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1812,7 +1829,20 @@ you have</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>The following <code>SpanInjector</code> could be created</p>
|
||||
<p>And you could register it like this:</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlight"><code class="language-java" data-lang="java">@Bean
|
||||
@Primary
|
||||
SpanExtractor<HttpServletRequest> customHttpServletRequestSpanExtractor() {
|
||||
return new CustomHttpServletRequestSpanExtractor();
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>Spring Cloud Sleuth does not add trace/span related headers to the Http Response for security reasons. If you need the headers then a custom <code>SpanInjector</code>
|
||||
that injects the headers into the Http Response and a Servlet filter which makes use of this can be added the following way:</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
@@ -1821,9 +1851,27 @@ you have</p>
|
||||
|
||||
@Override
|
||||
public void inject(Span span, HttpServletResponse carrier) {
|
||||
carrier.addHeader("correlationId", Span.idToHex(span.getTraceId()));
|
||||
carrier.addHeader("mySpanId", Span.idToHex(span.getSpanId()));
|
||||
// inject the rest of Span values to the header
|
||||
carrier.addHeader(Span.TRACE_ID_NAME, Span.idToHex(span.getTraceId()));
|
||||
carrier.addHeader(Span.SPAN_ID_NAME, Span.idToHex(span.getSpanId()));
|
||||
}
|
||||
}
|
||||
|
||||
static class HttpResponseInjectingTraceFilter extends GenericFilterBean {
|
||||
|
||||
private final Tracer tracer;
|
||||
private final SpanInjector<HttpServletResponse> spanInjector;
|
||||
|
||||
public HttpResponseInjectingTraceFilter(Tracer tracer, SpanInjector<HttpServletResponse> spanInjector) {
|
||||
this.tracer = tracer;
|
||||
this.spanInjector = spanInjector;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
|
||||
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||
Span currentSpan = this.tracer.getCurrentSpan();
|
||||
this.spanInjector.inject(currentSpan, response);
|
||||
filterChain.doFilter(request, response);
|
||||
}
|
||||
}</code></pre>
|
||||
</div>
|
||||
@@ -1834,15 +1882,13 @@ you have</p>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlight"><code class="language-java" data-lang="java">@Bean
|
||||
@Primary
|
||||
SpanExtractor<HttpServletRequest> customHttpServletRequestSpanExtractor() {
|
||||
return new CustomHttpServletRequestSpanExtractor();
|
||||
SpanInjector<HttpServletResponse> customHttpServletResponseSpanInjector() {
|
||||
return new CustomHttpServletResponseSpanInjector();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
SpanInjector<HttpServletResponse> customHttpServletResponseSpanInjector() {
|
||||
return new CustomHttpServletResponseSpanInjector();
|
||||
HttpResponseInjectingTraceFilter responseInjectingTraceFilter(Tracer tracer) {
|
||||
return new HttpResponseInjectingTraceFilter(tracer, customHttpServletResponseSpanInjector());
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2011,25 +2057,6 @@ the consumer app).
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>In order to customize the polling mechanism you can create a bean of <code>PollerMetadata</code> type
|
||||
with name equal to <code>StreamSpanReporter.POLLER</code>. Here you can find an example of such a configuration.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlight"><code class="language-java" data-lang="java">@Configuration
|
||||
public static class CustomPollerConfiguration {
|
||||
|
||||
@Bean(name = StreamSpanReporter.POLLER)
|
||||
PollerMetadata customPoller() {
|
||||
PollerMetadata poller = new PollerMetadata();
|
||||
poller.setMaxMessagesPerPoll(500);
|
||||
poller.setTrigger(new PeriodicTrigger(5000L));
|
||||
return poller;
|
||||
}
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2338,23 +2365,10 @@ backwards compatibility in 1.0.4 we’ve started sending both valid and inva
|
||||
in Spring Cloud Sleuth 1.1 we will remove the support for the deprecated headers.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>You can provide the <code>spring.sleuth.integration.patterns</code> pattern to explicitly
|
||||
<p>Since 1.0.4 you can provide the <code>spring.sleuth.integration.patterns</code> pattern to explicitly
|
||||
provide the names of channels that you want to include for tracing. By default all channels
|
||||
are included.</p>
|
||||
</div>
|
||||
<div class="admonitionblock important">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="icon">
|
||||
<div class="title">Important</div>
|
||||
</td>
|
||||
<td class="content">
|
||||
When using the <code>Executor</code> to build a Spring Integration <code>IntegrationFlow</code> remember to use the <strong>untraced</strong> version of the <code>Executor</code>.
|
||||
Decorating Spring Integration Executor Channel with <code>TraceableExecutorService</code> will cause the spans to be improperly closed.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_zuul">Zuul</h3>
|
||||
|
||||