OneAgent OpenTracing support

Early Adopter Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially those built using a microservices architecture.

You can integrate OpenTracing into Dynatrace. OpenTracing API provides a standard, vendor-neutral framework for the instrumentation of your applications for distributed tracing.

Dynatrace integrates the OpenTracing traces that are emitted by third-party Java libraries and frameworks, such as Hazelcast, into PurePath 4 and enriches the data with analytics, including:

  • Out-of-the-box service hotspot analysis
  • Deep-code execution details
  • Always-on profiling in transaction context

Although we've tested the seamless integration of OpenTracing data emitted by Hazelcast into PurePath, the quality of the OpenTracing spans captured by OneAgent depends on the quality of instrumentation provided by the third-party library.

Prerequisites

Enable OpenTracing integration

To make OneAgent automatically tap into traces exposed via OpenTracing instrumentation and sends the telemetry data to the Dynatrace, enable the support for capturing OpenTracing span data for Java:

  1. From the navigation menu, select Settings > Server-side service monitoring > Deep monitoring.
  2. Expand OpenTelemetry and OpenTracing.
  3. You can enable OneAgent to:
    • Automatically register Dynatrace as the GlobalTracer and thereby override other tracers that are registered in the application. Select this setting only if you're sure that you want to override the other tracers (for example, Jaeger) in your tracing system.
    • Automatically register Dynatrace as the GlobalTracer when no other tracer is registered in the application. Do this if you don't want to interfere with any other tracers in your tracing system.
  4. In your application code use the return value from GlobalTracer.get() to create spans. The following sample shows how to manually create spans with OpenTracing:
    opentracing.java
    Download
    // Make sure to use the correct Tracer.
    Tracer tracer = GlobalTracer.get();
    SpanBuilder spanBuilder = tracer.buildSpan("hello");
    spanBuilder.withTag("foo", "bar");
    Span span = spanBuilder.start();
    // Make sure to close every created Scope. 
    // It is recommended to use a try-with-resource statement for that.
    try (Scope scope = tracer.activateSpan(span)) {
        // Do actual operation.
    } finally {
        // Make sure to finish every started Span.
        span.finish();
    }
    
    The following sample shows how to use an existing instrumentation library to create spans with OpenTracing:
    opentracing_hazelcast.java
    Download
    HazelcastInstance untraced = HazelcastClient.newHazelcastClient();
    // This operation will not be visible in Dynatrace.
    untraced.getMap("map").put("key", "value");
    
    // TracingHazelcastInstance implements the same interface (HazelcastInstance)
    // but automatially creates span for every operation.
    // It internally calls GlobalTracer.get(). 
    // Available as a separate instrumentation library:
    // https://github.com/opentracing-contrib/java-hazelcast
    HazelcastInstance traced = new TracingHazelcastInstance(
        HazelcastClient.newHazelcastClient(),
        false // traceWithActiveSpanOnly
    );
    // This operation will be visible in Dynatrace.
    traced.getMap("map").put("key", "value");
    

Span attributes configuration

Configure the span attributes collection so that you protect the data privacy and stay GDPR compliant.

Dynatrace does not capture all span attributes by default. This enables you to stay compliant with your data privacy policies and to allow you to control the amount of monitoring data.

You can explicitly configure the collection of span attributes under Settings > Server-side service monitoring > Span attributes. Specify the key of the span attribute you'd like OneAgent to capture and seamlessly integrate into PurePath.

Limitations

  • O* default service
  • When both OneAgent and OpenTracing instrumentation are present for the same technology (for example, incoming web requests via the Servlet API) you may experience the following limitations:
    • duplicated nodes in PurePath
    • additional overhead
    • for JDBC, such double instrumentation may break the service detection
    Be extra cautious when enabling OneAgent OpenTracing Java support for technologies that are supported#java-and-scala) by OneAgent out of the box.
  • Integrating traces from OpenTracing Spring Framework instrumentation is currently not supported.

Supported technologies

Dynatrace integrates traces from generic OpenTracing instrumentation. We have positively tested the OpenTracing instrumentation of the following libraries and frameworks: