You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bu...@apache.org on 2017/02/07 02:47:34 UTC

svn commit: r1006330 - in /websites/production/cxf/content: cache/ docs/ docs/using-openzipkin-brave.data/

Author: buildbot
Date: Tue Feb  7 02:47:33 2017
New Revision: 1006330

Log:
Production update by buildbot for cxf

Added:
    websites/production/cxf/content/docs/using-openzipkin-brave.data/image2017-2-6-20:49:43.png   (with props)
    websites/production/cxf/content/docs/using-openzipkin-brave.data/image2017-2-6-20:53:6.png   (with props)
    websites/production/cxf/content/docs/using-openzipkin-brave.data/image2017-2-6-20:56:27.png   (with props)
    websites/production/cxf/content/docs/using-openzipkin-brave.data/image2017-2-6-21:41:1.png   (with props)
    websites/production/cxf/content/docs/using-openzipkin-brave.data/image2017-2-6-21:46:48.png   (with props)
    websites/production/cxf/content/docs/using-openzipkin-brave.data/image2017-2-6-21:6:56.png   (with props)
Modified:
    websites/production/cxf/content/cache/docs.pageCache
    websites/production/cxf/content/docs/using-openzipkin-brave.html

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

Added: websites/production/cxf/content/docs/using-openzipkin-brave.data/image2017-2-6-20:49:43.png
==============================================================================
Binary file - no diff available.

Propchange: websites/production/cxf/content/docs/using-openzipkin-brave.data/image2017-2-6-20:49:43.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: websites/production/cxf/content/docs/using-openzipkin-brave.data/image2017-2-6-20:53:6.png
==============================================================================
Binary file - no diff available.

Propchange: websites/production/cxf/content/docs/using-openzipkin-brave.data/image2017-2-6-20:53:6.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: websites/production/cxf/content/docs/using-openzipkin-brave.data/image2017-2-6-20:56:27.png
==============================================================================
Binary file - no diff available.

Propchange: websites/production/cxf/content/docs/using-openzipkin-brave.data/image2017-2-6-20:56:27.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: websites/production/cxf/content/docs/using-openzipkin-brave.data/image2017-2-6-21:41:1.png
==============================================================================
Binary file - no diff available.

Propchange: websites/production/cxf/content/docs/using-openzipkin-brave.data/image2017-2-6-21:41:1.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: websites/production/cxf/content/docs/using-openzipkin-brave.data/image2017-2-6-21:46:48.png
==============================================================================
Binary file - no diff available.

Propchange: websites/production/cxf/content/docs/using-openzipkin-brave.data/image2017-2-6-21:46:48.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: websites/production/cxf/content/docs/using-openzipkin-brave.data/image2017-2-6-21:6:56.png
==============================================================================
Binary file - no diff available.

Propchange: websites/production/cxf/content/docs/using-openzipkin-brave.data/image2017-2-6-21:6:56.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Modified: websites/production/cxf/content/docs/using-openzipkin-brave.html
==============================================================================
--- websites/production/cxf/content/docs/using-openzipkin-brave.html (original)
+++ websites/production/cxf/content/docs/using-openzipkin-brave.html Tue Feb  7 02:47:33 2017
@@ -117,11 +117,11 @@ Apache CXF -- Using OpenZipkin Brave
            <!-- Content -->
            <div class="wiki-content">
 <div id="ConfluenceContent"><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1486432026034 {padding: 0px;}
