Author: buildbot
Date: Fri Sep 15 01:42:53 2023
New Revision: 1084173

Log:
Production update by buildbot for cxf

Added:
    websites/production/cxf/content/docs/using-micrometer-observation.data/
    
websites/production/cxf/content/docs/using-micrometer-observation.data/image-2023-9-14_21-18-58.png
   (with props)
    
websites/production/cxf/content/docs/using-micrometer-observation.data/image-2023-9-14_21-20-50.png
   (with props)
Modified:
    websites/production/cxf/content/cache/docs.pageCache
    websites/production/cxf/content/docs/using-micrometer-observation.html

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

Added: 
websites/production/cxf/content/docs/using-micrometer-observation.data/image-2023-9-14_21-18-58.png
==============================================================================
Binary file - no diff available.

Propchange: 
websites/production/cxf/content/docs/using-micrometer-observation.data/image-2023-9-14_21-18-58.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
websites/production/cxf/content/docs/using-micrometer-observation.data/image-2023-9-14_21-20-50.png
==============================================================================
Binary file - no diff available.

Propchange: 
websites/production/cxf/content/docs/using-micrometer-observation.data/image-2023-9-14_21-20-50.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: websites/production/cxf/content/docs/using-micrometer-observation.html
==============================================================================
--- websites/production/cxf/content/docs/using-micrometer-observation.html 
(original)
+++ websites/production/cxf/content/docs/using-micrometer-observation.html Fri 
Sep 15 01:42:53 2023
@@ -107,7 +107,16 @@ Apache CXF -- Using Micrometer Observati
          <td height="100%">
            <!-- Content -->
            <div class="wiki-content">
-<div id="ConfluenceContent"><h1 
id="UsingMicrometerObservation-Overview">Overview</h1><p><a shape="rect" 
class="external-link" href="https://micrometer.io/"; 
rel="nofollow">Micrometer</a> is a metrics instrumentation library for 
JVM-based applications that Apache CXF <a shape="rect" 
href="https://cwiki.apache.org/confluence/display/CXF20DOC/Micrometer";>provides 
the support for</a>. Starting from <a shape="rect" class="external-link" 
href="https://micrometer.io/"; rel="nofollow">Micrometer</a> 
<strong>1.10</strong>, <a shape="rect" class="external-link" 
href="https://micrometer.io/"; rel="nofollow">Micrometer</a> provides the <a 
shape="rect" class="external-link" 
href="https://micrometer.io/docs/observation"; rel="nofollow">Observation 
API</a> and a plugin mechanism that allows to add capabilities including the 
tracing features. Starting from <strong>4.0.3 </strong>release, the Apache CXF 
fully supports integration (through <strong>cxf-integration-tracing-micrometer 
</strong>module) with
  <a shape="rect" class="external-link" 
href="https://micrometer.io/docs/tracing"; rel="nofollow">Micrometer Tracing</a> 
distributed tracing capabilities using <a shape="rect" class="external-link" 
href="https://micrometer.io/docs/observation"; rel="nofollow">Micrometer 
Observation APIs</a>.</p><p>The section <a shape="rect" 
href="https://cwiki.apache.org/confluence/display/CXF20DOC/Using+Apache+HTrace";>dedicated
 to Apache HTrace </a>has pretty good introduction into distributed tracing, 
however <a shape="rect" class="external-link" 
href="https://micrometer.io/docs/observation"; rel="nofollow">Micrometer 
Observation</a> uses own, more generic, terminology and provides the general 
APIs to denote the <strong>Observation </strong>lifecycle (which somewhat is 
analogous to <strong>Span</strong>) and injection points to propagate the 
context across many distributed components. As such, the intrinsic details 
about HTTP headers f.e. becomes an integral part of the distributed tracer of 
your cho
 ice, out of reach for Apache CXF.</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><a shape="rect" 
