Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from '@playwright/test';
import type { Event } from '@sentry/types';
import type { SerializedEvent } from '@sentry/types';

import { sentryTest } from '../../../../utils/fixtures';
import { getMultipleSentryEnvelopeRequests, shouldSkipTracingTest } from '../../../../utils/helpers';
Expand All @@ -23,7 +23,7 @@ sentryTest('should create fetch spans with http timing @firefox', async ({ brows

const url = await getLocalTestPath({ testDir: __dirname });

const envelopes = await getMultipleSentryEnvelopeRequests<Event>(page, 2, { url, timeout: 10000 });
const envelopes = await getMultipleSentryEnvelopeRequests<SerializedEvent>(page, 2, { url, timeout: 10000 });
const tracingEvent = envelopes[envelopes.length - 1]; // last envelope contains tracing data on all browsers

const requestSpans = tracingEvent.spans?.filter(({ op }) => op === 'http.client');
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/envelope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ type CheckInItemHeaders = { type: 'check_in' };
type StatsdItemHeaders = { type: 'statsd'; length: number };
type ProfileItemHeaders = { type: 'profile' };

// TODO (v8): Replace `Event` with `SerializedEvent`
export type EventItem = BaseEnvelopeItem<EventItemHeaders, Event>;
export type AttachmentItem = BaseEnvelopeItem<AttachmentItemHeaders, string | Uint8Array>;
export type UserFeedbackItem = BaseEnvelopeItem<UserFeedbackItemHeaders, UserFeedback>;
Expand Down
13 changes: 12 additions & 1 deletion packages/types/src/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { Request } from './request';
import type { CaptureContext } from './scope';
import type { SdkInfo } from './sdkinfo';
import type { Severity, SeverityLevel } from './severity';
import type { Span } from './span';
import type { Span, SpanJSON } from './span';
import type { Thread } from './thread';
import type { TransactionSource } from './transaction';
import type { User } from './user';
Expand Down Expand Up @@ -86,3 +86,14 @@ export interface EventHint {
data?: any;
integrations?: string[];
}

/**
* Represents the event that's sent in an event envelope, omitting interfaces that are no longer representative after
* event serialization.
*/
export interface SerializedEvent extends Omit<Event, 'spans'> {
/**
* POJO objects of spans belonging to this event.
*/
spans?: SpanJSON[];
}
2 changes: 1 addition & 1 deletion packages/types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export type {
ProfileItem,
} from './envelope';
export type { ExtendedError } from './error';
export type { Event, EventHint, EventType, ErrorEvent, TransactionEvent } from './event';
export type { Event, EventHint, EventType, ErrorEvent, TransactionEvent, SerializedEvent } from './event';
export type { EventProcessor } from './eventprocessor';
export type { Exception } from './exception';
export type { Extra, Extras } from './extra';
Expand Down