-div.rbtoc1486432026034 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1486432026034 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1486435616882 {padding: 0px;}
+div.rbtoc1486435616882 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1486435616882 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1486432026034">
+/*]]>*/</style></p><div class="toc-macro rbtoc1486435616882">
 <ul class="toc-indentation"><li><a shape="rect" href="#UsingOpenZipkinBrave-Overview">Overview</a></li><li><a shape="rect" href="#UsingOpenZipkinBrave-DistributedTracinginApacheCXFusingOpenZipkinBrave">Distributed Tracing in Apache CXF using OpenZipkin Brave</a></li><li><a shape="rect" href="#UsingOpenZipkinBrave-configuringclientConfiguringClient">Configuring Client</a></li><li><a shape="rect" href="#UsingOpenZipkinBrave-configuringserverConfiguringServer">Configuring Server</a></li><li><a shape="rect" href="#UsingOpenZipkinBrave-DistributedTracingInAction:UsageScenarios">Distributed Tracing In Action: Usage Scenarios</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#UsingOpenZipkinBrave-Example#1:ClientandServerwithdefaultdistributedtracingconfigured">Example #1: Client and Server with default distributed tracing configured</a></li><li><a shape="rect" href="#UsingOpenZipkinBrave-Example#2:ClientandServerwithnestedtrace">Example #2: Client and Server with nested trace</a></li><li><a shape="rect" href="#UsingOpenZipkinBrave-Example#3:ClientandServertracewithannotations">Example #3: Client and Server trace with annotations</a></li><li><a shape="rect" href="#UsingOpenZipkinBrave-Example#4:ClientandServerwithbinaryannotations(key/value)">Example #4: Client and Server with binary annotations (key/value)</a></li><li><a shape="rect" href="#UsingOpenZipkinBrave-Example#5:ClientandServerwithparalleltrace(involvingthreadpools)">Example #5: Client and Server with parallel trace (involving thread pools)</a></li><li><a shape="rect" href="#UsingOpenZipkinBrave-Example#6:ClientandServerwithasynchronousJAX-
 RSservice(server-side)">Example #6: Client and Server with asynchronous JAX-RS service (server-side)</a></li><li><a shape="rect" href="#UsingOpenZipkinBrave-Example#7:ClientandServerwithasynchronousinvocation(client-side)">Example #7: Client and Server with asynchronous invocation (client-side)</a></li></ul>
 </li><li><a shape="rect" href="#UsingOpenZipkinBrave-DistributedTracingwithOpenZipkinBraveandJAX-WSsupport">Distributed Tracing with OpenZipkin Brave and JAX-WS support</a></li><li><a shape="rect" href="#UsingOpenZipkinBrave-Migratingfrombrave-cxf3">Migrating from brave-cxf3</a></li></ul>
@@ -230,7 +230,7 @@ public Collection&lt;Book&gt; getBooks()
     .request()
     .accept(MediaType.APPLICATION_JSON)
     .get();</pre>
-</div></div><p>The actual invocation of the request by the client (with process name <strong>tracer-client</strong>) and consequent invocation of the service on the server side (process name<strong> tracer-server</strong>) is going to generate the following sample traces:</p><p><span class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img class="confluence-embedded-image" height="150" src="using-openzipkin-brave.data/image2017-2-6%2020:16:19.png"></span></p><p>&#160;</p><p>Please notice that client and server traces are collapsed under one trace with client send / receive, and server send / receive demarcation as is seen in details<span class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img class="confluence-embedded-image" height="400" src="using-openzipkin-brave.data/image2017-2-6%2020:18:51.png"></span></p><h2 id="UsingOpenZipkinBrave-Example#2:ClientandServerwithnestedtrace">Example #2: Client and Server with nested trace</h2><p>In th
 is example server-side implementation of the JAX-RS service is going to call an external system (simulated as a simple delay of 500ms) within its own span. The client-side code stays unchanged.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>The actual invocation of the request by the client (with service name <strong>tracer-client</strong>) and consequent invocation of the service on the server side (service name<strong> tracer-server</strong>) is going to generate the following sample traces:</p><p><span class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img class="confluence-embedded-image" height="150" src="using-openzipkin-brave.data/image2017-2-6%2020:16:19.png"></span></p><p>&#160;</p><p>Please notice that client and server traces are collapsed under one trace with client send / receive, and server send / receive demarcation as is seen in details<span class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img class="confluence-embedded-image" height="400" src="using-openzipkin-brave.data/image2017-2-6%2020:18:51.png"></span></p><h2 id="UsingOpenZipkinBrave-Example#2:ClientandServerwithnestedtrace">Example #2: Client and Server with nested trace</h2><p>In th
 is example server-side implementation of the JAX-RS service is going to call an external system (simulated as a simple delay of 500ms) within its own span. The client-side code stays unchanged.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
 @GET
 public Collection&lt;Book&gt; getBooks(@Context final TracerContext tracer) throws Exception {
@@ -243,7 +243,108 @@ public Collection&lt;Book&gt; getBooks(@
         );
     }
 }</pre>