class="external-link" href="https://github.com/micrometer-metrics/tracing"; 
rel="nofollow">Micrometer Tracing</a> provides a simple facade for the most 
popular tracer libraries, letting to implement the instrumentation of the 
JVM-based application code without vendor lock-in. It is designed to add little 
to no overhead to the tracing collection activity while maximizing the 
portability of the tracing efforts.</p></div></div><h1 
id="UsingMicrometerObservation-DistributedTracinginApacheCXFusingMicrometerObservation">Distributed
 Tracing in Apache CXF using Micrometer Observation</h1><p>The current 
integration of the <a shape="rect" class="external-link" 
href="https://micrometer.io/docs/observation"; rel="nofol
 low">Micrometer Observation</a>'s distributed tracing in <a shape="rect" 
href="http://cxf.apache.org/";>Apache CXF</a> supports <a shape="rect" 
class="external-link" href="https://micrometer.io/docs/observation"; 
rel="nofollow">Micrometer Observation</a> <strong>1</strong><strong 
class="external-link">.10.x</strong> /&#160; <a shape="rect" 
class="external-link" href="https://micrometer.io/docs/tracing"; 
rel="nofollow">Micrometer Tracing</a> <strong>1.10.x</strong> and provides 
full-fledged support of JAX-RS 2.x / JAX-WS applications. From high-level 
prospective, the JAX-RS integration consists of three main 
parts:</p><ul><li><strong>TracerContext</strong> (injectable through 
<strong>@Context</strong> 
annotation)</li><li><strong>ObservationProvider</strong> (server-side JAX-RS 
provider) and <strong>Observation</strong><strong>ClientProvider</strong> 
(client-side JAX-RS provider)</li><li 
class="external-link"><strong>ObservationFeature</strong> (server-side JAX-RS 
feature) to simplify th
 e configuration and integration</li></ul><p>Similarly, from high-level 
perspective,&#160;JAX-WS integration 
includes:</p><ul><li><strong>ObservationStartInterceptor</strong> / 
<strong>Observation</strong><strong>StopInterceptor</strong> / 
<strong>Observation</strong><strong>Feature </strong><a shape="rect" 
href="http://cxf.apache.org/";>Apache CXF</a> feature (server-side JAX-WS 
support)</li><li><strong>ObservationClientStartInterceptor</strong> / 
<strong>Observation</strong><strong>ClientStopInterceptor</strong> / 
<strong>Observation</strong><strong>ClientFeature </strong><a shape="rect" 
href="http://cxf.apache.org/";>Apache CXF</a> feature (client-side JAX-WS 
support)</li></ul><p><a shape="rect" href="http://cxf.apache.org/";>Apache 
CXF</a> uses HTTP headers to hand off tracing context from the client to the 
service and from the service to service. Those headers are specific to 
distributing tracing framework you have picked and are not configurable at the 
moment (unless the framework
  itself has a way to do that).</p><p>By default, 
<strong>Observation</strong><strong>ClientProvider</strong> will use configured 
propagators to pass the currently active <strong>observation</strong> through 
HTTP headers on each service invocation. If there is no active observations, 
the new observation will be created and passed through HTTP headers on 
per-invocation basis. Essentially, for JAX-RS applications just registering 
<strong>Observation</strong><strong>ClientProvider</strong> on the client and 
<strong>Observation</strong><strong>Provider</strong> on the server is enough 
to have tracing context to be properly passed everywhere. The only 
configuration part which is necessary are <strong>span reporter(s) / 
exporter(s)</strong> and <strong>sampler(s)</strong> which are, not 
surprisingly, specific to distributing tracing bridge you have chosen.</p><p>It 
is also worth to mention the way <a shape="rect" 
href="http://cxf.apache.org/";>Apache CXF</a> attaches the description to <str
 ong>observations</strong> (<strong>spans</strong>). With regards to the client 
integration, the description becomes a full URL being invoked prefixed by HTTP 
method, for example: <strong>GET </strong><a shape="rect" class="external-link" 
href="http://localhost:8282/books"; 
rel="nofollow"><strong>http://localhost:8282</strong>/books</a>. On the server 
side integration, the description becomes a relative JAX-RS resource path 
prefixed by HTTP method, f.e.: <strong>GET books, POST book/123</strong></p><h1 
id="UsingMicrometerObservation-ConfiguringClient">Configuring 
Client</h1><p>There are a couple of ways the JAX-RS client could be configured, 
depending on the tracing bridge you want to use (see please <a shape="rect" 
class="external-link" 
href="https://micrometer.io/docs/tracing#_configuring_with_micrometer_observation";
 rel="nofollow">Configuring with Micrometer Observation</a>). The <a 
