Interface Tracer

    • Method Detail

      • startRootTransaction

        @Nullable
        Transaction startRootTransaction​(@Nullable
                                         java.lang.ClassLoader initiatingClassLoader)
        Starts a trace-root transaction
        Parameters:
        initiatingClassLoader - the class loader corresponding to the service which initiated the creation of the transaction. Used to determine the service name.
        Returns:
        a transaction that will be the root of the current trace if the agent is currently RUNNING; null otherwise
      • startRootTransaction

        @Nullable
        Transaction startRootTransaction​(@Nullable
                                         java.lang.ClassLoader initiatingClassLoader,
                                         long epochMicro)
      • startRootTransaction

        @Nullable
        Transaction startRootTransaction​(Sampler sampler,
                                         long epochMicros,
                                         @Nullable
                                         java.lang.ClassLoader initiatingClassLoader)
        Starts a trace-root transaction with a specified sampler and start timestamp
        Parameters:
        sampler - the Sampler instance which is responsible for determining the sampling decision if this is a root transaction
        epochMicros - the start timestamp
        initiatingClassLoader - the class loader corresponding to the service which initiated the creation of the transaction. Used to determine the service name and to load application-scoped classes like the MDC, for log correlation.
        Returns:
        a transaction that will be the root of the current trace if the agent is currently RUNNING; null otherwise
      • startChildTransaction

        @Nullable
        <C> Transaction startChildTransaction​(@Nullable
                                              C headerCarrier,
                                              TextHeaderGetter<C> textHeadersGetter,
                                              @Nullable
                                              java.lang.ClassLoader initiatingClassLoader)
        Starts a transaction as a child of the context headers obtained through the provided HeaderGetter. If the created transaction cannot be started as a child transaction (for example - if no parent context header is available), then it will be started as the root transaction of the trace.
        Parameters:
        headerCarrier - the Object from which context headers can be obtained, typically a request or a message
        textHeadersGetter - provides the trace context headers required in order to create a child transaction
        initiatingClassLoader - the class loader corresponding to the service which initiated the creation of the transaction. Used to determine the service name.
        Returns:
        a transaction which is a child of the provided parent if the agent is currently RUNNING; null otherwise
      • startChildTransaction

        @Nullable
        <C> Transaction startChildTransaction​(@Nullable
                                              C headerCarrier,
                                              TextHeaderGetter<C> textHeadersGetter,
                                              @Nullable
                                              java.lang.ClassLoader initiatingClassLoader,
                                              long epochMicros)
      • startChildTransaction

        @Nullable
        <C> Transaction startChildTransaction​(@Nullable
                                              C headerCarrier,
                                              TextHeaderGetter<C> textHeadersGetter,
                                              Sampler sampler,
                                              long epochMicros,
                                              @Nullable
                                              java.lang.ClassLoader initiatingClassLoader)
        Starts a transaction as a child of the context headers obtained through the provided HeaderGetter. If the created transaction cannot be started as a child transaction (for example - if no parent context header is available), then it will be started as the root transaction of the trace.
        Parameters:
        headerCarrier - the Object from which context headers can be obtained, typically a request or a message
        textHeadersGetter - provides the trace context headers required in order to create a child transaction
        sampler - the Sampler instance which is responsible for determining the sampling decision if this is a root transaction
        epochMicros - the start timestamp
        initiatingClassLoader - the class loader corresponding to the service which initiated the creation of the transaction. Used to determine the service name and to load application-scoped classes like the MDC, for log correlation.
        Returns:
        a transaction which is a child of the provided parent if the agent is currently RUNNING; null otherwise
      • startChildTransaction

        @Nullable
        <C> Transaction startChildTransaction​(@Nullable
                                              C headerCarrier,
                                              BinaryHeaderGetter<C> binaryHeadersGetter,
                                              @Nullable
                                              java.lang.ClassLoader initiatingClassLoader)
        Starts a transaction as a child of the context headers obtained through the provided HeaderGetter. If the created transaction cannot be started as a child transaction (for example - if no parent context header is available), then it will be started as the root transaction of the trace.
        Parameters:
        headerCarrier - the Object from which context headers can be obtained, typically a request or a message
        binaryHeadersGetter - provides the trace context headers required in order to create a child transaction
        initiatingClassLoader - the class loader corresponding to the service which initiated the creation of the transaction. Used to determine the service name.
        Returns:
        a transaction which is a child of the provided parent if the agent is currently RUNNING; null otherwise
      • startChildTransaction

        @Nullable
        <C> Transaction startChildTransaction​(@Nullable
                                              C headerCarrier,
                                              BinaryHeaderGetter<C> binaryHeadersGetter,
                                              Sampler sampler,
                                              long epochMicros,
                                              @Nullable
                                              java.lang.ClassLoader initiatingClassLoader)
        Starts a transaction as a child of the context headers obtained through the provided HeaderGetter. If the created transaction cannot be started as a child transaction (for example - if no parent context header is available), then it will be started as the root transaction of the trace.
        Parameters:
        headerCarrier - the Object from which context headers can be obtained, typically a request or a message
        binaryHeadersGetter - provides the trace context headers required in order to create a child transaction
        sampler - the Sampler instance which is responsible for determining the sampling decision if this is a root transaction
        epochMicros - the start timestamp
        initiatingClassLoader - the class loader corresponding to the service which initiated the creation of the transaction. Used to determine the service name and to load application-scoped classes like the MDC, for log correlation.
        Returns:
        a transaction which is a child of the provided parent if the agent is currently RUNNING; null otherwise
      • currentTransaction

        @Nullable
        Transaction currentTransaction()
      • getActiveSpan

        @Nullable
        Span getActiveSpan()
      • captureAndReportException

        void captureAndReportException​(@Nullable
                                       java.lang.Throwable e,
                                       java.lang.ClassLoader initiatingClassLoader)
        Captures an exception without providing an explicit reference to a parent AbstractSpan
        Parameters:
        e - the exception to capture
        initiatingClassLoader - the class
      • captureAndReportException

        @Nullable
        java.lang.String captureAndReportException​(long epochMicros,
                                                   @Nullable
                                                   java.lang.Throwable e,
                                                   @Nullable
                                                   AbstractSpan<?> parent)
      • captureException

        @Nullable
        ErrorCapture captureException​(@Nullable
                                      java.lang.Throwable e,
                                      @Nullable
                                      AbstractSpan<?> parent,
                                      @Nullable
                                      java.lang.ClassLoader initiatingClassLoader)
      • getActiveExitSpan

        @Nullable
        Span getActiveExitSpan()
      • overrideServiceNameForClassLoader

        void overrideServiceNameForClassLoader​(@Nullable
                                               java.lang.ClassLoader classLoader,
                                               @Nullable
                                               java.lang.String serviceName)
        Overrides the service name for all Transactions, Spans and ErrorCaptures which are created by the service which corresponds to the provided ClassLoader.

        The main use case is being able to differentiate between multiple services deployed to the same application server.

        Parameters:
        classLoader - the class loader which corresponds to a particular service
        serviceName - the service name for this class loader
      • stop

        void stop()
        Called when the container shuts down. Cleans up thread pools and other resources.
      • isRunning

        boolean isRunning()
      • createExitChildSpan

        @Nullable
        Span createExitChildSpan()