Sync docs from 2.0.x to gh-pages
This commit is contained in:
@@ -1,41 +1,18 @@
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>11. Span Data as Messages</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-sleuth.html" title="Spring Cloud Sleuth"><link rel="up" href="multi_spring-cloud-sleuth.html" title="Spring Cloud Sleuth"><link rel="prev" href="multi__sending_spans_to_zipkin.html" title="10. Sending spans to Zipkin"><link rel="next" href="multi__metrics.html" title="12. Metrics"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">11. Span Data as Messages</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__sending_spans_to_zipkin.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__metrics.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_span_data_as_messages" href="#_span_data_as_messages"></a>11. Span Data as Messages</h1></div></div></div><p>You can accumulate and send span data over
|
||||
<title>11. Span Data as Messages</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-sleuth.html" title="Spring Cloud Sleuth"><link rel="up" href="multi_spring-cloud-sleuth.html" title="Spring Cloud Sleuth"><link rel="prev" href="multi__sending_spans_to_zipkin.html" title="10. Sending spans to Zipkin"><link rel="next" href="multi__metrics.html" title="12. Metrics"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">11. Span Data as Messages</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__sending_spans_to_zipkin.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__metrics.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_span_data_as_messages" href="#_span_data_as_messages"></a>11. Span Data as Messages</h1></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>The suggested approach is to use the Zipkin’s
|
||||
native support for message based span sending. Starting from
|
||||
Edgware Zipkin Stream server is deprecated and in Finchley
|
||||
it got removed.</p></td></tr></table></div><p>You can accumulate and send span data over
|
||||
<a class="link" href="http://cloud.spring.io/spring-cloud-stream" target="_top">Spring Cloud Stream</a> by
|
||||
including the <code class="literal">spring-cloud-sleuth-stream</code> jar as a dependency, and
|
||||
adding a Channel Binder implementation
|
||||
(e.g. <code class="literal">spring-cloud-starter-stream-rabbit</code> for RabbitMQ or
|
||||
<code class="literal">spring-cloud-starter-stream-kafka</code> for Kafka). This will
|
||||
automatically turn your app into a producer of messages with payload
|
||||
type <code class="literal">Spans</code>.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_zipkin_consumer" href="#_zipkin_consumer"></a>11.1 Zipkin Consumer</h2></div></div></div><p>There is a special convenience annotation for setting up a message consumer
|
||||
for the Span data and pushing it into a Zipkin <code class="literal">SpanStore</code>. This application</p><pre class="programlisting">Unresolved directive in spring-cloud-sleuth.adoc - include::../../../../spring-cloud-sleuth-zipkin-stream/src/test/java/org/springframework/cloud/sleuth/zipkin/stream/documentation/Consumer.java[tags=zipkin_consumer,indent=<span class="hl-number">0</span>]</pre><p>will listen for the Span data on whatever transport you provide via a
|
||||
Spring Cloud Stream <code class="literal">Binder</code> (e.g. include
|
||||
<code class="literal">spring-cloud-starter-stream-rabbit</code> for RabbitMQ, and similar
|
||||
starters exist for Redis and Kafka). If you add the following UI dependency</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>io.zipkin.java<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>zipkin-autoconfigure-ui<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span></pre><p>Then you’ll have your app a
|
||||
<a class="link" href="https://github.com/openzipkin/zipkin" target="_top">Zipkin server</a>, which hosts
|
||||
the UI and api on port 9411.</p><p>The default <code class="literal">SpanStore</code> is in-memory (good for demos and getting
|
||||
started quickly). For a more robust solution you can add MySQL and
|
||||
<code class="literal">spring-boot-starter-jdbc</code> to your classpath and enable the JDBC
|
||||
<code class="literal">SpanStore</code> via configuration, e.g.:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> rabbitmq</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> host</span>: ${RABBIT_HOST:localhost<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">}</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> datasource</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> schema</span>: classpath:/mysql.sql
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> url</span>: jdbc:mysql://${MYSQL_HOST:localhost}/test
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> username</span>: root
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> password</span>: root
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Switch this on to create the schema on startup:</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> initialize</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">true</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> continueOnError</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">true</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> sleuth</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> enabled</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">false</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">zipkin</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> storage</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> type</span>: mysql</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>The <code class="literal">@EnableZipkinStreamServer</code> is also annotated with
|
||||
<code class="literal">@EnableZipkinServer</code> so the process will also expose the standard
|
||||
Zipkin server endpoints for collecting spans over HTTP, and for
|
||||
querying in the Zipkin Web UI.</p></td></tr></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_custom_consumer" href="#_custom_consumer"></a>11.2 Custom Consumer</h2></div></div></div><p>A custom consumer can also easily be implemented using
|
||||
type <code class="literal">Spans</code>.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_zipkin_consumer" href="#_zipkin_consumer"></a>11.1 Zipkin Consumer</h2></div></div></div><p>Please refer to the <a class="link" href="http://cloud.spring.io/spring-cloud-static/Dalston.SR4/multi/multi__span_data_as_messages.html#_zipkin_consumer" target="_top">Dalston Documentaion</a>
|
||||
on how to create a Stream Zipkin server. That approach has been
|
||||
deprecated in Edgware and removed in Finchley release.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_custom_consumer" href="#_custom_consumer"></a>11.2 Custom Consumer</h2></div></div></div><p>A custom consumer can also easily be implemented using
|
||||
<code class="literal">spring-cloud-sleuth-stream</code> and binding to the <code class="literal">SleuthSink</code>. Example:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@EnableBinding(SleuthSink.class)</span></em>
|
||||
<em><span class="hl-annotation" style="color: gray">@SpringBootApplication(exclude = SleuthStreamAutoConfiguration.class)</span></em>
|
||||
<em><span class="hl-annotation" style="color: gray">@MessageEndpoint</span></em>
|
||||
|
||||
@@ -567,42 +567,19 @@ Stream based span reporting).</p><pre class="programlisting"><span xmlns:d="http
|
||||
when the span is closed, it will be sent to Zipkin over HTTP. The communication
|
||||
is asynchronous. You can configure the URL by setting the <code class="literal">spring.zipkin.baseUrl</code>
|
||||
property as follows:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.zipkin.baseUrl</span>: http://<span class="hl-number">192.168</span>.<span class="hl-number">99.100</span>:<span class="hl-number">9411</span>/</pre><p>If you want to find Zipkin via service discovery it’s enough to pass the
|
||||
Zipkin’s service id inside the URL (example for <code class="literal">zipkinserver</code> service id)</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.zipkin.baseUrl</span>: http://zipkinserver/</pre></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_span_data_as_messages" href="#_span_data_as_messages"></a>11. Span Data as Messages</h1></div></div></div><p>You can accumulate and send span data over
|
||||
Zipkin’s service id inside the URL (example for <code class="literal">zipkinserver</code> service id)</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.zipkin.baseUrl</span>: http://zipkinserver/</pre></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_span_data_as_messages" href="#_span_data_as_messages"></a>11. Span Data as Messages</h1></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>The suggested approach is to use the Zipkin’s
|
||||
native support for message based span sending. Starting from
|
||||
Edgware Zipkin Stream server is deprecated and in Finchley
|
||||
it got removed.</p></td></tr></table></div><p>You can accumulate and send span data over
|
||||
<a class="link" href="http://cloud.spring.io/spring-cloud-stream" target="_top">Spring Cloud Stream</a> by
|
||||
including the <code class="literal">spring-cloud-sleuth-stream</code> jar as a dependency, and
|
||||
adding a Channel Binder implementation
|
||||
(e.g. <code class="literal">spring-cloud-starter-stream-rabbit</code> for RabbitMQ or
|
||||
<code class="literal">spring-cloud-starter-stream-kafka</code> for Kafka). This will
|
||||
automatically turn your app into a producer of messages with payload
|
||||
type <code class="literal">Spans</code>.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_zipkin_consumer" href="#_zipkin_consumer"></a>11.1 Zipkin Consumer</h2></div></div></div><p>There is a special convenience annotation for setting up a message consumer
|
||||
for the Span data and pushing it into a Zipkin <code class="literal">SpanStore</code>. This application</p><pre class="programlisting">Unresolved directive in spring-cloud-sleuth.adoc - include::../../../../spring-cloud-sleuth-zipkin-stream/src/test/java/org/springframework/cloud/sleuth/zipkin/stream/documentation/Consumer.java[tags=zipkin_consumer,indent=<span class="hl-number">0</span>]</pre><p>will listen for the Span data on whatever transport you provide via a
|
||||
Spring Cloud Stream <code class="literal">Binder</code> (e.g. include
|
||||
<code class="literal">spring-cloud-starter-stream-rabbit</code> for RabbitMQ, and similar
|
||||
starters exist for Redis and Kafka). If you add the following UI dependency</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>io.zipkin.java<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>zipkin-autoconfigure-ui<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span></pre><p>Then you’ll have your app a
|
||||
<a class="link" href="https://github.com/openzipkin/zipkin" target="_top">Zipkin server</a>, which hosts
|
||||
the UI and api on port 9411.</p><p>The default <code class="literal">SpanStore</code> is in-memory (good for demos and getting
|
||||
started quickly). For a more robust solution you can add MySQL and
|
||||
<code class="literal">spring-boot-starter-jdbc</code> to your classpath and enable the JDBC
|
||||
<code class="literal">SpanStore</code> via configuration, e.g.:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> rabbitmq</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> host</span>: ${RABBIT_HOST:localhost<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">}</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> datasource</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> schema</span>: classpath:/mysql.sql
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> url</span>: jdbc:mysql://${MYSQL_HOST:localhost}/test
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> username</span>: root
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> password</span>: root
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Switch this on to create the schema on startup:</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> initialize</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">true</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> continueOnError</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">true</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> sleuth</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> enabled</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">false</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">zipkin</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> storage</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> type</span>: mysql</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>The <code class="literal">@EnableZipkinStreamServer</code> is also annotated with
|
||||
<code class="literal">@EnableZipkinServer</code> so the process will also expose the standard
|
||||
Zipkin server endpoints for collecting spans over HTTP, and for
|
||||
querying in the Zipkin Web UI.</p></td></tr></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_custom_consumer" href="#_custom_consumer"></a>11.2 Custom Consumer</h2></div></div></div><p>A custom consumer can also easily be implemented using
|
||||
type <code class="literal">Spans</code>.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_zipkin_consumer" href="#_zipkin_consumer"></a>11.1 Zipkin Consumer</h2></div></div></div><p>Please refer to the <a class="link" href="http://cloud.spring.io/spring-cloud-static/Dalston.SR4/multi/multi__span_data_as_messages.html#_zipkin_consumer" target="_top">Dalston Documentaion</a>
|
||||
on how to create a Stream Zipkin server. That approach has been
|
||||
deprecated in Edgware and removed in Finchley release.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_custom_consumer" href="#_custom_consumer"></a>11.2 Custom Consumer</h2></div></div></div><p>A custom consumer can also easily be implemented using
|
||||
<code class="literal">spring-cloud-sleuth-stream</code> and binding to the <code class="literal">SleuthSink</code>. Example:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@EnableBinding(SleuthSink.class)</span></em>
|
||||
<em><span class="hl-annotation" style="color: gray">@SpringBootApplication(exclude = SleuthStreamAutoConfiguration.class)</span></em>
|
||||
<em><span class="hl-annotation" style="color: gray">@MessageEndpoint</span></em>
|
||||
|
||||
@@ -1301,6 +1301,12 @@ Zipkin’s service id inside the URL (example for <literal>zipkinserver</lit
|
||||
</chapter>
|
||||
<chapter xml:id="_span_data_as_messages">
|
||||
<title>Span Data as Messages</title>
|
||||
<important>
|
||||
<simpara>The suggested approach is to use the Zipkin’s
|
||||
native support for message based span sending. Starting from
|
||||
Edgware Zipkin Stream server is deprecated and in Finchley
|
||||
it got removed.</simpara>
|
||||
</important>
|
||||
<simpara>You can accumulate and send span data over
|
||||
<link xl:href="http://cloud.spring.io/spring-cloud-stream">Spring Cloud Stream</link> by
|
||||
including the <literal>spring-cloud-sleuth-stream</literal> jar as a dependency, and
|
||||
@@ -1311,44 +1317,9 @@ automatically turn your app into a producer of messages with payload
|
||||
type <literal>Spans</literal>.</simpara>
|
||||
<section xml:id="_zipkin_consumer">
|
||||
<title>Zipkin Consumer</title>
|
||||
<simpara>There is a special convenience annotation for setting up a message consumer
|
||||
for the Span data and pushing it into a Zipkin <literal>SpanStore</literal>. This application</simpara>
|
||||
<programlisting language="java" linenumbering="unnumbered">Unresolved directive in spring-cloud-sleuth.adoc - include::../../../../spring-cloud-sleuth-zipkin-stream/src/test/java/org/springframework/cloud/sleuth/zipkin/stream/documentation/Consumer.java[tags=zipkin_consumer,indent=0]</programlisting>
|
||||
<simpara>will listen for the Span data on whatever transport you provide via a
|
||||
Spring Cloud Stream <literal>Binder</literal> (e.g. include
|
||||
<literal>spring-cloud-starter-stream-rabbit</literal> for RabbitMQ, and similar
|
||||
starters exist for Redis and Kafka). If you add the following UI dependency</simpara>
|
||||
<programlisting language="xml" linenumbering="unnumbered"><groupId>io.zipkin.java</groupId>
|
||||
<artifactId>zipkin-autoconfigure-ui</artifactId></programlisting>
|
||||
<simpara>Then you’ll have your app a
|
||||
<link xl:href="https://github.com/openzipkin/zipkin">Zipkin server</link>, which hosts
|
||||
the UI and api on port 9411.</simpara>
|
||||
<simpara>The default <literal>SpanStore</literal> is in-memory (good for demos and getting
|
||||
started quickly). For a more robust solution you can add MySQL and
|
||||
<literal>spring-boot-starter-jdbc</literal> to your classpath and enable the JDBC
|
||||
<literal>SpanStore</literal> via configuration, e.g.:</simpara>
|
||||
<programlisting language="yaml" linenumbering="unnumbered">spring:
|
||||
rabbitmq:
|
||||
host: ${RABBIT_HOST:localhost}
|
||||
datasource:
|
||||
schema: classpath:/mysql.sql
|
||||
url: jdbc:mysql://${MYSQL_HOST:localhost}/test
|
||||
username: root
|
||||
password: root
|
||||
# Switch this on to create the schema on startup:
|
||||
initialize: true
|
||||
continueOnError: true
|
||||
sleuth:
|
||||
enabled: false
|
||||
zipkin:
|
||||
storage:
|
||||
type: mysql</programlisting>
|
||||
<note>
|
||||
<simpara>The <literal>@EnableZipkinStreamServer</literal> is also annotated with
|
||||
<literal>@EnableZipkinServer</literal> so the process will also expose the standard
|
||||
Zipkin server endpoints for collecting spans over HTTP, and for
|
||||
querying in the Zipkin Web UI.</simpara>
|
||||
</note>
|
||||
<simpara>Please refer to the <link xl:href="http://cloud.spring.io/spring-cloud-static/Dalston.SR4/multi/multi__span_data_as_messages.html#_zipkin_consumer">Dalston Documentaion</link>
|
||||
on how to create a Stream Zipkin server. That approach has been
|
||||
deprecated in Edgware and removed in Finchley release.</simpara>
|
||||
</section>
|
||||
<section xml:id="_custom_consumer">
|
||||
<title>Custom Consumer</title>
|
||||
|
||||
Reference in New Issue
Block a user