shape="rect" href="http://cxf.apache.org/";>Apache CXF</a> provides its own 
<strong>WebClient</strong
 > which could be configured just like that (in future versions, there would be 
 > a simpler ways to do that using client specific features):</p><div 
 > class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
 > panelContent pdl">
+<div id="ConfluenceContent"><h1 
id="UsingMicrometerObservation-/*&lt;![CDATA[*/div.rbtoc1694742169433{padding:0px;}div.rbtoc1694742169433ul{margin-left:0px;}div.rbtoc1694742169433li{margin-left:0px;padding-left:0px;}/*]]&gt;*/#UsingMicrometerObservation-Overview#UsingMicrometerObservation-Overvie"><style
 type="text/css">/*<![CDATA[*/
+div.rbtoc1694742169433 {padding: 0px;}
+div.rbtoc1694742169433 ul {margin-left: 0px;}
+div.rbtoc1694742169433 li {margin-left: 0px;padding-left: 0px;}
+
+/*]]>*/</style></h1><div class="toc-macro rbtoc1694742169433">
+<ul class="toc-indentation"><li><a shape="rect" 
href="#UsingMicrometerObservation-"></a></li><li><a shape="rect" 
href="#UsingMicrometerObservation-Overview">Overview</a></li><li><a 
shape="rect" 
href="#UsingMicrometerObservation-DistributedTracinginApacheCXFusingMicrometerObservation">Distributed
 Tracing in Apache CXF using Micrometer Observation</a></li><li><a shape="rect" 
href="#UsingMicrometerObservation-ConfiguringClient">Configuring 
Client</a></li><li><a shape="rect" 
href="#UsingMicrometerObservation-ConfiguringServer">Configuring 
Server</a></li><li><a shape="rect" 
href="#UsingMicrometerObservation-DistributedTracingInAction:UsageScenarios">Distributed
 Tracing In Action: Usage Scenarios</a>
+<ul class="toc-indentation"><li><a shape="rect" 
href="#UsingMicrometerObservation-Example#1:ClientandServerwithdefaultdistributedtracingconfigured">Example
 #1: Client and Server with default distributed tracing 
configured</a></li><li><a shape="rect" 
href="#UsingMicrometerObservation-Example#2:ClientandServerwithnestedtrace">Example
 #2: Client and Server with nested trace</a></li><li><a shape="rect" 
href="#UsingMicrometerObservation-Example#3:ClientandServertracewithannotations">Example
 #3: Client and Server trace with annotations</a></li><li><a shape="rect" 
href="#UsingMicrometerObservation-Example#4:ClientandServerwithbinaryannotations(key/value)">Example
 #4: Client and Server with binary annotations (key/value)</a></li><li><a 
shape="rect" 
href="#UsingMicrometerObservation-Example#5:ClientandServerwithparalleltrace(involvingthreadpools)">Example
 #5: Client and Server with parallel trace (involving thread 
pools)</a></li><li><a shape="rect" href="#UsingMicrometerObservation-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="#UsingMicrometerObservation-Example#7:ClientandServerwithasynchronousinvocation(client-side)">Example
 #7: Client and Server with asynchronous invocation (client-side)</a></li></ul>
+</li><li><a shape="rect" 
href="#UsingMicrometerObservation-DistributedTracingwithMicrometerObservationandJAX-WSsupport">Distributed
 Tracing with Micrometer Observation and JAX-WS support</a></li><li><a 
