Sync docs from master to gh-pages

This commit is contained in:
buildmaster
2017-08-24 12:25:45 +00:00
parent ca8d7f09fa
commit 25bcd8daff

View File

@@ -489,6 +489,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<li><a href="#_spring_integration">Spring Integration</a></li>
<li><a href="#_http">HTTP</a></li>
<li><a href="#_example">Example</a></li>
<li><a href="#_tracefilter">TraceFilter</a></li>
<li><a href="#_custom_sa_tag_in_zipkin">Custom SA tag in Zipkin</a></li>
<li><a href="#_custom_service_name">Custom service name</a></li>
<li><a href="#_customization_of_reported_spans">Customization of reported spans</a></li>
@@ -2340,6 +2341,38 @@ HttpResponseInjectingTraceFilter responseInjectingTraceFilter(Tracer tracer) {
</div>
</div>
<div class="sect2">
<h3 id="_tracefilter"><a class="link" href="#_tracefilter">TraceFilter</a></h3>
<div class="paragraph">
<p>You can also modify the behaviour of the <code>TraceFilter</code> - the component that is responsible
for processing the input HTTP request and adding tags basing on the HTTP response. You can customize
the tags, or modify the response headers by registering your own instance of the <code>TraceFilter</code> bean.</p>
</div>
<div class="paragraph">
<p>In the following example we will register the <code>TraceFilter</code> bean and we will add the
<code>ZIPKIN-TRACE-ID</code> response header containing the current Span&#8217;s trace id. Also we will
add to the Span a tag with key <code>custom</code> and a value <code>tag</code>.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="prettyprint highlight"><code class="language-java" data-lang="java">@Bean
TraceFilter myTraceFilter(BeanFactory beanFactory, final Tracer tracer) {
return new TraceFilter(beanFactory) {
@Override protected void addResponseTags(HttpServletResponse response,
Throwable e) {
// execute the default behaviour
super.addResponseTags(response, e);
// for readability we're returning trace id in a hex form
response.addHeader("ZIPKIN-TRACE-ID",
Span.idToHex(tracer.getCurrentSpan().getTraceId()));
// we can also add some custom tags
tracer.addTag("custom", "tag");
}
};
}</code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_custom_sa_tag_in_zipkin"><a class="link" href="#_custom_sa_tag_in_zipkin">Custom SA tag in Zipkin</a></h3>
<div class="paragraph">
<p>Sometimes you want to create a manual Span that will wrap a call to an external service which is not instrumented.