Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SessionRecorder type-definitions to match their use #684

Merged
merged 2 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/session-recorder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<realm>.signalfx.com/v1/rumreplay',
realm: '<us0|us1>',
rumAccessToken: '<auth token>'
});
```
13 changes: 10 additions & 3 deletions packages/session-recorder/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ type RRWebOptions = Parameters<typeof record>[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
Expand Down Expand Up @@ -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}`;
}
Expand Down