You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2016/04/05 11:19:52 UTC

svn commit: r984785 - in /websites/production/camel/content: cache/main.pageCache camel-zipkin.html

Author: buildbot
Date: Tue Apr  5 09:19:52 2016
New Revision: 984785

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/camel-zipkin.html

Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/camel/content/camel-zipkin.html
==============================================================================
--- websites/production/camel/content/camel-zipkin.html (original)
+++ websites/production/camel/content/camel-zipkin.html Tue Apr  5 09:19:52 2016
@@ -40,6 +40,7 @@
   <link href='//camel.apache.org/styles/highlighter/styles/shThemeCamel.css' rel='stylesheet' type='text/css' />
   <script src='//camel.apache.org/styles/highlighter/scripts/shCore.js' type='text/javascript'></script>
   <script src='//camel.apache.org/styles/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
+  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
   
   <script type="text/javascript">
   SyntaxHighlighter.defaults['toolbar'] = false;
@@ -84,16 +85,38 @@
 	<tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><p><strong>Available as of Camel 2.18</strong></p><p>The camel-zipkin component is used for tracing and timing incoming and outgoing Camel messages using <a shape="rect" class="external-link" href="http://zipkin.io/" rel="nofollow">zipkin</a>.</p><p>Events (span) are captured for incoming and outgoing messages being sent to/from Camel.</p><p>This means you need to configure which which Camel endpoints that maps to zipkin service names.</p><p>The mapping can be configured using:</p><ul><li>route id - A Camel route id</li><li><span style="line-height: 1.42857;">endpoint url - A Camel endpoint url</span></li></ul><p>For both kinds you can use wildcards and regular expressions to match, which is using the rules from&#160;<a shape="rect" href="intercept.html">Intercept</a>.</p><p>To match all Camel messages you can use * in the pattern and configure that to the same service name.</p><p>If no mapping has been configured then Camel will fallback and us
 e endpoint uri's as service names.&#160;<br clear="none">However its recommended to configure service mappings so you can use human logic names instead of Camel&#160;endpoint uris in the names.</p><p>Camel will auto-configure a ScribeSpanCollector if no SpanCollector explicit has been configured, and&#160;if the hostname and port to the span collector has been configured as environment variables</p><ul><li>ZIPKIN_COLLECTOR_SERVICE_HOST - The hostname</li><li>ZIPKIN_COLLECTOR_SERVICE_PORT - The port number</li></ul><p>This makes it easy to use camel-zipkin in container platforms where the platform can run your application in a linux container where service configurations are provided as environment variables.</p><h3 id="camel-zipkin-Options">Options</h3><p>You can configure the following options on&#160;ZipkinEventNotifier</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Option</th><th colspan="1" rowspan="1" class=
 "confluenceTh">Default</th><th colspan="1" rowspan="1" class="confluenceTh">Description</th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">rate</td><td colspan="1" rowspan="1" class="confluenceTd">1.0f</td><td colspan="1" rowspan="1" class="confluenceTd">Configures a rate that decides how many events should be traced by zipkin.<br clear="none">The rate is expressed as a percentage (1.0f = 100%, 0.5f is 50%, 0.1f is 10%).</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">spanCollector</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">The collector to use for sending zipkin span events to the zipkin server.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">serviceName</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">To use a global service name that matches all Camel events</td></tr><tr><td colspan="1" rowspan="1" class="conf
 luenceTd">serviceMappings</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets the service mappings that matches Camel events to the given zipkin service name.<br clear="none">The content is a Map&lt;String, String&gt; where the key is a pattern and the value is the service name.<br clear="none">The pattern uses the rules from <a shape="rect" href="intercept.html">Intercept</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">excludePatterns</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets exclude pattern(s) that will disable tracing with zipkin for Camel messages that matches the pattern.<br clear="none">The content is a Set&lt;String&gt; where the key is a pattern. The pattern uses the rules from <a shape="rect" href="intercept.html">Intercept</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">includeMessa
 geBody</td><td colspan="1" rowspan="1" class="confluenceTd">false</td><td colspan="1" rowspan="1" class="confluenceTd">Whether to include the Camel message body in the zipkin traces.<br clear="none">This is not recommended for production usage, or when having big payloads. You can limit the size by configuring the <a shape="rect" href="how-do-i-set-the-max-chars-when-debug-logging-messages-in-camel.html">max debug log size</a>.&#160;</td></tr></tbody></table></div><h3 id="camel-zipkin-Example">Example</h3><p>To enable camel-zipkin you need to configure first</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ZipkinEventNotifier zipkin = new ZipkinEventNotifier();
