Skip to content

RumConfiguration.Builder

Xavier F. Gouchet edited this page Sep 4, 2024 · 1 revision

class Builder(applicationId: String)

A Builder class for a RumConfiguration.

Parameters

applicationId your applicationId for RUM events

Constructors

Builder

constructor(applicationId: String)

Parameters
applicationId your applicationId for RUM events

Functions

build

fun build(): RumConfiguration

Builds a RumConfiguration based on the current state of this Builder.

disableUserInteractionTracking

fun disableUserInteractionTracking(): RumConfiguration.Builder

Disable the user interaction automatic tracker.

setActionEventMapper

fun setActionEventMapper(eventMapper: EventMapper<ActionEvent>): RumConfiguration.Builder

Sets the EventMapper for the RUM ActionEvent. You can use this interface implementation to modify the ActionEvent attributes before serialisation.

Parameters
eventMapper the EventMapper implementation.

setErrorEventMapper

fun setErrorEventMapper(eventMapper: EventMapper<ErrorEvent>): RumConfiguration.Builder

Sets the EventMapper for the RUM ErrorEvent. You can use this interface implementation to modify the ErrorEvent attributes before serialisation.

Parameters
eventMapper the EventMapper implementation.

setLongTaskEventMapper

fun setLongTaskEventMapper(eventMapper: EventMapper<LongTaskEvent>): RumConfiguration.Builder

Sets the EventMapper for the RUM LongTaskEvent. You can use this interface implementation to modify the LongTaskEvent attributes before serialisation.

Parameters
eventMapper the EventMapper implementation.

setResourceEventMapper

fun setResourceEventMapper(eventMapper: EventMapper<ResourceEvent>): RumConfiguration.Builder

Sets the EventMapper for the RUM ResourceEvent. You can use this interface implementation to modify the ResourceEvent attributes before serialisation.

Parameters
eventMapper the EventMapper implementation.

setSessionListener

fun setSessionListener(sessionListener: RumSessionListener): RumConfiguration.Builder

Sets the Session listener.

Parameters
sessionListener the listener to notify whenever a new Session starts.

setSessionSampleRate

fun setSessionSampleRate(@FloatRange(from = 0.0, to = 100.0)sampleRate: Float): RumConfiguration.Builder

Sets the sample rate for RUM Sessions.

Parameters
sampleRate the sample rate must be a value between 0 and 100. A value of 0 means no RUM event will be sent, 100 means all sessions will be kept.

setTelemetrySampleRate

fun setTelemetrySampleRate(@FloatRange(from = 0.0, to = 100.0)sampleRate: Float): RumConfiguration.Builder

Sets the sample rate for Internal Telemetry (info related to the work of the SDK internals). Default value is 20.

Parameters
sampleRate the sample rate must be a value between 0 and 100. A value of 0 means no telemetry will be sent, 100 means all telemetry will be kept.

setViewEventMapper

fun setViewEventMapper(eventMapper: ViewEventMapper): RumConfiguration.Builder

Sets the ViewEventMapper for the RUM ViewEvent. You can use this interface implementation to modify the ViewEvent attributes before serialisation.

Parameters
eventMapper the ViewEventMapper implementation.

setVitalsUpdateFrequency

fun setVitalsUpdateFrequency(frequency: VitalsUpdateFrequency): RumConfiguration.Builder

Allows to specify the frequency at which to update the mobile vitals data provided in the RUM ViewEvent.

Parameters
frequency as VitalsUpdateFrequency
See also
VitalsUpdateFrequency

trackBackgroundEvents

fun trackBackgroundEvents(enabled: Boolean): RumConfiguration.Builder

Enables/Disables tracking RUM event when no Activity is in foreground.

By default, background events are not tracked. Enabling this feature might increase the number of sessions tracked and impact your billing.

Parameters
enabled whether background events should be tracked in RUM.

trackFrustrations

fun trackFrustrations(enabled: Boolean): RumConfiguration.Builder

Enables/Disables tracking of frustration signals.

By default frustration signals are tracked. Currently the SDK supports detecting error taps which occur when an error follows a user action tap.

Parameters
enabled whether frustration signals should be tracked in RUM.

trackLongTasks

@JvmOverloads

fun trackLongTasks(longTaskThresholdMs: Long = RumFeature.DEFAULT_LONG_TASK_THRESHOLD_MS): RumConfiguration.Builder

Enable long operations on the main thread to be tracked automatically. Any long running operation on the main thread will appear as Long Tasks in Datadog RUM Explorer

Parameters
longTaskThresholdMs the threshold in milliseconds above which a task running on the Main thread Looper is considered as a long task (default 100ms). Setting a value less than or equal to 0 disables the long task tracking

trackNonFatalAnrs

fun trackNonFatalAnrs(enabled: Boolean): RumConfiguration.Builder

Enable tracking of non-fatal ANRs. This is enabled by default on Android API 29 and below, and disabled by default on Android API 30 and above. Android API 30+ has a capability to report fatal ANRs (always enabled). Please note, that tracking non-fatal ANRs is using Watchdog thread approach, which can be noisy, and also leads to ANR duplication on Android 30+ if fatal ANR happened, because Watchdog thread approach cannot categorize ANR as fatal or non-fatal.

Parameters
enabled whether tracking of non-fatal ANRs is enabled or not.

trackUserInteractions

@JvmOverloads

fun trackUserInteractions(touchTargetExtraAttributesProviders: Array<ViewAttributesProvider> = emptyArray(), interactionPredicate: InteractionPredicate = NoOpInteractionPredicate()): RumConfiguration.Builder

Enable the user interaction automatic tracker. By enabling this feature the SDK will intercept UI interaction events (e.g.: taps, scrolls, swipes) and automatically send those as RUM UserActions for you.

Parameters
touchTargetExtraAttributesProviders an array with your own implementation of the target attributes provider.
interactionPredicate an interface to provide custom values for the actions events properties.
See also
ViewAttributesProvider
InteractionPredicate

useCustomEndpoint

fun useCustomEndpoint(endpoint: String): RumConfiguration.Builder

Let the RUM feature target a custom server.

useViewTrackingStrategy

fun useViewTrackingStrategy(strategy: ViewTrackingStrategy?): RumConfiguration.Builder

Sets the automatic view tracking strategy used by the SDK. By default ActivityViewTrackingStrategy will be used.

Parameters
strategy as the ViewTrackingStrategy Note: If null is passed, the RUM Monitor will let you handle View events manually. This means that you should call RumMonitor.startView and RumMonitor.stopView yourself. A view should be started when it becomes visible and interactive (equivalent to onResume) and be stopped when it's paused (equivalent to onPause).
See also
ActivityViewTrackingStrategy
FragmentViewTrackingStrategy
MixedViewTrackingStrategy
NavigationViewTrackingStrategy
Clone this wiki locally