RUM Setup for Web

The Kloudfuse RUM SDK is available as a package for Web; include the Kloudfuse RUM SDK dependency in your application.

Install

To begin instrumenting your frontend application, include the Kloudfuse RUM SDK dependency in your application:

npm install --save kf-browser-sdk

Configure

You must initialize the SDK to begin gathering frontend telemetry. Make this happen as early as possible in your applications loading phase. Customize and include the following code snippet:

import kfuseRumSDK from 'kf-browser-sdk';

kfuseRumSDK.init({
  config: {
    applicationId: '<APPLICATION_ID>',
    clientToken: '<CLIENT_TOKEN>',
    proxy: '<KFUSE_RUM_ENDPOINT>',
    service: '<APPLICATION_NAME>',
    env: 'production',
    version: '1.0.0',
    sessionSampleRate: 100,
    defaultPrivacyLevel: 'mask', 'mask-user-input' | 'allow'
    enableSessionRecording: true,
    enableLogCollection: true,
  },
});
javascript

The possible configuration options are:

applicationId

A UUID that uniquely identifies a specific frontend application. All RUM telemetry will be associated with it.

clientToken

A token that identifies valid producers of RUM telemetry. You may supply the value dummy if authenticated ingestion is not enabled during Kloudfuse install. When authenticated ingestion is enabled, this value must match one of the configured authentication tokens for RUM. See our Enable Authenticated Ingestion documentation for AWS S3, Azure Blob, or Google GCS.

proxy

The Kloudfuse ingest endpoint for RUM events; its value would be https://<kfuse-public-endpoint>/ddrumproxy

service

A "friendly" name, unique to the instrumented frontend application.

env

The name that identifies a logical source of RUM events. For example, the test environment or production environment.

version

The string that represents the unique frontend application build, such as 1.0.0.

sessionSampleRate

The Percentage of user sessions that generate RUM telemetry; valid range is 0 to 100.

defaultPrivacyLevel

Privacy level for session replays. Can be one of the following three values:

mask

Masks all HTML text, user input, images, links and data-* attributes. Text on your application is replaced with X, rendering the page into a wireframe.

mask-user-input

Masks most form fields: inputs, text areas, and checkbox values, while recording all other text "as is". Inputs are replaced using three asterisks, and text areas are obfuscated using space-preserving x characters.

allow

Records everything unmasked.

enableSessionRecording

Controls whether Kloudfuse records the user’s session.

enableLogCollection

Controls whether Kloudfuse collects frontend logs.

Associate User Information

As soon as your application has access to user information, you can provide that information to the SDK and enrich all generated telemetry.

To do this, add the following code snippet:

kfuseRumSDK.setUser({
  id: "joebarra",
  email: "joe.barra@kloudfuse.com",
})
javascript