Versions Compared

Key

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

...

Warning

The Apache HTrace project has retired on 2018-04-11 and is not developed anymore. The Apache CXF will no longer provide retired the Apache HTrace integration, staring starting from 3.3.0 release. 

Overview

...

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 has been done (see please Configuring Client and Configuring Server sections above).

Example #1: Client and Server with default distributed tracing configured

...

Info

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

...

The special [-, -] placeholder indicates that no trace details are being available at the moment of logging the record.

Accessing Apache HTrace APIs

The Apache CXF  abstracts as much of the tracer-specific APIs behind TracerContext as possible. However, sometimes there is a need to get access to Apache HTrace APIs in order to leverages the available instrumentations. To make it possible, TracerContext has a dedicated unwrap method which returns underlying Tracer instance.

Code Block
java
java
@GET
@Path("/search")
@Produces(MediaType.APPLICATION_JSON)
public JsonObject search(@QueryParam("q") final String query, @Context final TracerContext tracing) throws Exception {
    final Tracer tracer = tracing.unwrap(Tracer.class);
    // ...
}

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.