Sync docs from master to gh-pages
This commit is contained in:
@@ -32,7 +32,13 @@ add to the Span a tag with key <code class="literal">custom</code> and a value <
|
||||
from your application. To achieve that it’s enough to just pass the following property
|
||||
to your application to override that value (example for <code class="literal">foo</code> service name):</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.zipkin.service.name</span>: foo</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_customization_of_reported_spans" href="#_customization_of_reported_spans"></a>12.5 Customization of reported spans</h2></div></div></div><p>Before reporting spans to e.g. Zipkin you can be interested in modifying that span in some way.
|
||||
You can achieve that by using the <code class="literal">SpanAdjuster</code> interface.</p><p>In Sleuth we’re generating spans with a fixed name. Some users want to modify the name depending on values
|
||||
of tags. Implementation of the <code class="literal">SpanAdjuster</code> interface can be used to alter that name. Example:</p><p>Example. If you register two beans of <code class="literal">SpanAdjuster</code> type:</p><pre class="programlisting">Unresolved directive in spring-cloud-sleuth.adoc - include::../../../..<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">//spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/SpanAdjusterAspectTests.java[tags=adjuster,indent=0]</span></pre><p>This will lead in changing the name of the reported span to <code class="literal">foo bar</code>, just before it gets reported (e.g. to Zipkin).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_host_locator" href="#_host_locator"></a>12.6 Host locator</h2></div></div></div><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="images/important.png"></td><th align="left">Important</th></tr><tr><td align="left" valign="top"><p>This section is about defining <span class="strong"><strong>host</strong></span> from service discovery. It’s <span class="strong"><strong>NOT</strong></span>
|
||||
of tags. Implementation of the <code class="literal">SpanAdjuster</code> interface can be used to alter that name. Example:</p><p>Example. If you register two beans of <code class="literal">SpanAdjuster</code> type:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Bean</span></em> SpanAdjuster adjusterOne() {
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> span -> span.toBuilder().name(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"foo"</span>).build();
|
||||
}
|
||||
|
||||
<em><span class="hl-annotation" style="color: gray">@Bean</span></em> SpanAdjuster adjusterTwo() {
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> span -> span.toBuilder().name(span.name() + <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">" bar"</span>).build();
|
||||
}</pre><p>This will lead in changing the name of the reported span to <code class="literal">foo bar</code>, just before it gets reported (e.g. to Zipkin).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_host_locator" href="#_host_locator"></a>12.6 Host locator</h2></div></div></div><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="images/important.png"></td><th align="left">Important</th></tr><tr><td align="left" valign="top"><p>This section is about defining <span class="strong"><strong>host</strong></span> from service discovery. It’s <span class="strong"><strong>NOT</strong></span>
|
||||
about finding Zipkin in service discovery.</p></td></tr></table></div><p>In order to define the host that is corresponding to a particular span we need to resolve the host name
|
||||
and port. The default approach is to take it from server properties. If those for some reason are not set
|
||||
then we’re trying to retrieve the host name from the network interfaces.</p><p>If you have the discovery client enabled and prefer to retrieve the host address from the registered
|
||||
|
||||
@@ -695,7 +695,13 @@ add to the Span a tag with key <code class="literal">custom</code> and a value <
|
||||
from your application. To achieve that it’s enough to just pass the following property
|
||||
to your application to override that value (example for <code class="literal">foo</code> service name):</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.zipkin.service.name</span>: foo</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_customization_of_reported_spans" href="#_customization_of_reported_spans"></a>12.5 Customization of reported spans</h2></div></div></div><p>Before reporting spans to e.g. Zipkin you can be interested in modifying that span in some way.
|
||||
You can achieve that by using the <code class="literal">SpanAdjuster</code> interface.</p><p>In Sleuth we’re generating spans with a fixed name. Some users want to modify the name depending on values
|
||||
of tags. Implementation of the <code class="literal">SpanAdjuster</code> interface can be used to alter that name. Example:</p><p>Example. If you register two beans of <code class="literal">SpanAdjuster</code> type:</p><pre class="programlisting">Unresolved directive in spring-cloud-sleuth.adoc - include::../../../..<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">//spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/SpanAdjusterAspectTests.java[tags=adjuster,indent=0]</span></pre><p>This will lead in changing the name of the reported span to <code class="literal">foo bar</code>, just before it gets reported (e.g. to Zipkin).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_host_locator" href="#_host_locator"></a>12.6 Host locator</h2></div></div></div><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="images/important.png"></td><th align="left">Important</th></tr><tr><td align="left" valign="top"><p>This section is about defining <span class="strong"><strong>host</strong></span> from service discovery. It’s <span class="strong"><strong>NOT</strong></span>
|
||||
of tags. Implementation of the <code class="literal">SpanAdjuster</code> interface can be used to alter that name. Example:</p><p>Example. If you register two beans of <code class="literal">SpanAdjuster</code> type:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Bean</span></em> SpanAdjuster adjusterOne() {
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> span -> span.toBuilder().name(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"foo"</span>).build();
|
||||
}
|
||||
|
||||
<em><span class="hl-annotation" style="color: gray">@Bean</span></em> SpanAdjuster adjusterTwo() {
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> span -> span.toBuilder().name(span.name() + <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">" bar"</span>).build();
|
||||
}</pre><p>This will lead in changing the name of the reported span to <code class="literal">foo bar</code>, just before it gets reported (e.g. to Zipkin).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_host_locator" href="#_host_locator"></a>12.6 Host locator</h2></div></div></div><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="images/important.png"></td><th align="left">Important</th></tr><tr><td align="left" valign="top"><p>This section is about defining <span class="strong"><strong>host</strong></span> from service discovery. It’s <span class="strong"><strong>NOT</strong></span>
|
||||
about finding Zipkin in service discovery.</p></td></tr></table></div><p>In order to define the host that is corresponding to a particular span we need to resolve the host name
|
||||
and port. The default approach is to take it from server properties. If those for some reason are not set
|
||||
then we’re trying to retrieve the host name from the network interfaces.</p><p>If you have the discovery client enabled and prefer to retrieve the host address from the registered
|
||||
|
||||
@@ -1503,7 +1503,13 @@ class MyFilter extends GenericFilterBean {
|
||||
<simpara>In Sleuth we’re generating spans with a fixed name. Some users want to modify the name depending on values
|
||||
of tags. Implementation of the <literal>SpanAdjuster</literal> interface can be used to alter that name. Example:</simpara>
|
||||
<simpara>Example. If you register two beans of <literal>SpanAdjuster</literal> type:</simpara>
|
||||
<programlisting language="java" linenumbering="unnumbered">Unresolved directive in spring-cloud-sleuth.adoc - include::../../../..//spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/SpanAdjusterAspectTests.java[tags=adjuster,indent=0]</programlisting>
|
||||
<programlisting language="java" linenumbering="unnumbered">@Bean SpanAdjuster adjusterOne() {
|
||||
return span -> span.toBuilder().name("foo").build();
|
||||
}
|
||||
|
||||
@Bean SpanAdjuster adjusterTwo() {
|
||||
return span -> span.toBuilder().name(span.name() + " bar").build();
|
||||
}</programlisting>
|
||||
<simpara>This will lead in changing the name of the reported span to <literal>foo bar</literal>, just before it gets reported (e.g. to Zipkin).</simpara>
|
||||
</section>
|
||||
<section xml:id="_host_locator">
|
||||
|
||||
Reference in New Issue
Block a user