Modified: websites/production/cxf/content/docs/using-opentracing.html
==============================================================================
--- websites/production/cxf/content/docs/using-opentracing.html (original)
+++ websites/production/cxf/content/docs/using-opentracing.html Tue May 9
17:47:03 2023
@@ -59,7 +59,7 @@ Apache CXF -- Using OpenTracing
<td id="cell-1-1"> </td>
<td id="cell-1-2">
<!-- Banner -->
-<div class="banner" id="banner"><div class="table-wrap"><table
class="confluenceTable" style="width: 100.0%;" border="0" cellpadding="0"
cellspacing="0"><colgroup span="1"><col span="1"><col
span="1"></colgroup><tbody><tr><td align="left" colspan="1" rowspan="1"
class="confluenceTd" style="border: none;"><a shape="rect"
href="http://cxf.apache.org/" title="Apache CXF"> <span style="color:
white;font-size: 170.0%;font-weight: bold;">Apache CXF</span> </a></td><td
align="right" colspan="1" rowspan="1" class="confluenceTd" style="border:
none;"><a shape="rect" class="external-link" href="http://www.apache.org/"
title="The Apache Software Foundation"> <span
class="confluence-embedded-file-wrapper image-right-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image
confluence-external-resource image-right" alt="The Apache Software Foundation"
width="214" src="https://apache.org/img/asf_logo.png"
data-image-src="https://apache.org/img/asf_logo.png"></span> </a></td><
/tr></tbody></table></div></div>
+<div class="banner" id="banner"><div class="table-wrap"><table
class="confluenceTable" style="width: 100.0%;" border="0" cellpadding="0"
cellspacing="0"><colgroup span="1"><col span="1"><col
span="1"></colgroup><tbody><tr><td align="left" colspan="1" rowspan="1"
class="confluenceTd" style="border: none;"><a shape="rect"
href="http://cxf.apache.org/" title="Apache CXF"> <span style="color:
white;font-size: 170.0%;font-weight: bold;">Apache CXF</span> </a></td><td
align="right" colspan="1" rowspan="1" class="confluenceTd" style="border:
none;"><a shape="rect" class="external-link" href="http://www.apache.org/"
title="The Apache Software Foundation"> <span
class="confluence-embedded-file-wrapper image-right-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image
confluence-external-resource image-right" draggable="false" alt="The Apache
Software Foundation" width="214" src="https://apache.org/img/asf_logo.png"
data-image-src="https://apache.org/img/asf_logo.png">
</span> </a></td></tr></tbody></table></div></div>
<!-- Banner -->
<div id="top-menu">
<table border="0" cellpadding="1" cellspacing="0" width="100%">
@@ -99,7 +99,7 @@ Apache CXF -- Using OpenTracing
<div id="navigation"><ul class="alternate"><li><a shape="rect"
href="overview.html">Overview</a></li><li><a shape="rect"
href="how-tos.html">How-Tos</a></li><li><a shape="rect"
href="frontends.html">Frontends</a></li><li><a shape="rect"
href="databindings.html">DataBindings</a></li><li><a shape="rect"
href="transports.html">Transports</a></li><li><a shape="rect"
href="configuration.html">Configuration</a></li><li><a shape="rect"
href="debugging-and-logging.html">Debugging and Logging</a></li><li><a
shape="rect" href="tools.html">Tools</a></li><li><a shape="rect"
href="restful-services.html">RESTful Services</a></li><li><a shape="rect"
href="wsdl-bindings.html">WSDL Bindings</a></li><li><a shape="rect"
href="service-routing.html">Service Routing</a></li><li><a shape="rect"
href="dynamic-languages.html">Dynamic Languages</a></li><li><a shape="rect"
href="ws-support.html">WS-* Support</a></li><li><a shape="rect"
href="advanced-integration.html">Advanced Integration</a></li><li><a shape
="rect" href="deployment.html">Deployment</a></li><li><a shape="rect"
href="schemas-and-namespaces.html">Use of Schemas and
Namespaces</a></li></ul><hr><ul
class="alternate"><li><p>Search</p></li></ul><iframe frameborder="1"
scrolling="auto" id="searchId"
src="https://cxf.apache.org/resources/search.htm" name="SearchIFrame"
width="200px" style="border:none;" title="Search" height="60px"><p><br
clear="none"></p></iframe>
-<hr><ul class="alternate"><li><a shape="rect"
href="http://cxf.apache.org/javadoc/latest-3.5.x/">API 3.5.x
(Javadoc)</a></li><li><a shape="rect"
href="http://cxf.apache.org/javadoc/latest-3.2.x/">API 3.2.x
(Javadoc)</a></li><li><a shape="rect"
href="http://cxf.apache.org/javadoc/latest-3.1.x/">API 3.1.x
(Javadoc)</a></li><li><a shape="rect" href="http://cxf.apache.org/">CXF
Website</a></li></ul><p><br clear="none"></p><p><a shape="rect"
class="external-link" href="https://www.apache.org/events/current-event.html">
<span class="confluence-embedded-file-wrapper"><img
class="confluence-embedded-image confluence-external-resource"
src="https://www.apache.org/events/current-event-125x125.png"
data-image-src="https://www.apache.org/events/current-event-125x125.png"></span>
</a></p></div>
+<hr><ul class="alternate"><li><a shape="rect"
href="http://cxf.apache.org/javadoc/latest-4.0.x/">API 4.0.x
(Javadoc)</a></li><li><a shape="rect"
href="http://cxf.apache.org/javadoc/latest-3.6.x/">API 3.6.x
(Javadoc)</a></li><li><a shape="rect"
href="http://cxf.apache.org/javadoc/latest-3.5.x/">API 3.5.x
(Javadoc)</a></li><li><a shape="rect" href="http://cxf.apache.org/">CXF
Website</a></li></ul><p><br clear="none"></p><p><a shape="rect"
class="external-link" href="https://www.apache.org/events/current-event.html">
<span class="confluence-embedded-file-wrapper"><img
class="confluence-embedded-image confluence-external-resource"
draggable="false" src="https://www.apache.org/events/current-event-125x125.png"
data-image-src="https://www.apache.org/events/current-event-125x125.png"></span>
</a></p></div>
<!-- NavigationBar -->
</div>
</div>
@@ -110,11 +110,11 @@ Apache CXF -- Using OpenTracing
<!-- Content -->
<div class="wiki-content">
<div id="ConfluenceContent"><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1651074267310 {padding: 0px;}
-div.rbtoc1651074267310 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1651074267310 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1683654272475 {padding: 0px;}
+div.rbtoc1683654272475 ul {margin-left: 0px;}
+div.rbtoc1683654272475 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1651074267310">
+/*]]>*/</style></p><div class="toc-macro rbtoc1683654272475">
<ul class="toc-indentation"><li><a shape="rect"
href="#UsingOpenTracing-Overview">Overview</a></li><li><a shape="rect"
href="#UsingOpenTracing-DistributedTracinginApacheCXFusingOpenTracing">Distributed
Tracing in Apache CXF using OpenTracing</a></li><li><a shape="rect"
href="#UsingOpenTracing-ANoteonOpenTracingAPIs">A Note on OpenTracing
APIs</a></li><li><a shape="rect"
href="#UsingOpenTracing-OpenTracingAPIv0.30.0andApacheCXF3.2.x">OpenTracing API
v0.30.0 and Apache CXF 3.2.x</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#UsingOpenTracing-ConfiguringClient">Configuring Client</a></li><li><a
shape="rect" href="#UsingOpenTracing-ConfiguringServer">Configuring
Server</a></li><li><a shape="rect"
href="#UsingOpenTracing-DistributedTracingInAction:UsageScenarios">Distributed
Tracing In Action: Usage Scenarios</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#UsingOpenTracing-Example#1:ClientandServerwithdefaultdistributedtracingconfigured">Example
#1: Client and Server with default distributed tracing
configured</a></li><li><a shape="rect"
href="#UsingOpenTracing-Example#2:ClientandServerwithnestedtrace">Example #2:
Client and Server with nested trace</a></li><li><a shape="rect"
href="#UsingOpenTracing-Example#3:ClientandServertracewithtimeline">Example #3:
Client and Server trace with timeline</a></li><li><a shape="rect"
href="#UsingOpenTracing-Example#4:ClientandServerwithbinaryannotations(key/value)">Example
#4: Client and Server with binary annotations (key/value)</a></li><li><a
shape="rect"
href="#UsingOpenTracing-Example#5:ClientandServerwithparalleltrace(involvingthreadpools)">Example
#5: Client and Server with parallel trace (involving thread
pools)</a></li><li><a shape="rect"
href="#UsingOpenTracing-Example#6:ClientandServerwithasynchronousJAX-RSservice(server-side)">Exampl
e #6: Client and Server with asynchronous JAX-RS service
(server-side)</a></li><li><a shape="rect"
href="#UsingOpenTracing-Example#7:ClientandServerwithasynchronousinvocation(client-side)">Example
#7: Client and Server with asynchronous invocation (client-side)</a></li></ul>
@@ -214,7 +214,7 @@ public Collection<Book> getBooks()
.request()
.accept(MediaType.APPLICATION_JSON)
.get();</pre>
-</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 (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" height="250"
src="using-opentracing.data/image2017-9-10%2012:41:7.png"></span></p><p>The
same trace will be looking pretty similar using traditional <a shape="rect"
class="external-link"
href="https://github.com/openzipkin/zipkin/tree/master/zipkin-ui"
rel="nofollow">Zipkin UI</a> frontend:</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" height="250"
src="using-opentracing.data/image2017-9-10%2013:18
:20.png"></span></p><h3
id="UsingOpenTracing-Example#2:ClientandServerwithnestedtrace">Example #2:
Client and Server with nested trace</h3><p>In this 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 (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" draggable="false" height="250"
src="using-opentracing.data/image2017-9-10%2012:41:7.png"></span></p><p>The
same trace will be looking pretty similar using traditional <a shape="rect"
class="external-link"
href="https://github.com/openzipkin/zipkin/tree/master/zipkin-ui"
rel="nofollow">Zipkin UI</a> frontend:</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" draggable="false" height="250" src="using-ope
ntracing.data/image2017-9-10%2013:18:20.png"></span></p><h3
id="UsingOpenTracing-Example#2:ClientandServerwithnestedtrace">Example #2:
Client and Server with nested trace</h3><p>In this 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">@Produces( {
MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks(@Context final TracerContext tracer)
throws Exception {
@@ -227,7 +227,7 @@ public Collection<Book> getBooks(@
);
}
}</pre>
-</div></div><p>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
(taken from <a shape="rect" class="external-link"
href="https://github.com/uber/jaeger-ui" rel="nofollow">Jaeger
UI</a>):</p><p><span class="confluence-embedded-file-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image"
height="250"
src="using-opentracing.data/image2017-9-10%2014:9:7.png"></span></p><p>The same
trace will be looking pretty similar using traditional <a shape="rect"
class="external-link" href="https://github.com/openzipkin/zipkin/tree/mast
er/zipkin-ui" rel="nofollow">Zipkin UI</a> frontend:</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" height="250"
src="using-opentracing.data/image2017-9-10%2014:10:40.png"></span></p><h3
id="UsingOpenTracing-Example#3:ClientandServertracewithtimeline">Example #3:
Client and Server trace with timeline</h3><p>In this example server-side
implementation 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">
+</div></div><p>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
(taken from <a shape="rect" class="external-link"
href="https://github.com/uber/jaeger-ui" rel="nofollow">Jaeger
UI</a>):</p><p><span class="confluence-embedded-file-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image"
draggable="false" height="250"
src="using-opentracing.data/image2017-9-10%2014:9:7.png"></span></p><p>The same
trace will be looking pretty similar using traditional <a shape="rect"
class="external-link" href="https://github.com/openzipki
n/zipkin/tree/master/zipkin-ui" rel="nofollow">Zipkin UI</a>
frontend:</p><p><span class="confluence-embedded-file-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image"
draggable="false" height="250"
src="using-opentracing.data/image2017-9-10%2014:10:40.png"></span></p><h3
id="UsingOpenTracing-Example#3:ClientandServertracewithtimeline">Example #3:
Client and Server trace with timeline</h3><p>In this example server-side
implementation 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">@Produces( {
MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks(@Context final TracerContext tracer)
throws Exception {
@@ -239,7 +239,7 @@ public Collection<Book> getBooks(@
new Book("Apache CXF Web Service Development", "Naveen Balani, Rajeev
Hathi")
);
}</pre>
-</div></div><p>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 (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" height="400"
src="using-opentracing.data/image2017-9-10%2014:26:23.png"></span></p><p> </p><div
class="confluence-information-macro
confluence-information-macro-information"><span class="aui-icon aui-icon-small
aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>Please
notice that timelines are treated as<strong> logs events</strong> in <a
shape="rect" class="external-link" href="https://uber.github.io/jaeger/"
rel="nofollow">Jaeger</a>.</p></div></div><p>The same trace will be looking
pretty similar using traditional <a shape="rect" class="external-link"
href="https://github.com/openzipkin/zipkin/tree/master/zipkin-ui"
rel="nofollow">Zipkin UI</a> frontend:</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" height="250"
src="using-opentracing.data/image2017-9-10%2014:19:1.png"></span></p><h3
id="UsingOpenTracing-Example#4:ClientandServerwithbinaryannotations(key/value)">Example
#4: Client and Server with binary annotations (key/value)</h3><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
unchanged.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeC
ontent panelContent pdl">
+</div></div><p>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 (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" draggable="false" height="400"
src="using-opentracing.data/image2017-9-10%2014:26:23.png"></span></p><p> </p><div
class="confluence-information-macro
confluence-information-macro-information"><span class="aui-icon aui-icon-small
aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-mac
ro-body"><p>Please notice that timelines are treated as<strong> logs
events</strong> in <a shape="rect" class="external-link"
href="https://uber.github.io/jaeger/"
rel="nofollow">Jaeger</a>.</p></div></div><p>The same trace will be looking
pretty similar using traditional <a shape="rect" class="external-link"
href="https://github.com/openzipkin/zipkin/tree/master/zipkin-ui"
rel="nofollow">Zipkin UI</a> frontend:</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" draggable="false" height="250"
src="using-opentracing.data/image2017-9-10%2014:19:1.png"></span></p><h3
id="UsingOpenTracing-Example#4:ClientandServerwithbinaryannotations(key/value)">Example
#4: Client and Server with binary annotations (key/value)</h3><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
unchanged.</p><div class="code panel pdl" style="b
order-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">@Produces( {
MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks(@Context final TracerContext tracer)
throws Exception {
@@ -250,7 +250,7 @@ public Collection<Book> getBooks(@
tracer.annotate("# of books", Integer.toString(books.size()));
return books;
}</pre>
-</div></div><p>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 (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" height="400"
src="using-opentracing.data/image2017-9-10%2014:40:20.png"></span></p><p>The
same trace will be looking pretty similar using traditional <a shape="rect"
class="external-link" href="https:
//github.com/openzipkin/zipkin/tree/master/zipkin-ui" rel="nofollow">Zipkin
UI</a> frontend:</p><p><span class="confluence-embedded-file-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image"
height="250"
src="using-opentracing.data/image2017-9-10%2014:46:4.png"></span></p><h3
id="UsingOpenTracing-Example#5:ClientandServerwithparalleltrace(involvingthreadpools)">Example
#5: Client and Server with parallel trace (involving thread pools)</h3><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. 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><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 (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" draggable="false" height="400"
src="using-opentracing.data/image2017-9-10%2014:40:20.png"></span></p><p>The
same trace will be looking pretty similar using traditional <a shape="rect"
class="external-
link" href="https://github.com/openzipkin/zipkin/tree/master/zipkin-ui"
rel="nofollow">Zipkin UI</a> frontend:</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" draggable="false" height="250"
src="using-opentracing.data/image2017-9-10%2014:46:4.png"></span></p><h3
id="UsingOpenTracing-Example#5:ClientandServerwithparalleltrace(involvingthreadpools)">Example
#5: Client and Server with parallel trace (involving thread pools)</h3><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. 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">@Produces( {
MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks(@Context final TracerContext tracer)
throws Exception {
@@ -280,7 +280,7 @@ public Collection<Book> getBooks(@
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 (taken from <a shape="rect" class="external-link"
href="https://github.com/uber/jaeger-ui" rel="nofollow">Jaeger
UI</a>):</p><p><span class="confluence-embedded-file-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image"
height="250"
src="using-opentracing.data/image2017-9-10%2014:49:4.png"></span></p><p>The
same trace will be looking pretty similar using traditional <a shape="rect"
class="external-link"
href="https://github.com/openzipkin/zipkin/tree/master/zipkin-ui"
rel="nofollow">Zipkin UI</a> frontend:</p><p><span
class="confluence-embedded-fil
e-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" height="250"
src="using-opentracing.data/image2017-9-10%2014:50:2.png"></span></p><h3
id="UsingOpenTracing-Example#6:ClientandServerwithasynchronousJAX-RSservice(server-side)">Example
#6: Client and Server with asynchronous JAX-RS service (server-side)</h3><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 processed 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">
+</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 (taken from <a shape="rect" class="external-link"
href="https://github.com/uber/jaeger-ui" rel="nofollow">Jaeger
UI</a>):</p><p><span class="confluence-embedded-file-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image"
draggable="false" height="250"
src="using-opentracing.data/image2017-9-10%2014:49:4.png"></span></p><p>The
same trace will be looking pretty similar using traditional <a shape="rect"
class="external-link"
href="https://github.com/openzipkin/zipkin/tree/master/zipkin-ui"
rel="nofollow">Zipkin UI</a> frontend:</p><p><span class="confl
uence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" draggable="false" height="250"
src="using-opentracing.data/image2017-9-10%2014:50:2.png"></span></p><h3
id="UsingOpenTracing-Example#6:ClientandServerwithasynchronousJAX-RSservice(server-side)">Example
#6: Client and Server with asynchronous JAX-RS service (server-side)</h3><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 processed 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">@Produces( {
MediaType.APPLICATION_JSON } )
@GET
public void getBooks(@Suspended final AsyncResponse response, @Context final
TracerContext tracer) throws Exception {
@@ -305,7 +305,7 @@ public void getBooks(@Suspended final As
}
});
}</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 (service name<strong>
tracer-<span class="label label-default
service-filter-label">server</span></strong>) is going to generate the
following sample traces (taken from <a shape="rect" class="external-link"
href="https://github.com/uber/jaeger-ui" rel="nofollow">Jaeger
UI</a>):</p><p><span class="confluence-embedded-file-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image"
height="250"
src="using-opentracing.data/image2017-9-10%2014:54:2.png"></span></p><p>The
same trace will be looking pretty similar using traditional <a shape="rect"
class="external-link"
href="https://github.com/openzipkin/zipkin/tree/master/zipkin-ui"
rel="nofollow">Zipkin UI</a> frontend:</p><p><span
class="confluence-embedded-fil
e-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" height="250"
src="using-opentracing.data/image2017-9-10%2014:55:0.png"></span></p><h3
id="UsingOpenTracing-Example#7:ClientandServerwithasynchronousinvocation(client-side)">Example
#7: Client and Server with asynchronous invocation (client-side)</h3><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">
+</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 (service name<strong>
tracer-<span class="label label-default
service-filter-label">server</span></strong>) is going to generate the
following sample traces (taken from <a shape="rect" class="external-link"
href="https://github.com/uber/jaeger-ui" rel="nofollow">Jaeger
UI</a>):</p><p><span class="confluence-embedded-file-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image"
draggable="false" height="250"
src="using-opentracing.data/image2017-9-10%2014:54:2.png"></span></p><p>The
same trace will be looking pretty similar using traditional <a shape="rect"
class="external-link"
href="https://github.com/openzipkin/zipkin/tree/master/zipkin-ui"
rel="nofollow">Zipkin UI</a> frontend:</p><p><span class="confl
uence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" draggable="false" height="250"
src="using-opentracing.data/image2017-9-10%2014:55:0.png"></span></p><h3
id="UsingOpenTracing-Example#7:ClientandServerwithasynchronousinvocation(client-side)">Example
#7: Client and Server with asynchronous invocation (client-side)</h3><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">@Produces( {
MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks() {
@@ -320,7 +320,7 @@ public Collection<Book> getBooks()
.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 (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image"
height="250"
src="using-opentracing.data/image2017-9-10%2015:0:49.png"></span></p><p>The
same trace will be looking pretty similar using traditional <a shape="rect"
class="external-link"
href="https://github.com/openzipkin/zipkin/tree/master/zipkin-ui"
rel="nofollow">Zipkin UI</a> frontend:</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" height="250"
src="using-opentracing.data/image2017-9-10%2014:58:53.png"></span></p><h2
id="UsingOpenTracing-DistributedTracingwithOpenTracingandJAX-WSsupport">Distributed
Tracing with OpenTracing and JAX-WS support</h2><p>Distributed tracing in the
<a shape="rect" href="http://cxf.apache.org/">Apache CXF</a> is build primarily
around JAX-RS 2.x implementation. However, JAX-WS is also supported but it
requires to write some boiler-plate code and use <a shape="rect"
class="external-link" href="http://opentracing.io/"
rel="nofollow">OpenTracing</a> <a shape="rect" cla
ss="external-link" href="https://github.com/opentracing/opentracing-java"
rel="nofollow">Java API</a> directly (the JAX-WS integration is going to be
enhanced in the future). Essentially, from the server-side prospective the
in/out interceptors, <strong>OpenTracingStartInterceptor</strong> and
<strong><strong>OpenTracing</strong>StopInterceptor </strong>respectively,
should be configured as part of interceptor chains, either manually or using
<strong><strong>OpenTracing</strong>Feature</strong>. For example:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+</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 (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image"
draggable="false" height="250"
src="using-opentracing.data/image2017-9-10%2015:0:49.png"></span></p><p>The
same trace will be looking pretty similar using traditional <a shape="rect"
class="external-link"
href="https://github.com/openzipkin/zipkin/tree/master/zipkin-ui"
rel="nofollow">Zipkin UI</a> frontend:</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" draggable="false" height="250"
src="using-opentracing.data/image2017-9-10%2014:58:53.png"></span></p><h2
id="UsingOpenTracing-DistributedTracingwithOpenTracingandJAX-WSsupport">Distributed
Tracing with OpenTracing and JAX-WS support</h2><p>Distributed tracing in the
<a shape="rect" href="http://cxf.apache.org/">Apache CXF</a> is build primarily
around JAX-RS 2.x implementation. However, JAX-WS is also supported but it
requires to write some boiler-plate code and use <a shape="rect"
class="external-link" href="http://opentracing.io/" rel="nofollow">Open
Tracing</a> <a shape="rect" class="external-link"
href="https://github.com/opentracing/opentracing-java" rel="nofollow">Java
API</a> directly (the JAX-WS integration is going to be enhanced in the
future). Essentially, from the server-side prospective the in/out interceptors,
<strong>OpenTracingStartInterceptor</strong> and
<strong><strong>OpenTracing</strong>StopInterceptor </strong>respectively,
should be configured as part of interceptor chains, either manually or using
<strong><strong>OpenTracing</strong>Feature</strong>. For example:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">final Tracer tracer =
new Configuration("tracer",
new Configuration.SamplerConfiguration(ConstSampler.TYPE, 1), /* or
any other Sampler */
new Configuration.ReporterConfiguration(new
HttpSender("http://localhost:14268/api/traces")) /* or any other Sender */
@@ -554,7 +554,7 @@ public Collection<Book> getBooks()
.request()
.accept(MediaType.APPLICATION_JSON)
.get();</pre>
-</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 (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" width="1148"
src="using-opentracing.data/image2018-8-12_14-59-19.png"></span></p><h3
id="UsingOpenTracing-Example#2:ClientandServerwithnestedtrace.1">Example #2:
Client and Server with nested trace</h3><p>In this 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="codeC
ontent 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 (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" draggable="false" width="1148"
src="using-opentracing.data/image2018-8-12_14-59-19.png"></span></p><h3
id="UsingOpenTracing-Example#2:ClientandServerwithnestedtrace.1">Example #2:
Client and Server with nested trace</h3><p>In this 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">@Produces( {
MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks(@Context final TracerContext tracer)
throws Exception {
@@ -567,7 +567,7 @@ public Collection<Book> getBooks(@
);
}
}</pre>
-</div></div><p>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
(taken from <a shape="rect" class="external-link"
href="https://github.com/uber/jaeger-ui" rel="nofollow">Jaeger
UI</a>):</p><p><span class="confluence-embedded-file-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image"
width="1148"
src="using-opentracing.data/image2018-8-12_15-1-39.png"></span></p><h3
id="UsingOpenTracing-Example#3:ClientandServertracewithtimeline.1">Example #3:
Client and Server trace with timeline</h3><p>In this example server-side im
plementation 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">
+</div></div><p>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
(taken from <a shape="rect" class="external-link"
href="https://github.com/uber/jaeger-ui" rel="nofollow">Jaeger
UI</a>):</p><p><span class="confluence-embedded-file-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image"
draggable="false" width="1148"
src="using-opentracing.data/image2018-8-12_15-1-39.png"></span></p><h3
id="UsingOpenTracing-Example#3:ClientandServertracewithtimeline.1">Example #3:
Client and Server trace with timeline</h3><p>In this exam
ple server-side implementation 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">@Produces( {
MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks(@Context final TracerContext tracer)
throws Exception {
@@ -579,7 +579,7 @@ public Collection<Book> getBooks(@
new Book("Apache CXF Web Service Development", "Naveen Balani, Rajeev
Hathi")
);
}</pre>
-</div></div><p>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 (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" width="920"
src="using-opentracing.data/image2018-8-12_15-7-45.png"></span></p><h3
id="UsingOpenTracing-Example#4:ClientandServerwithannotations(key/value)">Example
#4: Client and Server with annotations (key/value)</h3><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 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><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 (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" draggable="false" width="920"
src="using-opentracing.data/image2018-8-12_15-7-45.png"></span></p><h3
id="UsingOpenTracing-Example#4:ClientandServerwithannotations(key/value)">Example
#4: Client and Server with annotations (key/value)</h3><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 unchanged.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">@Produces( {
MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks(@Context final TracerContext tracer)
throws Exception {
@@ -590,7 +590,7 @@ public Collection<Book> getBooks(@
tracer.annotate("# of books", Integer.toString(books.size()));
return books;
}</pre>
-</div></div><p>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 (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" height="250"
src="using-opentracing.data/image2018-8-12_15-11-42.png"></span></p><h3
id="UsingOpenTracing-Example#5:ClientandServerwithparalleltrace(involvingthreadpools).1">Example
#5: Client and Ser
ver with parallel trace (involving thread pools)</h3><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. 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><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 (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image" draggable="false" height="250"
src="using-opentracing.data/image2018-8-12_15-11-42.png"></span></p><h3
id="UsingOpenTracing-Example#5:ClientandServerwithparalleltrace(involvingthreadpools).1">Example
#5: Client and Server with parallel trace (involving thread pools)</h3><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. 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">@Produces( {
MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks(@Context final TracerContext tracer)
throws Exception {
@@ -620,7 +620,7 @@ public Collection<Book> getBooks(@
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 (taken from <a shape="rect" class="external-link"
href="https://github.com/uber/jaeger-ui" rel="nofollow">Jaeger
UI</a>):</p><p><span class="confluence-embedded-file-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image"
width="1148"
src="using-opentracing.data/image2018-8-12_15-13-13.png"></span></p><h3
id="UsingOpenTracing-Example#6:ClientandServerwithasynchronousJAX-RSservice(server-side).1">Example
#6: Client and Server with asynchronous JAX-RS service (server-side)</h3><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 processed 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">
+</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 (taken from <a shape="rect" class="external-link"
href="https://github.com/uber/jaeger-ui" rel="nofollow">Jaeger
UI</a>):</p><p><span class="confluence-embedded-file-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image"
draggable="false" width="1148"
src="using-opentracing.data/image2018-8-12_15-13-13.png"></span></p><h3
id="UsingOpenTracing-Example#6:ClientandServerwithasynchronousJAX-RSservice(server-side).1">Example
#6: Client and Server with asynchronous JAX-RS service (server-side)</h3><p>In
this example server-side implementation of the JAX-R
S service is going to be executed asynchronously. It poses a challenge from
the tracing prospective as request and response are processed 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">@Produces( {
MediaType.APPLICATION_JSON } )
@GET
public void getBooks(@Suspended final AsyncResponse response, @Context final
TracerContext tracer) throws Exception {
@@ -645,7 +645,7 @@ public void getBooks(@Suspended final As
}
});
}</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 (service name<strong>
tracer-<span class="label label-default
service-filter-label">server</span></strong>) is going to generate the
following sample traces (taken from <a shape="rect" class="external-link"
href="https://github.com/uber/jaeger-ui" rel="nofollow">Jaeger
UI</a>):</p><p><span class="confluence-embedded-file-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image"
width="1148"
src="using-opentracing.data/image2018-8-12_15-15-19.png"></span></p><h3
id="UsingOpenTracing-Example#7:ClientandServerwithasynchronousinvocation(client-side).1">Example
#7: Client and Server with asynchronous invocation (client-side)</h3><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">
+</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 (service name<strong>
tracer-<span class="label label-default
service-filter-label">server</span></strong>) is going to generate the
following sample traces (taken from <a shape="rect" class="external-link"
href="https://github.com/uber/jaeger-ui" rel="nofollow">Jaeger
UI</a>):</p><p><span class="confluence-embedded-file-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image"
draggable="false" width="1148"
src="using-opentracing.data/image2018-8-12_15-15-19.png"></span></p><h3
id="UsingOpenTracing-Example#7:ClientandServerwithasynchronousinvocation(client-side).1">Example
#7: Client and Server with asynchronous invocation (client-side)</h3><p>In
this example server-side implementation of the JAX-RS servi
ce 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">@Produces( {
MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks() {
@@ -660,7 +660,7 @@ public Collection<Book> getBooks()
.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 (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image"
width="1148"
src="using-opentracing.data/image2018-8-12_15-17-38.png"></span></p><h2
id="UsingOpenTracing-DistributedTracingwithOpenTracingandJAX-WSsupport.1">Distributed
Tracing with OpenTracing and JAX-WS support</h2><p>Distributed tracing in the
<a shape="rect" href="http://cxf.apache.org/">Apache CXF</a> is build primarily
around JAX-RS 2.x implementation. However, JAX-WS is also supported but it
requires to write some boiler-plate code and use <a shape="rect"
class="external-link" href="http://opentracing.io/"
rel="nofollow">OpenTracing</a> <a shape="rect" class="external-link"
href="https://github.com/opentracing/opentracing-java" rel="nofollow">Java
API</a> directly (the JAX-WS integration is going to be enhanced in the
future). Essentially, from the server-side prospective the in/out interceptors,
<strong>OpenTracingStartInterceptor</strong> and
<strong><strong>OpenTracing</strong>StopInterceptor </strong>respectively,
should be configured as part of interceptor ch
ains, either manually or using
<strong><strong>OpenTracing</strong>Feature</strong>. For example:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+</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 (taken from <a shape="rect"
class="external-link" href="https://github.com/uber/jaeger-ui"
rel="nofollow">Jaeger UI</a>):</p><p><span
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
class="confluence-embedded-image"
draggable="false" width="1148"
src="using-opentracing.data/image2018-8-12_15-17-38.png"></span></p><h2
id="UsingOpenTracing-DistributedTracingwithOpenTracingandJAX-WSsupport.1">Distributed
Tracing with OpenTracing and JAX-WS support</h2><p>Distributed tracing in the
<a shape="rect" href="http://cxf.apache.org/">Apache CXF</a> is build primarily
around JAX-RS 2.x implementation. However, JAX-WS is also supported but it
requires to write some boiler-plate code and use <a shape="rect"
class="external-link" href="http://opentracing.io/"
rel="nofollow">OpenTracing</a> <a shape="rect" class="external-link"
href="https://github.com/opentracing/opentracing-java" rel="nofollow">Java
API</a> directly (the JAX-WS integration is going to be enhanced in the
future). Essentially, from the server-side prospective the in/out interceptors,
<strong>OpenTracingStartInterceptor</strong> and
<strong><strong>OpenTracing</strong>StopInterceptor </strong>respectively,
should be configured as part
of interceptor chains, either manually or using
<strong><strong>OpenTracing</strong>Feature</strong>. For example:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">final Tracer tracer =
new Configuration("tracer")
.withSampler(
new SamplerConfiguration()
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 May 9
17:47:03 2023
@@ -59,7 +59,7 @@ Apache CXF -- Using OpenZipkin Brave
<td id="cell-1-1"> </td>
<td id="cell-1-2">
<!-- Banner -->
-<div class="banner" id="banner"><div class="table-wrap"><table
class="confluenceTable" style="width: 100.0%;" border="0" cellpadding="0"
cellspacing="0"><colgroup span="1"><col span="1"><col
span="1"></colgroup><tbody><tr><td align="left" colspan="1" rowspan="1"
class="confluenceTd" style="border: none;"><a shape="rect"
href="http://cxf.apache.org/" title="Apache CXF"> <span style="color:
white;font-size: 170.0%;font-weight: bold;">Apache CXF</span> </a></td><td
align="right" colspan="1" rowspan="1" class="confluenceTd" style="border:
none;"><a shape="rect" class="external-link" href="http://www.apache.org/"
title="The Apache Software Foundation"> <span
class="confluence-embedded-file-wrapper image-right-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image
confluence-external-resource image-right" alt="The Apache Software Foundation"
width="214" src="https://apache.org/img/asf_logo.png"
data-image-src="https://apache.org/img/asf_logo.png"></span> </a></td><
/tr></tbody></table></div></div>
+<div class="banner" id="banner"><div class="table-wrap"><table
class="confluenceTable" style="width: 100.0%;" border="0" cellpadding="0"
cellspacing="0"><colgroup span="1"><col span="1"><col
span="1"></colgroup><tbody><tr><td align="left" colspan="1" rowspan="1"
class="confluenceTd" style="border: none;"><a shape="rect"
href="http://cxf.apache.org/" title="Apache CXF"> <span style="color:
white;font-size: 170.0%;font-weight: bold;">Apache CXF</span> </a></td><td
align="right" colspan="1" rowspan="1" class="confluenceTd" style="border:
none;"><a shape="rect" class="external-link" href="http://www.apache.org/"
title="The Apache Software Foundation"> <span
class="confluence-embedded-file-wrapper image-right-wrapper
confluence-embedded-manual-size"><img class="confluence-embedded-image
confluence-external-resource image-right" draggable="false" alt="The Apache
Software Foundation" width="214" src="https://apache.org/img/asf_logo.png"
data-image-src="https://apache.org/img/asf_logo.png">
</span> </a></td></tr></tbody></table></div></div>
<!-- Banner -->
<div id="top-menu">
<table border="0" cellpadding="1" cellspacing="0" width="100%">
@@ -99,7 +99,7 @@ Apache CXF -- Using OpenZipkin Brave
<div id="navigation"><ul class="alternate"><li><a shape="rect"
href="overview.html">Overview</a></li><li><a shape="rect"
href="how-tos.html">How-Tos</a></li><li><a shape="rect"
href="frontends.html">Frontends</a></li><li><a shape="rect"
href="databindings.html">DataBindings</a></li><li><a shape="rect"
href="transports.html">Transports</a></li><li><a shape="rect"
href="configuration.html">Configuration</a></li><li><a shape="rect"
href="debugging-and-logging.html">Debugging and Logging</a></li><li><a
shape="rect" href="tools.html">Tools</a></li><li><a shape="rect"
href="restful-services.html">RESTful Services</a></li><li><a shape="rect"
href="wsdl-bindings.html">WSDL Bindings</a></li><li><a shape="rect"
href="service-routing.html">Service Routing</a></li><li><a shape="rect"
href="dynamic-languages.html">Dynamic Languages</a></li><li><a shape="rect"
href="ws-support.html">WS-* Support</a></li><li><a shape="rect"
href="advanced-integration.html">Advanced Integration</a></li><li><a shape
="rect" href="deployment.html">Deployment</a></li><li><a shape="rect"
href="schemas-and-namespaces.html">Use of Schemas and
Namespaces</a></li></ul><hr><ul
class="alternate"><li><p>Search</p></li></ul><iframe frameborder="1"
scrolling="auto" id="searchId"
src="https://cxf.apache.org/resources/search.htm" name="SearchIFrame"
width="200px" style="border:none;" title="Search" height="60px"><p><br
clear="none"></p></iframe>
-<hr><ul class="alternate"><li><a shape="rect"
href="http://cxf.apache.org/javadoc/latest-3.5.x/">API 3.5.x
(Javadoc)</a></li><li><a shape="rect"
href="http://cxf.apache.org/javadoc/latest-3.2.x/">API 3.2.x
(Javadoc)</a></li><li><a shape="rect"
href="http://cxf.apache.org/javadoc/latest-3.1.x/">API 3.1.x
(Javadoc)</a></li><li><a shape="rect" href="http://cxf.apache.org/">CXF
Website</a></li></ul><p><br clear="none"></p><p><a shape="rect"
class="external-link" href="https://www.apache.org/events/current-event.html">
<span class="confluence-embedded-file-wrapper"><img
class="confluence-embedded-image confluence-external-resource"
src="https://www.apache.org/events/current-event-125x125.png"
data-image-src="https://www.apache.org/events/current-event-125x125.png"></span>
</a></p></div>
+<hr><ul class="alternate"><li><a shape="rect"
href="http://cxf.apache.org/javadoc/latest-4.0.x/">API 4.0.x
(Javadoc)</a></li><li><a shape="rect"
href="http://cxf.apache.org/javadoc/latest-3.6.x/">API 3.6.x
(Javadoc)</a></li><li><a shape="rect"
href="http://cxf.apache.org/javadoc/latest-3.5.x/">API 3.5.x
(Javadoc)</a></li><li><a shape="rect" href="http://cxf.apache.org/">CXF
Website</a></li></ul><p><br clear="none"></p><p><a shape="rect"
class="external-link" href="https://www.apache.org/events/current-event.html">
<span class="confluence-embedded-file-wrapper"><img
class="confluence-embedded-image confluence-external-resource"
draggable="false" src="https://www.apache.org/events/current-event-125x125.png"
data-image-src="https://www.apache.org/events/current-event-125x125.png"></span>
</a></p></div>
<!-- NavigationBar -->
</div>
</div>
@@ -110,11 +110,11 @@ Apache CXF -- Using OpenZipkin Brave
<!-- Content -->
<div class="wiki-content">
<div id="ConfluenceContent"><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1651074379460 {padding: 0px;}
-div.rbtoc1651074379460 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1651074379460 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1683654391807 {padding: 0px;}
+div.rbtoc1683654391807 ul {margin-left: 0px;}
+div.rbtoc1683654391807 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1651074379460">
+/*]]>*/</style></p><div class="toc-macro rbtoc1683654391807">
<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-DistributedTracingwithOpenZipkinBraveandOSGi">Distributed
Tracing with OpenZipkin Brave and OSGi</a></li><li><a shape="rect"
href="#UsingOpenZipkinBrave-Migratingfrombrave-cxf3">Migrating from
brave-cxf3</a></li><li><a shape="rect"
href="#UsingOpenZipkinBrave-SpringXML-Configuration">Spring
XML-Configuration</a></li><li><a shape="rect"
href="#UsingOpenZipkinBrave-Usingnon-JAX-RSclients">Using non-JAX-RS
clients</a></li><li><a shape="rect"
href="#UsingOpenZipkinBrave-AccessingBraveAPIs">Accessing Brave
APIs</a></li></ul>
@@ -231,7 +231,7 @@ public Collection<Book> getBooks()
.request()
.accept(MediaType.APPLICATION_JSON)
.get();</pre>
-</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> </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" draggable="false" height="150"
src="using-openzipkin-brave.data/image2017-2-6%2020:16:19.png"></span></p><p> </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"
draggable="false" 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 S
erver with nested trace</h2><p>In this 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">@Produces( {
MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks(@Context final TracerContext tracer)
throws Exception {
@@ -244,7 +244,7 @@ public Collection<Book> getBooks(@
);
}
}</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"><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">
+</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" draggable="false" 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 serve
r-side implementation 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">@Produces( {
MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks(@Context final TracerContext tracer)
throws Exception {
@@ -256,7 +256,7 @@ public Collection<Book> getBooks(@
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-20: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 unchanged
.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+</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" draggable="false" width="900"
src="using-openzipkin-brave.data/image2017-2-6-20: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 co
de 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">@Produces( {
MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks(@Context final TracerContext tracer)
throws Exception {
@@ -267,7 +267,7 @@ public Collection<Book> getBooks(@
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. The client-side code
>stays unchanged.</p><div class="code panel pdl" style="border-width:
>1px;"><div class="codeContent panelContent pdl">
+</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" draggable="false" height="250"
src="using-openzipkin-brave.data/image2017-2-6%2020:49:43.png"></span></p><h2
id="UsingOpenZipkinBrave-Example#5:ClientandServerwithparalleltrace(invo
lvingthreadpools)">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. 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">@Produces( {
MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks(@Context final TracerContext tracer)
throws Exception {
@@ -297,7 +297,7 @@ public Collection<Book> getBooks(@
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-21: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 process
ed 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">
+</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"
draggable="false" width="900"
src="using-openzipkin-brave.data/image2017-2-6-21: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 re
sponse are processed 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">@Produces( {
MediaType.APPLICATION_JSON } )
@GET
public void getBooks(@Suspended final AsyncResponse response, @Context final
TracerContext tracer) throws Exception {
@@ -322,7 +322,7 @@ public void getBooks(@Suspended final As
}
});
}</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><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"
width="900"
src="using-openzipkin-brave.data/image2017-2-6-21:46:48.png"></span></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">
+</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><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"
draggable="false" width="900"
src="using-openzipkin-brave.data/image2017-2-6-21:46:48.png"></span></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 implementa
tion 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">@Produces( {
MediaType.APPLICATION_JSON } )
@GET
public Collection<Book> getBooks() {
@@ -337,7 +337,7 @@ public Collection<Book> getBooks()
.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-21:6:56.png"></span></p><h1
id="UsingOpenZipkinBrave-Distribut
edTracingwithOpenZipkinBraveandJAX-WSsupport">Distributed Tracing with
OpenZipkin Brave and JAX-WS support</h1><p>Distributed tracing in the <a
shape="rect" href="http://cxf.apache.org/">Apache CXF</a> is build primarily
around JAX-RS 2.x implementation. However, JAX-WS is also supported but it
requires to write some boiler-plate code and use <a shape="rect"
class="external-link" href="https://github.com/openzipkin/brave"
rel="nofollow">OpenZipkin Brave</a> API directly (the JAX-WS integration is
going to be enhanced in the future). Essentially, from the server-side
prospective the in/out interceptors, <strong>BraveStartInterceptor</strong> and
<strong>BraveStopInterceptor </strong>respectively, should be configured as
part of interceptor chains, either manually or using
<strong>BraveFeature</strong>. For example:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</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" draggable="false" width="900"
src="using-openzipkin-brave.data/image2017-2-6-21:6:56.png"></span></p><h1
id="UsingOpenZip
kinBrave-DistributedTracingwithOpenZipkinBraveandJAX-WSsupport">Distributed
Tracing with OpenZipkin Brave and JAX-WS support</h1><p>Distributed tracing in
the <a shape="rect" href="http://cxf.apache.org/">Apache CXF</a> is build
primarily around JAX-RS 2.x implementation. However, JAX-WS is also supported
but it requires to write some boiler-plate code and use <a shape="rect"
class="external-link" href="https://github.com/openzipkin/brave"
rel="nofollow">OpenZipkin Brave</a> API directly (the JAX-WS integration is
going to be enhanced in the future). Essentially, from the server-side
prospective the in/out interceptors, <strong>BraveStartInterceptor</strong> and
<strong>BraveStopInterceptor </strong>respectively, should be configured as
part of interceptor chains, either manually or using
<strong>BraveFeature</strong>. For example:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">// Configure the spans
transport sender
final Sender sender = ...;