-</div></div><p class="label label-default service-filter-label">The actual invocation of the request by the client (with process name <strong><span class="label label-default service-filter-label service-tag-filtered"><strong>tracer</strong>-client</span></strong>) and consequent invocation of the service on the server side (process name<strong><span class="label label-default service-filter-label"><strong>tracer-</strong>server</span></strong><span class="label label-default service-filter-label">)</span> is going to generate the following sample traces:</p><p class="label label-default service-filter-label"><span class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img class="confluence-embedded-image" width="900" src="using-openzipkin-brave.data/image2017-2-6%2020:21:46.png"></span></p><h2 id="UsingOpenZipkinBrave-Example#3:ClientandServertracewithannotations">Example #3: Client and Server trace with annotations</h2><h2 id="UsingOpenZipkinBrave-Example#4:Clie
 ntandServerwithbinaryannotations(key/value)">Example #4: Client and Server with binary annotations (key/value)</h2><h2 id="UsingOpenZipkinBrave-Example#5:ClientandServerwithparalleltrace(involvingthreadpools)">Example #5: Client and Server with parallel trace (involving thread pools)</h2><h2 id="UsingOpenZipkinBrave-Example#6:ClientandServerwithasynchronousJAX-RSservice(server-side)">Example #6: Client and Server with asynchronous JAX-RS service (server-side)</h2><h2 id="UsingOpenZipkinBrave-Example#7:ClientandServerwithasynchronousinvocation(client-side)">Example #7: Client and Server with asynchronous invocation (client-side)</h2><h1 id="UsingOpenZipkinBrave-DistributedTracingwithOpenZipkinBraveandJAX-WSsupport">Distributed Tracing with OpenZipkin Brave and JAX-WS support</h1><p>// TODO</p><h1 id="UsingOpenZipkinBrave-Migratingfrombrave-cxf3">Migrating from brave-cxf3</h1><p>// TODO</p></div>
+</div></div><p class="label label-default service-filter-label">The actual invocation of the request by the client (with service name <strong><span class="label label-default service-filter-label service-tag-filtered"><strong>tracer</strong>-client</span></strong>) and consequent invocation of the service on the server side (service name<strong><span class="label label-default service-filter-label"><strong> tracer-</strong>server</span></strong><span class="label label-default service-filter-label">)</span> is going to generate the following sample traces:</p><p class="label label-default service-filter-label"><span class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img class="confluence-embedded-image" width="900" src="using-openzipkin-brave.data/image2017-2-6%2020:21:46.png"></span></p><h2 id="UsingOpenZipkinBrave-Example#3:ClientandServertracewithannotations">Example #3: Client and Server trace with annotations</h2><p>In this example server-side implementat
 ion of the JAX-RS service is going to add timeline to the active span. The client-side code stays unchanged.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
+@GET
+public Collection&lt;Book&gt; getBooks(@Context final TracerContext tracer) throws Exception {
+    tracer.timeline("Preparing Books");
+    // Simulating some work using a delay of 100ms
+    Thread.sleep(100);
+        
+    return Arrays.asList(
+        new Book("Apache CXF Web Service Development", "Naveen Balani, Rajeev Hathi")
+    );
+}</pre>
+</div></div><p class="label label-default service-filter-label">The actual invocation of the request by the client (with service name <strong><span class="label label-default service-filter-label service-tag-filtered">tracer-client</span></strong>) and consequent invocation of the service on the server side (service name<strong> <span class="label label-default service-filter-label">traceser-server</span></strong>) is going to generate the following sample traces:</p><p><span class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img class="confluence-embedded-image" width="900" src="using-openzipkin-brave.data/image2017-2-6%2020:56:27.png"></span></p><h2 id="UsingOpenZipkinBrave-Example#4:ClientandServerwithbinaryannotations(key/value)">Example #4: Client and Server with binary annotations (key/value)</h2><p>In this example server-side implementation of the JAX-RS service is going to add key/value annotations to the active span. The client-side code stays unchang
 ed.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
