Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 1.94 KB

File metadata and controls

38 lines (26 loc) · 1.94 KB

SDA Commons Server Open Tracing

This module provides the OpenTracingBundle used to instrument using OpenTracing.

First, the module injects an external trace received via HTTP headers and continues new spans inside the existing trace. In addition, it instruments JAX-RS with different spans, like HTTP requests after resource matching and entity serialisation.

This module doesn't work standalone, as it requires a collector to send traces to a central instance to view them. Therefore it is required to also include the JaegerBundle inside the application.

Initialization

To activate the OpenTracing instrumentation, the OpenTracingBundle needs to be added to the application, no further configuration required. Make sure that the JaegerBundle is initialized before the OpenTracingBundle.

   @Override
   public void initialize(Bootstrap<Configuration> bootstrap) {
      bootstrap.addBundle(JaegerBundle.builder().build());
      ...
      // Other OpenTracing bundles
      bootstrap.addBundle(OpenTracingBundle.builder().build());
      ...
   }

It is also possible to use the builder withTracer(Tracer tracer) to inject a different tracer, instead of the GlobalTracer. This can be useful for testing, in this case a MockTracer can be injected.

Instrumentation

In most cases the existing instrumentation of sda-commons should be sufficient. However to observe internal behavior of a service, manual instrumentation might be required. Manual instrumentation can be done using the opentracing-java package. An example of manual instrumentation is available in sda-commons-server-opentracing-example.