shape="rect" 
href="#UsingMicrometerObservation-AccessingMicrometerObservationAPIs">Accessing 
Micrometer Observation APIs</a></li><li><a shape="rect" 
href="#UsingMicrometerObservation-Usingnon-JAX-RSclients">Using non-JAX-RS 
clients</a></li></ul>
+</div><h1 id="UsingMicrometerObservation-Overview">Overview</h1><p><a 
shape="rect" class="external-link" href="https://micrometer.io/"; 
rel="nofollow">Micrometer</a> is a metrics instrumentation library for 
JVM-based applications that Apache CXF <a shape="rect" 
href="https://cwiki.apache.org/confluence/display/CXF20DOC/Micrometer";>provides 
the support for</a>. Starting from <a shape="rect" class="external-link" 
href="https://micrometer.io/"; rel="nofollow">Micrometer</a> 
<strong>1.10</strong>, <a shape="rect" class="external-link" 
href="https://micrometer.io/"; rel="nofollow">Micrometer</a> provides the <a 
shape="rect" class="external-link" 
href="https://micrometer.io/docs/observation"; rel="nofollow">Observation 
API</a> and a plugin mechanism that allows to add capabilities including the 
tracing features. Starting from <strong>4.0.3 </strong>release, the Apache CXF 
fully supports integration (through <strong>cxf-integration-tracing-micrometer 
</strong>module) with <a shape="rect" class
 ="external-link" href="https://micrometer.io/docs/tracing"; 
rel="nofollow">Micrometer Tracing</a> distributed tracing capabilities using <a 
shape="rect" class="external-link" 
href="https://micrometer.io/docs/observation"; rel="nofollow">Micrometer 
Observation APIs</a>.</p><p>The section <a shape="rect" 
href="https://cwiki.apache.org/confluence/display/CXF20DOC/Using+Apache+HTrace";>dedicated
 to Apache HTrace </a>has pretty good introduction into distributed tracing, 
however <a shape="rect" class="external-link" 
href="https://micrometer.io/docs/observation"; rel="nofollow">Micrometer 
Observation</a> uses own, more generic, terminology and provides the general 
APIs to denote the <strong>Observation </strong>lifecycle (which somewhat is 
analogous to <strong>Span</strong>) and injection points to propagate the 
context across many distributed components. As such, the intrinsic details 
about HTTP headers f.e. becomes an integral part of the distributed tracer of 
your choice, out of reach for 
 Apache CXF.</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><a shape="rect" 
class="external-link" href="https://github.com/micrometer-metrics/tracing"; 
rel="nofollow">Micrometer Tracing</a> provides a simple facade for the most 
popular tracer libraries, letting to implement the instrumentation of the 
JVM-based application code without vendor lock-in. It is designed to add little 
to no overhead to the tracing collection activity while maximizing the 
portability of the tracing efforts.</p></div></div><h1 
id="UsingMicrometerObservation-DistributedTracinginApacheCXFusingMicrometerObservation">Distributed
 Tracing in Apache CXF using Micrometer Observation</h1><p>The current 
integration of the <a shape="rect" class="external-link" 
href="https://micrometer.io/docs/observation"; rel="nofollow">Micrometer Observ
 ation</a>'s distributed tracing in <a shape="rect" 
href="http://cxf.apache.org/";>Apache CXF</a> supports <a shape="rect" 
class="external-link" href="https://micrometer.io/docs/observation"; 
rel="nofollow">Micrometer Observation</a> <strong>1</strong><strong 
class="external-link">.10.x</strong> /&#160; <a shape="rect" 
class="external-link" href="https://micrometer.io/docs/tracing"; 
rel="nofollow">Micrometer Tracing</a> <strong>1.0.x</strong> and provides 
full-fledged support of JAX-RS 2.x / JAX-WS applications. From high-level 
prospective, the JAX-RS integration consists of three main 
parts:</p><ul><li><strong>TracerContext</strong> (injectable through 
<strong>@Context</strong> 
annotation)</li><li><strong>ObservationProvider</strong> (server-side JAX-RS 
provider) and <strong>Observation</strong><strong>ClientProvider</strong> 
(client-side JAX-RS provider)</li><li 
class="external-link"><strong>ObservationFeature</strong> (server-side JAX-RS 
feature) to simplify the configuration and int
 egration</li></ul><p>Similarly, from high-level perspective,&#160;JAX-WS 
