Skip to content

Commit 063e339

Browse files
committed
feat(core): Add replay_event type for events
1 parent b674c26 commit 063e339

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

packages/core/src/hub.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export class Hub implements HubInterface {
233233
*/
234234
public captureEvent(event: Event, hint?: EventHint): string {
235235
const eventId = hint && hint.event_id ? hint.event_id : uuid4();
236-
if (event.type !== 'transaction') {
236+
if (!event.type) {
237237
this._lastEventId = eventId;
238238
}
239239

packages/replay/src/coreHandlers/handleGlobalEvent.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ import { isRrwebError } from '../util/isRrwebError';
1212
export function handleGlobalEventListener(replay: ReplayContainer): (event: Event) => Event | null {
1313
return (event: Event) => {
1414
// Do not apply replayId to the root event
15-
if (
16-
// @ts-ignore new event type
17-
event.type === REPLAY_EVENT_NAME
18-
) {
15+
if (event.type === REPLAY_EVENT_NAME) {
1916
// Replays have separate set of breadcrumbs, do not include breadcrumbs
2017
// from core SDK
2118
delete event.breadcrumbs;
@@ -31,7 +28,7 @@ export function handleGlobalEventListener(replay: ReplayContainer): (event: Even
3128

3229
// Only tag transactions with replayId if not waiting for an error
3330
// @ts-ignore private
34-
if (event.type !== 'transaction' || replay.recordingMode === 'session') {
31+
if (!event.type || replay.recordingMode === 'session') {
3532
event.tags = { ...event.tags, replayId: replay.session?.id };
3633
}
3734

packages/types/src/event.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export interface Event {
6363
* Note that `ErrorEvent`s do not have a type (hence its undefined),
6464
* while all other events are required to have one.
6565
*/
66-
export type EventType = 'transaction' | 'profile' | undefined;
66+
export type EventType = 'transaction' | 'profile' | 'replay_event' | undefined;
6767

6868
export interface ErrorEvent extends Event {
6969
type: undefined;

0 commit comments

Comments
 (0)