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>', site: '<SITE>', 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
: (currently unused) a token that identifies valid producers of RUM telemetry.site
: (currently unused)proxy
: the Kloudfuse ingest endpoint for RUM eventsservice
: a friendly name unique to the the frontend application being instrumentedenv
: 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
: what percentage of user session will generate RUM telemetryenableLogCollection
:
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", })