integration includes:</p><ul><li><strong>ObservationStartInterceptor</strong> / 
<strong>Observation</strong><strong>StopInterceptor</strong> / 
<strong>Observation</strong><strong>Feature </strong><a shape="rect" 
href="http://cxf.apache.org/";>Apache CXF</a> feature (server-side JAX-WS 
support)</li><li><strong>ObservationClientStartInterceptor</strong> / 
<strong>Observation</strong><strong>ClientStopInterceptor</strong> / 
<strong>Observation</strong><strong>ClientFeature </strong><a shape="rect" 
href="http://cxf.apache.org/";>Apache CXF</a> feature (client-side JAX-WS 
support)</li></ul><p><a shape="rect" href="http://cxf.apache.org/";>Apache 
CXF</a> uses HTTP headers to hand off tracing context from the client to the 
service and from the service to service. Those headers are specific to 
distributing tracing framework you have picked and are not configurable at the 
moment (unless the framework itself has a way to do
  that).</p><p>By default, 
<strong>Observation</strong><strong>ClientProvider</strong> will use configured 
propagators to pass the currently active <strong>observation</strong> through 
HTTP headers on each service invocation. If there is no active observations, 
the new observation will be created and passed through HTTP headers on 
per-invocation basis. Essentially, for JAX-RS applications just registering 
<strong>Observation</strong><strong>ClientProvider</strong> on the client and 
<strong>Observation</strong><strong>Provider</strong> on the server is enough 
to have tracing context to be properly passed everywhere. The only 
configuration part which is necessary are <strong>span reporter(s) / 
exporter(s)</strong> and <strong>sampler(s)</strong> which are, not 
surprisingly, specific to distributing tracing bridge you have chosen.</p><p>It 
is also worth to mention the way <a shape="rect" 
href="http://cxf.apache.org/";>Apache CXF</a> attaches the description to 
<strong>observations</stron
 g> (<strong>spans</strong>). With regards to the client integration, the 
description becomes a full URL being invoked prefixed by HTTP method, for 
example: <strong>GET </strong><a shape="rect" class="external-link" 
href="http://localhost:8282/books"; 
rel="nofollow"><strong>http://localhost:8282</strong>/books</a>. On the server 
side integration, the description becomes a relative JAX-RS resource path 
prefixed by HTTP method, f.e.: <strong>GET books, POST book/123</strong></p><h1 
id="UsingMicrometerObservation-ConfiguringClient">Configuring 
Client</h1><p>There are a couple of ways the JAX-RS client could be configured, 
depending on the tracing bridge you want to use (see please <a shape="rect" 
class="external-link" 
href="https://micrometer.io/docs/tracing#_configuring_with_micrometer_observation";
 rel="nofollow">Configuring with Micrometer Observation</a>). The <a 
shape="rect" href="http://cxf.apache.org/";>Apache CXF</a> provides its own 
<strong>WebClient</strong> which could be config
 ured just like that (in future versions, there would be a simpler ways to do 
that using client specific features):</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default">final 
ObservationRegistry observationRegistry = ObservationRegistry.create();
 
 final Tracer tracer = &lt;create tracer using tracing bridge&gt;;
@@ -124,7 +133,7 @@ Response response = WebClient
     .create("http://localhost:9000/catalog";, Arrays.asList(new 
ObservationClientProvider(observationRegistry))
     .accept(MediaType.APPLICATION_JSON)
     .get();</pre>
-</div></div><p><br clear="none"></p><h1 
id="UsingMicrometerObservation-ConfiguringServer">Configuring 
Server</h1><p>Server configuration is a very similar to the client one and uses 
<strong>ObservationFeature</strong>, but still requires the tracing bridge 
configuration (see please <a shape="rect" class="external-link" 
href="https://micrometer.io/docs/tracing#_configuring_with_micrometer_observation";
 rel="nofollow">Configuring with Micrometer Observation</a>). Depending on the 
way the <a shape="rect" href="http://cxf.apache.org/";>Apache CXF</a> is used to 
configure JAX-RS services, it could be part of JAX-RS application 
configuration, for example:</p><p><br clear="none"></p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h1 id="UsingMicrometerObservation-ConfiguringServer">Configuring 
Server</h1><p>Server configuration is a very similar to the client one and uses 
<strong>ObservationFeature</strong>, but still requires the tracing bridge 
configuration (see please <a shape="rect" class="external-link" 
href="https://micrometer.io/docs/tracing#_configuring_with_micrometer_observation";
 rel="nofollow">Configuring with Micrometer Observation</a>). Depending on the 
way the <a shape="rect" href="http://cxf.apache.org/";>Apache CXF</a> is used to 
configure JAX-RS services, it could be part of JAX-RS application 
configuration, for example:</p><p><br clear="none"></p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default">@ApplicationPath("/")
 public class CatalogApplication extends Application {
     @Override
@@ -148,7 +157,7 @@ public class CatalogApplication extends
             );
     }
 }</pre>