+<div class="wiki-content maincontent"><p><strong>Available as of Camel 2.18</strong></p><p>The camel-zipkin component is used for tracing and timing incoming and outgoing Camel messages using <a shape="rect" class="external-link" href="http://zipkin.io/" rel="nofollow">zipkin</a>.</p><p>Events (span) are captured for incoming and outgoing messages being sent to/from Camel.</p><p>This means you need to configure which which Camel endpoints that maps to zipkin service names.</p><p>The mapping can be configured using:</p><ul><li>route id - A Camel route id</li><li><span style="line-height: 1.42857;">endpoint url - A Camel endpoint url</span></li></ul><p>For both kinds you can use wildcards and regular expressions to match, which is using the rules from&#160;<a shape="rect" href="intercept.html">Intercept</a>.</p><p>To match all Camel messages you can use * in the pattern and configure that to the same service name.</p><p>If no mapping has been configured then Camel will fallback and us
 e endpoint uri's as service names.&#160;<br clear="none">However its recommended to configure service mappings so you can use human logic names instead of Camel&#160;endpoint uris in the names.</p><p>Camel will auto-configure a ScribeSpanCollector if no SpanCollector explicit has been configured, and&#160;if the hostname and port to the span collector has been configured as environment variables</p><ul><li>ZIPKIN_COLLECTOR_SERVICE_HOST - The hostname</li><li>ZIPKIN_COLLECTOR_SERVICE_PORT - The port number</li></ul><p>This makes it easy to use camel-zipkin in container platforms where the platform can run your application in a linux container where service configurations are provided as environment variables.</p><h3 id="camel-zipkin-Options">Options</h3><p>You can configure the following options on&#160;ZipkinEventNotifier</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Option</th><th colspan="1" rowspan="1" class=
 "confluenceTh">Default</th><th colspan="1" rowspan="1" class="confluenceTh">Description</th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">rate</td><td colspan="1" rowspan="1" class="confluenceTd">1.0f</td><td colspan="1" rowspan="1" class="confluenceTd">Configures a rate that decides how many events should be traced by zipkin.<br clear="none">The rate is expressed as a percentage (1.0f = 100%, 0.5f is 50%, 0.1f is 10%).</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">spanCollector</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Mandatory:</strong> The collector to use for sending zipkin span events to the zipkin server.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">serviceName</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">To use a global service name that matches all Camel events</td></tr><tr><td colspan
 ="1" rowspan="1" class="confluenceTd">clientServiceMappings</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets the <strong>client</strong> service mappings that matches Camel events to the given zipkin service name.<br clear="none">The content is a Map&lt;String, String&gt; where the key is a pattern and the value is the service name.<br clear="none">The pattern uses the rules from <a shape="rect" href="intercept.html">Intercept</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">serverServiceMappings</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"><span>Sets the <strong>server</strong> service mappings that matches Camel events to the given zipkin service name.</span><br clear="none"><span>The content is a Map&lt;String, String&gt; where the key is a pattern and the value is the service name.</span><br clear="none"><span>The patte
 rn uses the rules from </span><a shape="rect" href="intercept.html">Intercept</a><span>.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">excludePatterns</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets exclude pattern(s) that will disable tracing with zipkin for Camel messages that matches the pattern.<br clear="none">The content is a Set&lt;String&gt; where the key is a pattern. The pattern uses the rules from <a shape="rect" href="intercept.html">Intercept</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">includeMessageBody</td><td colspan="1" rowspan="1" class="confluenceTd">false</td><td colspan="1" rowspan="1" class="confluenceTd">Whether to include the Camel message body in the zipkin traces.<br clear="none">This is not recommended for production usage, or when having big payloads. You can limit the size by configuring the <a shape="rect" href="how-do-i-set-the-max
 -chars-when-debug-logging-messages-in-camel.html">max debug log size</a>.&#160;</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">includeMessageBodyStreams</td><td colspan="1" rowspan="1" class="confluenceTd">false</td><td colspan="1" rowspan="1" class="confluenceTd"><p>Whether to include message bodies that are stream based in the zipkin traces.<br clear="none">This requires enabling <a shape="rect" rel="nofollow"></a><a shape="rect" rel="nofollow">stream</a><a shape="rect" href="stream-caching.html"> caching</a> on the routes or globally on the CamelContext.<br clear="none"><span>This is not recommended for production usage, or when having big payloads. You can limit the size by configuring the </span><a shape="rect" href="how-do-i-set-the-max-chars-when-debug-logging-messages-in-camel.html">max debug log size</a><span>.&#160;</span>&#160;</p></td></tr></tbody></table></div><h3 id="camel-zipkin-Example">Example</h3><p>To enable camel-zipkin you need to configure first<
 /p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ZipkinTracer zipkin = new ZipkinTracer();
 // configure the scribe span collector with the hostname and port for the Zipkin Collector Server 
