From 964f86e4d3e109caf978043125c4618cc705c902 Mon Sep 17 00:00:00 2001 From: "Jonathan W. Zaleski" Date: Thu, 12 Oct 2023 13:16:12 -0500 Subject: [PATCH 1/2] Update `SessionRecorder` type-definitions to match their use --- packages/session-recorder/README.md | 2 +- packages/session-recorder/src/index.ts | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/session-recorder/README.md b/packages/session-recorder/README.md index 2369ab61..c8e0caf9 100644 --- a/packages/session-recorder/README.md +++ b/packages/session-recorder/README.md @@ -33,7 +33,7 @@ import SplunkSessionRecorder from '@splunk/otel-web-session-recorder' // This must be called after initializing splunk rum SplunkSessionRecorder.init({ - beaconEndpoint: 'https://rum-ingest..signalfx.com/v1/rumreplay', + realm: '', rumAccessToken: '' }); ``` diff --git a/packages/session-recorder/src/index.ts b/packages/session-recorder/src/index.ts index fe11e98a..71d2b9c4 100644 --- a/packages/session-recorder/src/index.ts +++ b/packages/session-recorder/src/index.ts @@ -31,17 +31,17 @@ type RRWebOptions = Parameters[0]; export type SplunkRumRecorderConfig = RRWebOptions & { /** Destination for the captured data */ - beaconEndpoint: string; + beaconEndpoint?: string; /** Destination for the captured data * @deprecated Use beaconEndpoint */ - beaconUrl: string; + beaconUrl?: string; /** * The name of your organization’s realm. Automatically configures beaconUrl with correct URL */ - realm: string; + realm?: string; /** * RUM authorization token for data sending. Please make sure this is a token @@ -141,10 +141,17 @@ const SplunkRumRecorder = { console.warn('Splunk Session Recorder: Realm value ignored (beaconEndpoint has been specified)'); } } + + if (!exportUrl) { + console.error('Session recorder could not determine `exportUrl`, please ensure that `realm` or `beaconEndpoint` is specified and try again'); + return; + } + const headers = {}; if (apiToken) { headers['X-SF-Token'] = apiToken; } + if (rumAccessToken) { exportUrl += `?auth=${rumAccessToken}`; } From 16450f34fdebf662933022f0d768f53f730e6b1f Mon Sep 17 00:00:00 2001 From: t2t2 Date: Mon, 16 Oct 2023 14:04:29 +0300 Subject: [PATCH 2/2] Update README.md / retrigger CI --- packages/session-recorder/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/session-recorder/README.md b/packages/session-recorder/README.md index c8e0caf9..a480a752 100644 --- a/packages/session-recorder/README.md +++ b/packages/session-recorder/README.md @@ -33,7 +33,7 @@ import SplunkSessionRecorder from '@splunk/otel-web-session-recorder' // This must be called after initializing splunk rum SplunkSessionRecorder.init({ - realm: '', + realm: '', rumAccessToken: '' }); ```