-</div></div><p>Or it could be configured using 
<strong>JAXRSServerFactoryBean</strong> as well, for example:</p><p><br 
clear="none"></p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div><p>Or it could be configured using 
<strong>JAXRSServerFactoryBean</strong> as well, 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 
ObservationRegistry observationRegistry = ObservationRegistry.create();
 
 final Tracer tracer = &lt;create tracer using tracing bridge&gt;;
@@ -165,7 +174,74 @@ final JAXRSServerFactoryBean factory = R
 factory.setProvider(new ObservationFeature(observationRegistry));
 ...
 return factory.create();</pre>
-</div></div><p>Once the <strong>span processor(s) / reporter(s) </strong>and 
<strong>sampler</strong> are properly configured, all generated 
<strong>observations </strong>(<strong>spans</strong>) are going to be 
collected and available for analysis and/or visualization.</p><h1 
id="UsingMicrometerObservation-DistributedTracingInAction:UsageScenarios">Distributed
 Tracing In Action: Usage Scenarios</h1><p>TBD</p><h2 
id="UsingMicrometerObservation-Example#1:ClientandServerwithdefaultdistributedtracingconfigured">Example
 #1: Client and Server with default distributed tracing 
configured</h2><p>TBD</p><h2 
id="UsingMicrometerObservation-Example#2:ClientandServerwithnestedtrace">Example
 #2: Client and Server with nested trace</h2><p>TBD</p><h2 
id="UsingMicrometerObservation-Example#3:ClientandServertracewithannotations">Example
 #3: Client and Server trace with annotations</h2><p>TBD</p><h2 
id="UsingMicrometerObservation-Example#4:ClientandServerwithbinaryannotations(key/value)">Example
 #4: C
 lient and Server with binary annotations (key/value)</h2><p>TBD</p><h2 
id="UsingMicrometerObservation-Example#5:ClientandServerwithparalleltrace(involvingthreadpools)">Example
 #5: Client and Server with parallel trace (involving thread 
pools)</h2><p>TBD</p><h2 
id="UsingMicrometerObservation-Example#6:ClientandServerwithasynchronousJAX-RSservice(server-side)">Example
 #6: Client and Server with asynchronous JAX-RS service 
(server-side)</h2><p>TBD</p><h2 
id="UsingMicrometerObservation-Example#7:ClientandServerwithasynchronousinvocation(client-side)">Example
 #7: Client and Server with asynchronous invocation 
(client-side)</h2><p>TBD</p><h1 
id="UsingMicrometerObservation-DistributedTracingwithMicrometerObservationandJAX-WSsupport">Distributed
 Tracing with&#160;Micrometer Observation and JAX-WS support</h1><p>TBD</p><h1 
id="UsingMicrometerObservation-AccessingMicrometerObservationAPIs">Accessing&#160;Micrometer
 Observation APIs</h1><p>TBD</p><h1 id="UsingMicrometerObservation-Usingnon-JAX
 -RSclients">Using non-JAX-RS clients</h1><p>TBD</p></div>
+</div></div><p>Once the <strong>span processor(s) / reporter(s) </strong>and 
<strong>sampler</strong> are properly configured, all generated 
<strong>observations </strong>(<strong>spans</strong>) are going to be 
collected and available for analysis and/or visualization.</p><h1 
id="UsingMicrometerObservation-DistributedTracingInAction:UsageScenarios">Distributed
 Tracing In Action: Usage Scenarios</h1><p>In the following subsections we are 
