diff --git a/packages/replay/src/replay.ts b/packages/replay/src/replay.ts index 612bf5a71c10..3f4761c4ccab 100644 --- a/packages/replay/src/replay.ts +++ b/packages/replay/src/replay.ts @@ -895,6 +895,7 @@ export class ReplayContainer implements ReplayContainerInterface { segmentId: segment_id, includeReplayStartTimestamp, eventContext, + timestamp = new Date().getTime(), }: SendReplay): Promise { const recordingData = createRecordingData({ events, @@ -905,8 +906,6 @@ export class ReplayContainer implements ReplayContainerInterface { const { urls, errorIds, traceIds, initialTimestamp } = eventContext; - const currentTimestamp = new Date().getTime(); - const hub = getCurrentHub(); const client = hub.getClient(); const scope = hub.getScope(); @@ -921,7 +920,7 @@ export class ReplayContainer implements ReplayContainerInterface { // @ts-ignore private api type: REPLAY_EVENT_NAME, ...(includeReplayStartTimestamp ? { replay_start_timestamp: initialTimestamp / 1000 } : {}), - timestamp: currentTimestamp / 1000, + timestamp: timestamp / 1000, error_ids: errorIds, trace_ids: traceIds, urls, diff --git a/packages/replay/src/types.ts b/packages/replay/src/types.ts index 029bd109c31f..0c05bdeaabcf 100644 --- a/packages/replay/src/types.ts +++ b/packages/replay/src/types.ts @@ -15,6 +15,7 @@ export interface SendReplay { segmentId: number; includeReplayStartTimestamp: boolean; eventContext: PopEventContext; + timestamp?: number; } export type InstrumentationTypeBreadcrumb = 'dom' | 'scope';