-zipkin.setSpanCollector(new ScribeSpanCollector(&quot;192.168.90.100, 9410);
-// and then add zipkin as event notifier
-camelContext.getManagementStrategy().addEventNotifier(zipkin);]]></script>
-</div></div><p>The configuration about will the trace all incoming and outgoing messages in Camel routes.&#160;</p><p>However if you want to map Camel endpoints to human friendly logical names, you can add mappings such as:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[zipkin.addServiceMapping(&quot;activemq:queue:invoice&quot;, &quot;invoices&quot;);
-zipkin.addServiceMapping(&quot;http:legacy.server.com*&quot;, &quot;old-junk&quot;);]]></script>
-</div></div><h3 id="camel-zipkin-camel-zipin-starter">camel-zipin-starter</h3><p>If you are using&#160;<a shape="rect" href="spring-boot.html">Spring Boot</a> then you can add the&#160;<code>camel-zipkin-starter</code> dependency, and turn on zipkin by annotating the main class with <code>@CamelZipkin</code>. You can then configure camel-zipkin in the&#160;<code>application.properties</code> file where you can configure the hostname and port number for the Zipkin Server, and all the other options as listed in the options table above.</p><p>You can find an example of this in the&#160;<a shape="rect" class="external-link" href="https://github.com/apache/camel/tree/master/examples/camel-example-zipkin" rel="nofollow">camel-example-zipkin</a></p></div>
+zipkin.setSpanCollector(new ScribeSpanCollector(&quot;192.168.90.100&quot;, 9410);
+// and then add zipkin to the CamelContext
+zipkin.init(camelContext);]]></script>
+</div></div><p>The configuration about will the trace all incoming and outgoing messages in Camel routes.&#160;</p><p>To use ZipinTracer in XML all you need to do is to setup scribe an the zipkin tracer as &lt;bean&gt; and then they are automatic discovered and used by Camel.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[  &lt;!-- configure the scribe span collector with the hostname and port for the Zipkin Collector Server --&gt;
+  &lt;bean id=&quot;scribe&quot; class=&quot;com.github.kristofa.brave.scribe.ScribeSpanCollector&quot;&gt;
+    &lt;constructor-arg index=&quot;0&quot; value=&quot;192.168.90.100&quot;/&gt;
+    &lt;constructor-arg index=&quot;1&quot; value=&quot;9410&quot;/&gt;
+  &lt;/bean&gt;
+
+  &lt;!-- setup zipkin tracer --&gt;
+  &lt;bean id=&quot;zipkinTracer&quot; class=&quot;org.apache.camel.zipkin.ZipkinTracer&quot;&gt;
+    &lt;property name=&quot;serviceName&quot; value=&quot;dude&quot;/&gt;
+    &lt;property name=&quot;spanCollector&quot; ref=&quot;scribe&quot;/&gt;
+  &lt;/bean&gt;]]></script>
+</div></div><h4 id="camel-zipkin-ServiceName">ServiceName</h4><p>However if you want to map Camel endpoints to human friendly logical names, you can add mappings</p><ul><li>ServiceName<br clear="none"><br clear="none"></li></ul><p>You can configure a global service name that all events will fallback and use, such as:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[zipkin.setServiceName(&quot;invoices&quot;);]]></script>
+</div></div><p>This will use the same service name for all incoming and outgoing zipkin traces. So if your application uses different services, you need to map them more fine grained into client vs server mappings</p><h4 id="camel-zipkin-ClientandServerServiceMappings">Client and Server Service Mappings</h4><ul><li>ClientServiceMappings</li><li>ServerServiceMappings</li></ul><p>So if your application hosts a service that others can call, you can map the Camel route endpoint to a server service mapping. For example support your Camel application has the following route</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[from(&quot;activemq:queue:inbox&quot;)
+  ...
+  .to(&quot;http:someserver/somepath&quot;);]]></script>
+</div></div><p>And you want to make that as a server service, you can add the following mapping</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[zipkin.addServerServiceMapping(&quot;activemq:queue:inbox&quot;, &quot;orders&quot;);]]></script>
+</div></div><p>Then when a message is consumed from that inbox queue, it becomes a zipkin server event with the service name orders.</p><p>Now suppose that the call to http:someserver/somepath is also a service, which you want to map to a client service name, which can be done as:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[zipkin.addClientServiceMapping(&quot;http:someserver/somepath&quot;, &quot;audit&quot;);]]></script>
+</div></div><p>Then in the same Camel application you have mapped incoming and outgoing endpoints to different zipkin service names.</p><div class="confluence-information-macro confluence-information-macro-tip"><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>You can use wildcards in the service mapping, so to match all outgoing calls the same HTTP server you can do</p><pre>zipkin.addClientServiceMapping("http:someserver*", "audit");</pre></div></div><h4 id="camel-zipkin-Mappingrules">Mapping rules</h4><p>The service name mapping for server occurs using the following rules</p><ol><li>Is there an exclude pattern that matches the endpoint uri of the from endpoint? If yes then skip.</li><li>Is there a match in the serviceServiceMapping that matches the endpoint uri of the from endpoint? If yes the use the found service name</li><li>Is there a match in the serviceServiceMapping that matc
 hes the route id of the current route? If yes the use the found service name</li><li>Is there a match in the serviceServiceMapping that matches the original route id where the exchange started? If yes the use the found service name</li><li>No service name was found, the exchange is not traced by zipkin</li></ol><p>The service name mapping for client occurs using the following rules</p><ol><li>Is there an exclude pattern that matches the endpoint uri of the from endpoint? If yes then skip.</li><li>Is there a match in the clientServiceMapping that matches the endpoint uri of endpoint where the message is being sent to? If yes the use the found service name</li><li>Is there a match in the clientServiceMapping that matches the route id of the current route? If yes the use the found service name</li><li>Is there a match in the clientServiceMapping that matches the original route id where the exchange started? If yes the use the found service name</li><li>No service name was found, the ex
 change is not traced by zipkin</li></ol><h4 id="camel-zipkin-Noclientorservermappings">No client or server mappings</h4><p>If there has been no configuration of client or server service mappings, then CamelZipkin runs in a fallback mode, where it uses the endpoint uris as the service name.</p><p>So in the example above that would mean the service names would be, as if you add the following code yourself:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[zipkin.addServerServiceMapping(&quot;activemq:queue:inbox&quot;, &quot;activemq:queue:inbox&quot;);
+zipkin.addClientServiceMapping(&quot;http:someserver/somepath&quot;, &quot;http:someserver/somepath&quot;);]]></script>
+</div></div><p>This is not a recommended approach but gets you up and running quickly without doing any service name mappings. However when you have multiple systems across your infrastructure, then you should consider using human logic service names, that you map to instead of using the camel endpoint uris.</p><h3 id="camel-zipkin-camel-zipin-starter">camel-zipin-starter</h3><p>If you are using&#160;<a shape="rect" href="spring-boot.html">Spring Boot</a> then you can add the&#160;<code>camel-zipkin-starter</code> dependency, and turn on zipkin by annotating the main class with <code>@CamelZipkin</code>. You can then configure camel-zipkin in the&#160;<code>application.properties</code> file where you can configure the hostname and port number for the Zipkin Server, and all the other options as listed in the options table above.</p><p>You can find an example of this in the&#160;<a shape="rect" class="external-link" href="https://github.com/apache/camel/tree/master/examples/camel-exa
 mple-zipkin" rel="nofollow">camel-example-zipkin</a></p></div>
         </td>
         <td valign="top">
           <div class="navigation">