going to walk through many different scenarios to illustrate the distributed 
tracing in action, starting from the simplest ones and finishing with 
asynchronous JAX-RS services. All examples assume that configuration 
<strong>has been done</strong> (see please <a shape="rect" 
href="https://cwiki.apache.org/confluence/display/CXF20DOC/Using+Micrometer+Observation#UsingMicrometerObservation-ConfiguringClient";><span
 class="confluence-link">Configuring Client</span></a><span 
class="confluence-link">&#160;</span> and <a shape="rect" 
href="https://cwiki.apa
 
che.org/confluence/display/CXF20DOC/Using+Micrometer+Observation#UsingMicrometerObservation-ConfiguringServer"><span
 class="confluence-link">Configuring Server</span></a> sections above). In this 
example, both client and server use <a shape="rect" class="external-link" 
href="https://opentelemetry.io/"; rel="nofollow">OpenTelemetry</a> tracing 
bridge (see please <a shape="rect" class="external-link" 
href="https://micrometer.io/docs/tracing#_configuring_with_micrometer_observation";
 rel="nofollow">Configuring with Micrometer Observation</a> for more 
details):</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default">final Resource 
resource = Resource.getDefault().merge(
+    Resource.create(Attributes.of(ResourceAttributes.SERVICE_NAME, "...")));
+
+final SdkTracerProvider sdkTracerProvider = SdkTracerProvider.builder()
+    
.addSpanProcessor(BatchSpanProcessor.builder(OtlpGrpcSpanExporter.builder().build()).build())
+    .setSampler(Sampler.alwaysOn())
+    .setResource(resource)
+    .build();
+
+final OpenTelemetrySdk openTelemetrySdk = OpenTelemetrySdk.builder()
+    .setTracerProvider(sdkTracerProvider)
+    
.setPropagators(ContextPropagators.create(W3CTraceContextPropagator.getInstance()))
+    .buildAndRegisterGlobal();
+
+final OtelCurrentTraceContext bridgeContext = new OtelCurrentTraceContext();
+final io.opentelemetry.api.trace.Tracer otelTracer = 
openTelemetrySdk.getTracer("...");
+
+final OtelPropagator propagator = new OtelPropagator(ContextPropagators.create(
+    TextMapPropagator.composite(W3CTraceContextPropagator.getInstance())), 
otelTracer);
+
+final Slf4JEventListener slf4JEventListener = new Slf4JEventListener();
+final Slf4JBaggageEventListener slf4JBaggageEventListener = new 
Slf4JBaggageEventListener(Collections.emptyList());
+
+final ObservationRegistry observationRegistry = ObservationRegistry.create();
+final OtelTracer tracer = new OtelTracer(otelTracer, bridgeContext, event 
-&gt; {
+        slf4JEventListener.onEvent(event);
+        slf4JBaggageEventListener.onEvent(event);
+    });
+
+observationRegistry.observationConfig().observationHandler(
+        new FirstMatchingCompositeObservationHandler(
+            new PropagatingSenderTracingObservationHandler&lt;&gt;(tracer, 
propagator),
+            new PropagatingReceiverTracingObservationHandler&lt;&gt;(tracer, 
propagator)
+        )
+    );</pre>
+</div></div><h2 
id="UsingMicrometerObservation-Example#1:ClientandServerwithdefaultdistributedtracingconfigured">Example
 #1: Client and Server with default distributed tracing configured</h2><p>In 
