Package 

Object GlobalDatadogTracer


  • 
    public class GlobalDatadogTracer
    
                        

    A holder object for managing and retrieving a global instance of the DatadogTracer.

    This object is used to share same instance of DatadogTracer across different integrations such as OkHttp, Kotlin's coroutines, ect.

    • Method Summary

      Modifier and Type Method Description
      final static Boolean registerIfAbsent(DatadogTracerĀ tracer) Registers the provided tracer as the global tracer if no tracer is currently registered.
      final static DatadogTracer get() Retrieves the current active tracer for Datadog, or a no-operation tracer if none is active.
      final DatadogTracer getOrNull() Retrieves the current instance of the DatadogTracer, if available.
      final Unit clear() Clears the current instance of the global Datadog tracer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • registerIfAbsent

         final static Boolean registerIfAbsent(DatadogTracerĀ tracer)

        Registers the provided tracer as the global tracer if no tracer is currently registered.

        Parameters:
        tracer - The tracer to register as the global tracer.
      • get

         final static DatadogTracer get()

        Retrieves the current active tracer for Datadog, or a no-operation tracer if none is active.

      • getOrNull

         final DatadogTracer getOrNull()

        Retrieves the current instance of the DatadogTracer, if available.

      • clear

         final Unit clear()

        Clears the current instance of the global Datadog tracer.

        This method sets the internal tracer instance to null, effectively removing any active tracer currently held in the global state. The general purpose is to use it for test implementation.