Package 

Object BugsnagPerformance

    • Method Detail

      • start

         final static Unit start(Context context)

        Initialise the Bugsnag Performance SDK. This should be called within your Application.onCreate to ensure that all measurements are accurately reported.

        Parameters:
        context - an Android Context, typically your Application instance
      • start

         final static Unit start(PerformanceConfiguration configuration)

        Initialise the Bugsnag Performance SDK. This should be called within your Application.onCreate to ensure that all measurements are accurately reported.

        Parameters:
        configuration - the configuration for the SDK
      • startSpan

        @JvmOverloads() final static Span startSpan(String name, SpanOptions options)

        Open a custom span with a given name and options.

        Parameters:
        name - the name of the custom span to open
        options - the optional configuration for the span
      • startSpan

        @JvmOverloads() final static Span startSpan(String name)

        Open a custom span with a given name and options.

        Parameters:
        name - the name of the custom span to open
      • startNetworkRequestSpan

        @JvmOverloads() final static Span startNetworkRequestSpan(URL url, String verb, SpanOptions options)

        Open a network span for a given url and HTTP verb to measure the time taken for an HTTP request.

        Parameters:
        url - the URL the returned span is measuring
        verb - the HTTP verb / method (GET, POST, PUT, etc.
        options - the optional configuration for the span
      • startNetworkRequestSpan

        @JvmOverloads() final static Span startNetworkRequestSpan(URL url, String verb)

        Open a network span for a given url and HTTP verb to measure the time taken for an HTTP request.

        Parameters:
        url - the URL the returned span is measuring
        verb - the HTTP verb / method (GET, POST, PUT, etc.
      • startNetworkRequestSpan

        @JvmOverloads() final static Span startNetworkRequestSpan(Uri uri, String verb, SpanOptions options)

        Open a network span for a given url and HTTP verb to measure the time taken for an HTTP request.

        Parameters:
        uri - the URI/URL the returned span is measuring
        verb - the HTTP verb / method (GET, POST, PUT, etc.
        options - the optional configuration for the span
      • startNetworkRequestSpan

        @JvmOverloads() final static Span startNetworkRequestSpan(Uri uri, String verb)

        Open a network span for a given url and HTTP verb to measure the time taken for an HTTP request.

        Parameters:
        uri - the URI/URL the returned span is measuring
        verb - the HTTP verb / method (GET, POST, PUT, etc.
      • startViewLoadSpan

        @JvmOverloads() final static Span startViewLoadSpan(Activity activity, SpanOptions options)

        Open a ViewLoad span to measure the time taken to load and render a UI element (typically a screen). These spans are created and measured automatically for * activities. This function can be used when the automated instrumentation is not well suited to your app.

        Parameters:
        activity - the activity load being measured
        options - the optional configuration for the span
      • startViewLoadSpan

        @JvmOverloads() final static Span startViewLoadSpan(Activity activity)

        Open a ViewLoad span to measure the time taken to load and render a UI element (typically a screen). These spans are created and measured automatically for * activities. This function can be used when the automated instrumentation is not well suited to your app.

        Parameters:
        activity - the activity load being measured
      • startViewLoadSpan

        @JvmOverloads() final static Span startViewLoadSpan(ViewType viewType, String viewName, SpanOptions options)

        Open a ViewLoad span to measure the time taken to load a specific UI element.

        Parameters:
        viewType - the type of UI element being measured
        viewName - the name (typically class name) of the UI element being measured
        options - the optional configuration for the span
      • startViewLoadSpan

        @JvmOverloads() final static Span startViewLoadSpan(ViewType viewType, String viewName)

        Open a ViewLoad span to measure the time taken to load a specific UI element.

        Parameters:
        viewType - the type of UI element being measured
        viewName - the name (typically class name) of the UI element being measured
      • endViewLoadSpan

        @JvmOverloads() final static Unit endViewLoadSpan(Activity activity, Long endTime)

        End a ViewLoad span opened with startViewLoadSpan, useful when you don't want to manually retain a reference to the Span returned. If no span is being tracked for the given Activity or the measurement has already been ended this method does nothing.

        Parameters:
        activity - the activity load being measured
        endTime - the time that the load should be considered "ended" relative to SystemClock.elapsedRealtimeNanos
      • endViewLoadSpan

        @JvmOverloads() final static Unit endViewLoadSpan(Activity activity)

        End a ViewLoad span opened with startViewLoadSpan, useful when you don't want to manually retain a reference to the Span returned. If no span is being tracked for the given Activity or the measurement has already been ended this method does nothing.

        Parameters:
        activity - the activity load being measured
      • reportApplicationClassLoaded

         final static Unit reportApplicationClassLoaded()

        Report that your apps Application class has been loaded. This can be manually called from your Application static initializer (or earlier if you have a custom AppComponentFactory) to improve the app start time measurements:

        public class MyApplication extends Application {
            static {
                BugsnagPerformance.reportApplicationClassLoaded()

        This function marks the start time of the AppStart span (if an earlier time has not already been marked), and only affects cold start times. If this function is not called manually, cold AppStart spans are opened by a ContentProvider (typically between the Application object being created, and Application.onCreate being invoked).

        Kotlin apps can use the init block of the companion object to achieve the same effect.

        This function is typically called before start (and is ignored if called after start), and can be safely called multiple times.

      • getSpanControls

         final static <C extends Any> C getSpanControls(SpanQuery<C> query)

        Attempt to retrieve the span controls for a given SpanQuery. This is used to access specialised behaviours for specific span types.

        Parameters:
        query - the span query to retrieve controls for