-
public class BugsnagPerformancePrimary access to the Bugsnag Performance SDK.
-
-
Field Summary
Fields Modifier and Type Field Description private final StringVERSIONpublic final static BugsnagPerformanceINSTANCE
-
Method Summary
Modifier and Type Method Description final static Unitstart(Context context)Initialise the Bugsnag Performance SDK. final static Unitstart(Context context, String apiKey)final static Unitstart(PerformanceConfiguration configuration)Initialise the Bugsnag Performance SDK. final static SpanstartSpan(String name, SpanOptions options)Open a custom span with a given name and options. final static SpanstartSpan(String name)Open a custom span with a given name and options. final static SpanstartNetworkRequestSpan(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. final static SpanstartNetworkRequestSpan(URL url, String verb)Open a network span for a given url and HTTP verb to measure the time taken for an HTTP request. final static SpanstartNetworkRequestSpan(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. final static SpanstartNetworkRequestSpan(Uri uri, String verb)Open a network span for a given url and HTTP verb to measure the time taken for an HTTP request. final static SpanstartViewLoadSpan(Activity activity, SpanOptions options)Open a ViewLoad span to measure the time taken to load and render a UI element (typically a screen). final static SpanstartViewLoadSpan(Activity activity)Open a ViewLoad span to measure the time taken to load and render a UI element (typically a screen). final static SpanstartViewLoadSpan(ViewType viewType, String viewName, SpanOptions options)Open a ViewLoad span to measure the time taken to load a specific UI element. final static SpanstartViewLoadSpan(ViewType viewType, String viewName)Open a ViewLoad span to measure the time taken to load a specific UI element. final static UnitendViewLoadSpan(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.final static UnitendViewLoadSpan(Activity activity)End a ViewLoad span opened with startViewLoadSpan, useful when you don't want to manually retain a reference to the Span returned.final static UnitreportApplicationClassLoaded()Report that your apps Applicationclass has been loaded.final static <C extends Any> CgetSpanControls(SpanQuery<C> query)Attempt to retrieve the span controls for a given SpanQuery. final StringgetVERSION()-
-
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 AndroidContext, typically yourApplicationinstance
-
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 openoptions- 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 measuringverb- 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 measuringverb- 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 measuringverb- 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 measuringverb- 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 measuredoptions- 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 measuredviewName- the name (typically class name) of the UI element being measuredoptions- 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 measuredviewName- 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 measuredendTime- 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
Applicationclass has been loaded. This can be manually called from yourApplicationstatic initializer (or earlier if you have a customAppComponentFactory) to improve the app start time measurements:public class MyApplication extends Application { static { BugsnagPerformance.reportApplicationClassLoaded()This function marks the start time of the
AppStartspan (if an earlier time has not already been marked), and only affects cold start times. If this function is not called manually, coldAppStartspans are opened by aContentProvider(typically between theApplicationobject being created, andApplication.onCreatebeing invoked).Kotlin apps can use the
initblock of thecompanion objectto 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
-
getVERSION
final String getVERSION()
-
-
-
-