Skip to content

SDK reference

Initializes the browser RUM SDK. options accepts the following properties:

PropertyTypeDescription
applicationNamestringThe application’s name.
endpointstring (required)KloudMate’s collector endpoint: https://otel.kloudmate.com:4318
rumAccessTokenstring (required)The workspace’s Frontend ingest key. See The ingest key.
deploymentEnvironmentstringThe application’s environment, such as dev, prod, or staging.
versionstringThe application’s version, such as 0.0.1.
globalAttributesobjectKey-value pairs added to every span.
sampleRatenumberShare of sessions that send telemetry at all, from 0 to 1. Defaults to 1.
sessionRecorderobject
{ enabled: boolean, sampleRate: number, options: RRWebRecordConfig }
Configure session recording. Set enabled to true to record. Off by default. See Record sessions for replay.
eventsobjectWhich automatic events to capture, including console output. See Choose what the SDK captures.
ignoreUrls(string | RegExp)[]URLs to skip instrumenting entirely. No span is created and no trace header is added.
propagateTraceHeaderCorsUrls(string | RegExp)[]Cross-origin URLs allowed to receive the traceparent header. See Correlate RUM traces with OpenTelemetry backends.
excludeBotsboolean | functionSkip automated and crawler traffic so it never starts a session. Defaults to true.
captureConsoleErrorsbooleanReport console.error(...) as a real error, not only as a console line. Defaults to true.
MethodDescription
setUser(user)Set the signed-in user. id and email map to the userId and userEmail attributes; any other field is added as an attribute on every span. See Identify the user.
endSession()End the session in every tab on sign-out, clearing everything setUser() set.
setGlobalAttributes(attributes)Add key-value pairs to every subsequent span. Set a key to null to remove it.
getGlobalAttributes()Return the current global attributes.
getSessionId()Return the session ID, or null between endSession() and the start of the next session.
addEvent(name, attributes)Record a custom event. See Send custom events.
recordException(error, attributes)Report a handled error that automatic capture never sees. Pass an Error to keep the stack trace, or a string.

The mobile SDKs share one KloudMateRumConfig across Android, iOS, and React Native. TypeScript definitions for the full React Native option list ship with the package.

The attributes you’re most likely to group or filter on:

AttributeDescription
serviceNameThe RUM application name.
rumSessionIdThe RUM session’s ID.
originOrigin of the instrumented app, such as https://example.com.
routePart of the app’s URL excluding origin and search.
searchSearch params of the app’s URL.
componentThe instrumentation that produced the span.
eventTypeThe type of user interaction, such as click or submit.
userIdUser’s synthetic ID.
userEmailUser’s email.
browserUser’s browser name.
browserVersionUser’s browser version.
countryUser’s country.
cityUser’s city.
osUser’s operating system.
osVersionUser’s operating system version.
deviceUser’s device.
deviceTypeUser’s device type.
screen.widthScreen width in logical pixels. Shown as Screen in session detail, and behind the Screen resolution breakdown on Overview.
screen.heightScreen height in logical pixels.
screen.densityDisplay scale factor. Shown as Screen Density when it is not 1.