Setup

The Kloudfuse RUM SDK is available as a package on npm. To get started instrumenting your frontend application include the Kloudfuse RUM SDK dependency in your application:

npm install --save kf-rum-sdk

The SDK needs to be initialized before it begins gathering frontend telemetry. This initialization should occur as early as possible in your applications loading phase. Customize and include the below code snippet:

import kfuseRumSDK from 'kf-browser-sdk'; kfuseRumSDK.init({ applicationId: '<APPLICATION_ID>', clientToken: '<CLIENT_TOKEN>', proxy: '<KFUSE_RUM_ENDPOINT>', service: '<APPLICATION_NAME>', env: 'production', version: '1.0.0', sessionSampleRate: 100, enableSessionRecording: true, enableLogCollection: true, });

The permitted configuration options are documented below:

  • 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 (it is currently used so you may supply the value dummy here)

  • proxy: the Kloudfuse ingest endpoint for RUM events. Its value would be https://<kfuse-public-endpoint>/ddrumproxy

  • service: a friendly name unique to the the frontend application being instrumented

  • env: a name identifying a logical source of RUM events (e.g. test environment or production environment)

  • version: a string representing the unique frontend application build (e.g. 1.0.0)

  • sessionSampleRate: percentage of user sessions that will generate RUM telemetry (0 to 100)

  • enableSessionRecording: controls whether the users session will be recorded

  • enableLogCollection: controls whether frontend logs will be collected or not

Associating User Information

As soon as your application has access to user information you may provide that information to the SDK to enrich all generated telemetry. To do this add the following code snippet:

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