the first example we are going to see the effect of using default configuration 
on the client and on the server, with only <strong><span style="color: 
rgb(0,0,0);">ObservationClientProvider </span></strong>and <strong><span 
style="color: rgb(0,0,0);">Observation</span>Provider</strong> registered. The 
JAX-RS resource endpoint is pretty basic stubbed method:</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&lt;Book&gt; getBooks() {
+    return Arrays.asList(
+        new Book("Apache CXF Web Service Development", "Naveen Balani, Rajeev 
Hathi")
+    );
+}</pre>
+</div></div><p>The client is as simple as that:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default">final Response 
response = client
+    .target("http://localhost:8282/books";)
+    .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" draggable="false" width="900" 
src="using-micrometer-observation.data/image-2023-9-14_21-20-50.png"></span></p><h2
 
id="UsingMicrometerObservation-Example#2:ClientandServerwithnestedtrace">Example
 #2: Client and Server with nested trace</h2><p>TBD</p><h2 
id="UsingMicrometerObservation-Example#3:ClientandServertracewithannotations">Example
 #3: Client and Server trace with annotations</h2><p>TBD</p><h2 
id="UsingMicrometerObservation-Example#4:ClientandServerwithbinaryannotations
 (key/value)">Example #4: Client and Server with binary annotations 
(key/value)</h2><p>TBD</p><h2 
id="UsingMicrometerObservation-Example#5:ClientandServerwithparalleltrace(involvingthreadpools)">Example
 #5: Client and Server with parallel trace (involving thread 
pools)</h2><p>TBD</p><h2 
id="UsingMicrometerObservation-Example#6:ClientandServerwithasynchronousJAX-RSservice(server-side)">Example
 #6: Client and Server with asynchronous JAX-RS service 
(server-side)</h2><p>TBD</p><h2 
id="UsingMicrometerObservation-Example#7:ClientandServerwithasynchronousinvocation(client-side)">Example
 #7: Client and Server with asynchronous invocation 
(client-side)</h2><p>TBD</p><h1 
id="UsingMicrometerObservation-DistributedTracingwithMicrometerObservationandJAX-WSsupport">Distributed
 Tracing with&#160;Micrometer Observation and JAX-WS support</h1><p>TBD</p><h1 
id="UsingMicrometerObservation-AccessingMicrometerObservationAPIs">Accessing&#160;Micrometer
 Observation APIs</h1><p>The <a shape="rect" href="ht
 tp://cxf.apache.org/">Apache CXF</a>&#160; abstracts as much of the 
tracer-specific APIs behind <strong>TracerContext</strong> as possible. 
However, sometimes there is a need to get access to &#160;<a shape="rect" 
class="external-link" href="https://micrometer.io/docs/observation"; 
rel="nofollow">Micrometer Observation</a> APIs in order to leverages the rich 
set of available instrumentations. To make it possible, 
<strong>TracerContext</strong> has a dedicated <strong>unwrap</strong> method 
which returns underlying <strong>Tracer</strong> instance. The snippet below 
shows off how to use this API and use <a shape="rect" class="external-link" 
href="https://micrometer.io/docs/observation"; rel="nofollow">Micrometer 
Observation</a> instrumentation for <a shape="rect" class="external-link" 
href="https://github.com/OpenFeign/feign-opentracing"; rel="nofollow">OpenFeign 
client</a> through <strong>MicrometerObservationCapability</strong>.</p><div 
class="code panel pdl" style="border-width: 1px;
 "><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default">@GET
+@Path("/search")
+@Produces(MediaType.APPLICATION_JSON)
+public JsonObject search(@QueryParam("q") final String query, @Context final 
TracerContext tracing) throws Exception {
+    final GoogleBooksApi api = Feign
+        .builder()
+        .addCapability(new 
MicrometerObservationCapability(tracing.unwrap(ObservationRegistry.class)))
+        .target(GoogleBooksApi.class, "https://www.googleapis.com";);
+     
+    final feign.Response response = api.search(query);
+    try (final Reader reader = 
response.body().asReader(StandardCharsets.UTF_8)) {
+        return Json.createReader(reader).readObject();
+    }
+}
+
+</pre>
+</div></div><h1 id="UsingMicrometerObservation-Usingnon-JAX-RSclients">Using 
non-JAX-RS clients</h1><p>The&#160; <a shape="rect" 
href="http://cxf.apache.org/";>Apache CXF</a>&#160; uses native <a shape="rect" 
class="external-link" href="https://micrometer.io/docs/observation"; 
rel="nofollow">Micrometer Observation</a> capabilities so the existing 
instrumentations for different HTTP clients work as expected. The usage of only 
JAX-RS client is not required.</p></div>
            </div>
            <!-- Content -->
          </td>


Reply via email to