Skip to content

Commit 3d2fee7

Browse files
committed
rename to getReplayId
1 parent 5edf92b commit 3d2fee7

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

packages/replay/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ A session starts when the Session Replay SDK is first loaded and initialized. Th
140140
141141
### Accessing the Replay Session ID
142142
143-
You can get the ID of the currently running session via `replay.getSessionId()`.
143+
You can get the ID of the currently running session via `replay.getReplayId()`.
144144
This will return `undefined` if no session is ongoing.
145145
146146
### Replay Captures Only on Errors

packages/replay/src/coreHandlers/handleGlobalEvent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function handleGlobalEventListener(
3838

3939
// Only tag transactions with replayId if not waiting for an error
4040
if (isErrorEvent(event) || (isTransactionEvent(event) && replay.recordingMode === 'session')) {
41-
event.tags = { ...event.tags, replayId: replay.getSessionId() };
41+
event.tags = { ...event.tags, replayId: replay.getReplayId() };
4242
}
4343

4444
if (__DEBUG_BUILD__ && replay.getOptions()._experiments.traceInternals && isErrorEvent(event)) {

packages/replay/src/integration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,12 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
229229
/**
230230
* Get the current session ID.
231231
*/
232-
public getSessionId(): string | undefined {
232+
public getReplayId(): string | undefined {
233233
if (!this._replay || !this._replay.isEnabled()) {
234234
return;
235235
}
236236

237-
return this._replay.getSessionId();
237+
return this._replay.getReplayId();
238238
}
239239

240240
/** Setup the integration. */

packages/replay/src/replay.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ export class ReplayContainer implements ReplayContainerInterface {
359359
}
360360

361361
/** Get the current sesion (=replay) ID */
362-
public getSessionId(): string | undefined {
362+
public getReplayId(): string | undefined {
363363
return this.session && this.session.id;
364364
}
365365

@@ -372,7 +372,7 @@ export class ReplayContainer implements ReplayContainerInterface {
372372
* @hidden
373373
*/
374374
public checkAndHandleExpiredSession(): boolean | void {
375-
const oldSessionId = this.getSessionId();
375+
const oldSessionId = this.getReplayId();
376376

377377
// Prevent starting a new session if the last user activity is older than
378378
// SESSION_IDLE_DURATION. Otherwise non-user activity can trigger a new
@@ -399,7 +399,7 @@ export class ReplayContainer implements ReplayContainerInterface {
399399
}
400400

401401
// Session was expired if session ids do not match
402-
const expired = oldSessionId !== this.getSessionId();
402+
const expired = oldSessionId !== this.getReplayId();
403403

404404
if (!expired) {
405405
return true;
@@ -458,7 +458,7 @@ export class ReplayContainer implements ReplayContainerInterface {
458458
this.setInitialState();
459459
}
460460

461-
const currentSessionId = this.getSessionId();
461+
const currentSessionId = this.getReplayId();
462462
if (session.id !== currentSessionId) {
463463
session.previousSessionId = currentSessionId;
464464
}

packages/replay/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ export interface ReplayContainer {
445445
triggerUserActivity(): void;
446446
addUpdate(cb: AddUpdateCallback): void;
447447
getOptions(): ReplayPluginOptions;
448-
getSessionId(): string | undefined;
448+
getReplayId(): string | undefined;
449449
checkAndHandleExpiredSession(): boolean | void;
450450
setInitialState(): void;
451451
}

packages/replay/src/util/addGlobalListeners.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function addGlobalListeners(replay: ReplayContainer): void {
3434
if (hasHooks(client)) {
3535
client.on('afterSendEvent', handleAfterSendEvent(replay));
3636
client.on('createDsc', (dsc: DynamicSamplingContext) => {
37-
const replayId = replay.getSessionId();
37+
const replayId = replay.getReplayId();
3838
if (replayId) {
3939
dsc.replay_id = replayId;
4040
}

packages/replay/test/integration/getSessionId.test.ts renamed to packages/replay/test/integration/getReplayId.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useFakeTimers } from '../utils/use-fake-timers';
33

44
useFakeTimers();
55

6-
describe('Integration | getSessionId', () => {
6+
describe('Integration | getReplayId', () => {
77
afterEach(() => {
88
jest.clearAllMocks();
99
});
@@ -15,12 +15,12 @@ describe('Integration | getSessionId', () => {
1515
},
1616
});
1717

18-
expect(integration.getSessionId()).toBeDefined();
19-
expect(integration.getSessionId()).toEqual(replay.session?.id);
18+
expect(integration.getReplayId()).toBeDefined();
19+
expect(integration.getReplayId()).toEqual(replay.session?.id);
2020

2121
// When stopped, it is undefined
2222
integration.stop();
2323

24-
expect(integration.getSessionId()).toBeUndefined();
24+
expect(integration.getReplayId()).toBeUndefined();
2525
});
2626
});

0 commit comments

Comments
 (0)