Interface Agent

  • All Superinterfaces:
    com.newrelic.api.agent.Agent

    public interface Agent
    extends com.newrelic.api.agent.Agent
    The internal bridge version of the Agent API.
    • Method Detail

      • getTracedMethod

        @Deprecated
        TracedMethod getTracedMethod()
        Deprecated.
        Use NewRelic.getAgent(). getTracedMethod() if possible instead of this method.
        Returns the current traced method. This can only be invoked within methods that are traced.
        Specified by:
        getTracedMethod in interface com.newrelic.api.agent.Agent
        Returns:
        The current method being traced
      • getTransaction

        @Deprecated
        Transaction getTransaction()
        Deprecated.
        Use NewRelic.getAgent(). getTransaction() if possible instead of this method.
        Returns the current transaction.
        Specified by:
        getTransaction in interface com.newrelic.api.agent.Agent
        Returns:
        The current transaction
      • getTransaction

        Transaction getTransaction​(boolean createIfNotExists)
        Get the transaction stored in a thread local.
        Parameters:
        createIfNotExists - if true, create a transaction if needed.
        Returns:
        the transaction in the thread local or possibly null if createIfExists == false
      • getWeakRefTransaction

        Transaction getWeakRefTransaction​(boolean createIfNotExists)
        Return a weak reference to the current transaction stored in the thread local. Use this if you need to compare an actual concrete Transaction object rather than the TransactionApiImpl wrapper
        Parameters:
        createIfNotExists - if true, create a transaction if needed.
        Returns:
        a weak reference wrapped transaction in the thread local or possibly null if createIfExists == false
      • startAsyncActivity

        @Deprecated
        boolean startAsyncActivity​(java.lang.Object activityContext)
        Deprecated.
        Parameters:
        activityContext - the key used by instrumentation to identify this asynchronous activity. The value must have been previously made known to New Relic by a call to {@see registerAsyncActivity}.

        Implementation note: the activityContext must match the argument passed to {@see registerAsyncActivity} by identity comparison ("=="). Strings or other values that are derived or computed in the parent activity and the re-derived or computed in the child do not meet this requirement. In many Java implementations, string interning is nondeterministic and does not provide a reliable solution.

        Returns:
        true if the context is recognized and an action is taken. False if the context does not exist.
      • ignoreIfUnstartedAsyncContext

        boolean ignoreIfUnstartedAsyncContext​(java.lang.Object activityContext)
        Inform instrumentation that the asynchronous activity identified by the key should no longer be tracked by instrumentation. This method may be called from any thread, however it will only apply to activities that haven't been started.
        Parameters:
        activityContext - the key used by instrumentation to identify this asynchronous activity. The value must be unique across all asynchronous activities tracked during the life of the current Agent instance and must have been previously made known to New Relic by a call to {@see registerAsyncActivity}.
        Returns:
        true if the context is recognized and an action is taken. False if the context does not exist.
      • getLogSender

        Logs getLogSender()
        Provides access to the LogSender events API.
        Returns:
        Object used to add custom events.
      • getEntityGuid

        java.lang.String getEntityGuid​(boolean wait)