Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 process name jaxrsclient/192.168.0.100) and consequent invocation of the service on the server side (process name jaxrsserver/192.168.0.100) is going to generate the following sample traces:

Distributed Tracing and JAX-WS support

Distributed tracing into Apache CXF 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 Apache HTrace API directly. The JAX-WS is going to be enhanced in the nearest future. Essentially, from the server-side prospective the in/out interceptors, HTraceStartInterceptor and HTraceStopInterceptor, should be configured as part of interceptor chains. The span receiver should be configured manually though, using Apache HTrace API, for example:

Code Block
java
java
final Map<String, String> properties = new HashMap<String, String>();
final HTraceConfiguration conf = HTraceConfiguration.fromMap(properties);
Trace.addReceiver(new StandardOutSpanReceiver(conf));
            
final JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
...
sf.getInInterceptors().add(new HTraceStartInterceptor(Phase.PRE_INVOKE, new AlwaysSampler(conf)));
sf.getOutInterceptors().add(new HTraceStopInterceptor(Phase.PRE_MARSHAL));
...
sf.create();
Info

Configuring right phases for interceptors is very important. The recommended phase for in-interceptor is PRE_INVOKE while for out-interceptor is PRE_MARSHAL. If wrong phases are being used, response or/and request headers could be ignored or not processed.

TODO: Client side

Future Work

The Apache CXF is very proud to offer Apache HTrace integration. At the current stage, it was a conscious decision to keep the minimal API and provide the set of necessary features only. However, there is a strong commitment to evolve not only Apache HTrace integration, but the distributed tracing support in general.