+@GET
+public Collection&lt;Book&gt; getBooks(@Context final TracerContext tracer) throws Exception {
+    final Collection&lt;Book&gt; books = Arrays.asList(
+        new Book("Apache CXF Web Service Development", "Naveen Balani, Rajeev Hathi")
+    );
+        
+    tracer.annotate("# of books", Integer.toString(books.size()));
+    return books;
+}</pre>
+</div></div><p class="label label-default service-filter-label service-tag-filtered">The actual invocation of the request by the client (with service name <strong><span class="label label-default service-filter-label service-tag-filtered"><strong><span class="label label-default service-filter-label service-tag-filtered"><strong>tracer</strong></span></strong>-client</span></strong>) and consequent invocation of the service on the server side (service name<strong> tracer-<span class="label label-default service-filter-label">server</span></strong>) is going to generate the following sample server trace properties:</p><p class="label label-default service-filter-label service-tag-filtered"><span class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img class="confluence-embedded-image" height="250" src="using-openzipkin-brave.data/image2017-2-6%2020:49:43.png"></span></p><h2 id="UsingOpenZipkinBrave-Example#5:ClientandServerwithparalleltrace(involvingthreadpools)"
 >Example #5: Client and Server with parallel trace (involving thread pools)</h2><p>In this example server-side implementation of the JAX-RS service is going to offload some work into thread pool and then return the response to the client, simulating parallel execution.For this example to work, the Brave on server side should be con figured a little bit differently:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">final Endpoint endpoint =  Endpoint.create("tracer-server",
+    ByteBuffer.wrap(Inet4Address.getLocalHost().getAddress()).getInt());
+        
+final Brave brave = new Brave.Builder(new InheritableServerClientAndLocalSpanState(endpoint))
+    .reporter(AsyncReporter.builder(sender).build())
+    .traceSampler(Sampler.ALWAYS_SAMPLE)
+    .build();</pre>
+</div></div><p>The client-side code stays unchanged.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
+@GET
+public Collection&lt;Book&gt; getBooks(@Context final TracerContext tracer) throws Exception {
+    final Future&lt;Book&gt; book1 = executor.submit(
+        tracer.wrap("Getting Book 1", new Traceable&lt;Book&gt;() {
+            public Book call(final TracerContext context) throws Exception {
+                // Simulating a delay of 100ms required to call external system
+                Thread.sleep(100);
+                    
+                return new Book("Apache CXF Web Service Development", 
+                    "Naveen Balani, Rajeev Hathi");
+            }
+        })
+    );
+        
+    final Future&lt;Book&gt; book2 = executor.submit(
+        tracer.wrap("Getting Book 2", new Traceable&lt;Book&gt;() {
+            public Book call(final TracerContext context) throws Exception {
+                // Simulating a delay of 100ms required to call external system
+                Thread.sleep(200);
+                    
+                return new Book("Developing Web Services with Apache CXF and Axis2", 
+                    "Kent Ka Iok Tong");
+            }
+        })
+    );
+       
+    return Arrays.asList(book1.get(), book2.get());
+}</pre>
+</div></div><p>The actual invocation of the request by the client (with service name <strong>tracer-<span class="label label-default service-filter-label service-tag-filtered">client</span></strong>) and consequent invocation of the service on the server side (process name<strong> tracer-<span class="label label-default service-filter-label">server</span></strong>) is going to generate the following sample traces:</p><p><span class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img class="confluence-embedded-image" width="900" src="using-openzipkin-brave.data/image2017-2-6%2021:41:1.png"></span></p><h2 id="UsingOpenZipkinBrave-Example#6:ClientandServerwithasynchronousJAX-RSservice(server-side)">Example #6: Client and Server with asynchronous JAX-RS service (server-side)</h2><p>In this example server-side implementation of the JAX-RS service is going to be executed asynchronously. It poses a challenge from the tracing prospective as request and response are proce
 ssed in different threads (in general). At the moment, <a shape="rect" href="http://cxf.apache.org/">Apache CXF</a> does not support the transparent tracing spans management (except for default use case) but provides the simple ways to do that (by letting to transfer spans from thread to thread). The client-side code stays unchanged.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
