Versions Compared

Key

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

...

In this example server-side implementation of the JAX-RS service is going to offload some work into thread pool and then return the response to the client, simulating parallel execution.For this example to work, the Brave on server side should be con figured a little bit differently:

Code Block
java
java
final Endpoint endpoint =  Endpoint.create("tracer-server",
    ByteBuffer.wrap(Inet4Address.getLocalHost().getAddress()).getInt());
        
final Brave brave = new Brave.Builder(new InheritableServerClientAndLocalSpanState(endpoint))
    .reporter(AsyncReporter.builder(sender).build())
    .traceSampler(Sampler.ALWAYS_SAMPLE)
    .build();

The client-side code stays unchanged.

...

The actual invocation of the request by the client (with service name tracer-client) and consequent invocation of the service on the server side (process name tracer-server) is going to generate the following sample traces:

 Image Added

Example #6: Client and Server with asynchronous JAX-RS service (server-side)

...