Package 

Interface RumMonitor


  • 
    public interface RumMonitor
    
                        

    A class enabling Datadog RUM features.

    It allows you to record User events that can be explored and analyzed in Datadog Dashboards.

    You can only have one active RumMonitor, and should register/retrieve it from the GlobalRum object.

    • Method Detail

      • startView

         abstract Unit startView(Object key, String name, Map<String, Object> attributes)

        Notifies that a View is being shown to the user, linked with the key instance.

        Parameters:
        key - the instance that represents the active view (usually your Activity or Fragment instance).
        name - the name of the view (usually your Activity or Fragment full class name)
        attributes - additional custom attributes to attach to the view.
      • stopView

         abstract Unit stopView(Object key, Map<String, Object> attributes)

        Stops a previously started View, linked with the key instance.

        Parameters:
        key - the instance that represents the active view (usually your Activity or Fragment instance).
        attributes - additional custom attributes to attach to the view.
      • addUserAction

         abstract Unit addUserAction(RumActionType type, String name, Map<String, Object> attributes)

        Notifies that a User Action happened. This is used to track discrete user actions (e.g.: tap).

        Parameters:
        type - the action type
        name - the action identifier
        attributes - additional custom attributes to attach to the action.
      • startUserAction

         abstract Unit startUserAction(RumActionType type, String name, Map<String, Object> attributes)

        Notifies that a User Action started. This is used to track long running user actions (e.g.: scroll). Such a user action must be stopped with stopUserAction, and will be stopped automatically if it lasts more than 10 seconds.

        Parameters:
        type - the action type
        name - the action identifier
        attributes - additional custom attributes to attach to the action.
      • stopUserAction

         abstract Unit stopUserAction(RumActionType type, String name, Map<String, Object> attributes)

        Notifies that a User Action stopped, and update the action's type and name. This is used to stop tracking long running user actions (e.g.: scroll), started with startUserAction.

        Parameters:
        type - the action type (overriding the last started action)
        name - the action identifier (overriding the last started action)
        attributes - additional custom attributes to attach to the action.
      • startResource

         abstract Unit startResource(String key, String method, String url, Map<String, Object> attributes)

        Notify that a new Resource is being loaded, linked with the key instance.

        Parameters:
        key - the instance that represents the resource being loaded (usually your request or network call instance).
        method - the method used to load the resource (E.g.
        url - the url or local path of the resource being loaded
        attributes - additional custom attributes to attach to the resource.
      • stopResource

         abstract Unit stopResource(String key, Integer statusCode, Long size, RumResourceKind kind, Map<String, Object> attributes)

        Stops a previously started Resource, linked with the key instance.

        Parameters:
        key - the instance that represents the active view (usually your request or network call instance).
        statusCode - the status code of the resource (if any)
        size - the size of the resource, in bytes
        kind - the type of resource loaded
        attributes - additional custom attributes to attach to the resource.
      • stopResourceWithError

         abstract Unit stopResourceWithError(String key, Integer statusCode, String message, RumErrorSource source, Throwable throwable, Map<String, Object> attributes)

        Stops a previously started Resource that failed loading, linked with the key instance.

        Parameters:
        key - the instance that represents the active view (usually your request or network call instance).
        statusCode - the status code of the resource (if any)
        message - a message explaining the error
        source - the source of the error
        throwable - the throwable
        attributes - additional custom attributes to attach to the error.
      • stopResourceWithError

         abstract Unit stopResourceWithError(String key, Integer statusCode, String message, RumErrorSource source, String stackTrace, String errorType, Map<String, Object> attributes)

        Stops a previously started Resource that failed loading, linked with the key instance by providing the intercepted stacktrace. Note: This method should only be used from hybrid application.

        Parameters:
        key - the instance that represents the active view (usually your request or network call instance).
        statusCode - the status code of the resource (if any)
        message - a message explaining the error
        source - the source of the error
        stackTrace - the error stacktrace
        errorType - the type of the error.
        attributes - additional custom attributes to attach to the error.
      • addError

         abstract Unit addError(String message, RumErrorSource source, Throwable throwable, Map<String, Object> attributes)

        Notifies that an error occurred in the active View.

        Parameters:
        message - a message explaining the error
        source - the source of the error
        throwable - the throwable
        attributes - additional custom attributes to attach to the error.
      • addErrorWithStacktrace

         abstract Unit addErrorWithStacktrace(String message, RumErrorSource source, String stacktrace, Map<String, Object> attributes)

        Notifies that an error occurred in the active View.

        This method is meant for non-native or cross platform frameworks (such as React Native or Flutter) to send error information to Datadog. Although it can be used directly, it is recommended to pass a Throwable instead.

        Parameters:
        message - a message explaining the error
        source - the source of the error
        stacktrace - the error stacktrace information
        attributes - additional custom attributes to attach to the error
      • addTiming

         abstract Unit addTiming(String name)

        Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.

        Parameters:
        name - the name of the new custom timing attribute.
      • addFeatureFlagEvaluation

         abstract Unit addFeatureFlagEvaluation(String name, Object value)

        Adds result of evaluating a feature flag to the view. Feature flag evaluations are local to the active view and are cleared when the view is stopped.

        Parameters:
        name - the name of the feature flag
        value - the value the feature flag evaluated to
      • stopSession

         abstract Unit stopSession()

        Stops the current session. A new session will start in response to a call to startView, addUserAction, or startUserAction. If the session is started because of a call to addUserAction, or startUserAction, the last know view is restarted in the new session.