+@GET
+public void getBooks(@Suspended final AsyncResponse response, @Context final TracerContext tracer) throws Exception {
+    tracer.continueSpan(new Traceable&lt;Future&lt;Void&gt;&gt;() {
+        public Future&lt;Void&gt; call(final TracerContext context) throws Exception {
+            return executor.submit(
+                tracer.wrap("Getting Book", new Traceable&lt;Void&gt;() {
+                    public Void call(final TracerContext context) throws Exception {
+                        // Simulating a processing delay of 50ms
+                        Thread.sleep(50);
+                            
+                        response.resume(
+                            Arrays.asList(
+                                new Book("Apache CXF Web Service Development", "Naveen Balani, Rajeev Hathi")
+                            )
+                        );
+                            
+                        return null;
+                    }
+                })
+            );
+        }
+    });
+}</pre>
+</div></div><p class="label label-default service-filter-label service-tag-filtered">The actual invocation of the request by the client (with service name <strong>tracer-<span class="label label-default service-filter-label service-tag-filtered">client</span></strong>) and consequent invocation of the service on the server side (service name<strong> tracer-<span class="label label-default service-filter-label">server</span></strong>) is going to generate the following sample traces:</p><h2 id="UsingOpenZipkinBrave-Example#7:ClientandServerwithasynchronousinvocation(client-side)">Example #7: Client and Server with asynchronous invocation (client-side)</h2><p>In this example server-side implementation of the JAX-RS service is going to be the default one:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">@Produces( { MediaType.APPLICATION_JSON } )
+@GET
+public Collection&lt;Book&gt; getBooks() {
+    return Arrays.asList(
+        new Book("Apache CXF Web Service Development", "Naveen Balani, Rajeev Hathi")
+    );
+}</pre>
+</div></div><p>While the JAX-RS client&#160;implementation is going to perform the asynchronous invocation:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">final Future&lt;Response&gt; future = client
+    .target("http://localhost:8282/books")
+    .request()
+    .accept(MediaType.APPLICATION_JSON)
+    .async()
+    .get();</pre>
+</div></div><p>In this respect, there is no difference from the caller prospective however a bit more work is going under the hood to transfer the active tracing span from JAX-RS client request filter to client response filter as in general those are executed in different threads (similarly to server-side asynchronous JAX-RS resource invocation). The actual invocation of the request by the client (with service name <strong>tracer-<span class="label label-default service-filter-label service-tag-filtered">client</span></strong>) and consequent invocation of the service on the server side (service name<strong> tracer-<span class="label label-default service-filter-label">server</span></strong>) is going to generate the following sample traces:</p><p><span class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img class="confluence-embedded-image" width="900" src="using-openzipkin-brave.data/image2017-2-6%2021:6:56.png"></span></p><h1 id="UsingOpenZipkinBrave-Distrib
 utedTracingwithOpenZipkinBraveandJAX-WSsupport">Distributed Tracing with OpenZipkin Brave and JAX-WS support</h1><p>// TODO</p><h1 id="UsingOpenZipkinBrave-Migratingfrombrave-cxf3">Migrating from brave-cxf3</h1><p>// TODO</p></div>
            </div>
            <!-- Content -->
          </td>