-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
chore: Add missing fields into Replay NetworkRequestData type #8284
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
Changes from 3 commits
13092c3
ce4889d
4db6b20
889cb13
de36842
0ec4343
dbcc440
69f73ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
import type { EventType } from '@sentry-internal/rrweb'; | ||
import type { Breadcrumb, FetchBreadcrumbData, XhrBreadcrumbData } from '@sentry/types'; | ||
|
||
import type { AllEntryData } from './performance'; | ||
import type { EventType } from './rrweb'; | ||
|
||
interface BaseReplayFrame { | ||
import type { | ||
HistoryData, | ||
LargestContentfulPaintData, | ||
MemoryData, | ||
NavigationData, | ||
NetworkRequestData, | ||
PaintData, | ||
ResourceData, | ||
} from './performance'; | ||
import type { ReplayNetworkRequestData } from './replay'; | ||
|
||
interface BaseBreadcrumbFrame { | ||
timestamp: number; | ||
/** | ||
* For compatibility reasons | ||
|
@@ -29,32 +38,32 @@ interface ConsoleFrameData { | |
logger: string; | ||
arguments?: unknown[]; | ||
} | ||
interface ConsoleFrame extends BaseReplayFrame { | ||
interface ConsoleFrame extends BaseBreadcrumbFrame { | ||
category: 'console'; | ||
level: Breadcrumb['level']; | ||
message: string; | ||
data: ConsoleFrameData; | ||
} | ||
|
||
type ClickFrameData = BaseDomFrameData; | ||
interface ClickFrame extends BaseReplayFrame { | ||
interface ClickFrame extends BaseBreadcrumbFrame { | ||
category: 'ui.click'; | ||
message: string; | ||
data: ClickFrameData; | ||
} | ||
|
||
interface FetchFrame extends BaseReplayFrame { | ||
interface FetchFrame extends BaseBreadcrumbFrame { | ||
category: 'fetch'; | ||
type: 'http'; | ||
data: FetchBreadcrumbData; | ||
} | ||
|
||
interface InputFrame extends BaseReplayFrame { | ||
interface InputFrame extends BaseBreadcrumbFrame { | ||
category: 'ui.input'; | ||
message: string; | ||
} | ||
|
||
interface XhrFrame extends BaseReplayFrame { | ||
interface XhrFrame extends BaseBreadcrumbFrame { | ||
category: 'xhr'; | ||
type: 'http'; | ||
data: XhrBreadcrumbData; | ||
|
@@ -65,7 +74,7 @@ interface MutationFrameData { | |
count: number; | ||
limit: boolean; | ||
} | ||
interface MutationFrame extends BaseReplayFrame { | ||
interface MutationFrame extends BaseBreadcrumbFrame { | ||
category: 'replay.mutations'; | ||
data: MutationFrameData; | ||
} | ||
|
@@ -77,16 +86,16 @@ interface KeyboardEventFrameData extends BaseDomFrameData { | |
altKey: boolean; | ||
key: string; | ||
} | ||
interface KeyboardEventFrame extends BaseReplayFrame { | ||
interface KeyboardEventFrame extends BaseBreadcrumbFrame { | ||
category: 'ui.keyDown'; | ||
data: KeyboardEventFrameData; | ||
} | ||
|
||
interface BlurFrame extends BaseReplayFrame { | ||
interface BlurFrame extends BaseBreadcrumbFrame { | ||
category: 'ui.blur'; | ||
} | ||
|
||
interface FocusFrame extends BaseReplayFrame { | ||
interface FocusFrame extends BaseBreadcrumbFrame { | ||
category: 'ui.focus'; | ||
} | ||
|
||
|
@@ -95,23 +104,23 @@ interface SlowClickFrameData extends ClickFrameData { | |
timeAfterClickFs: number; | ||
endReason: string; | ||
} | ||
interface SlowClickFrame extends BaseReplayFrame { | ||
interface SlowClickFrame extends BaseBreadcrumbFrame { | ||
category: 'ui.slowClickDetected'; | ||
data: SlowClickFrameData; | ||
} | ||
|
||
interface OptionFrame { | ||
sessionSampleRate: number; | ||
errorSampleRate: number; | ||
useCompressionOption: boolean; | ||
blockAllMedia: boolean; | ||
maskAllText: boolean; | ||
errorSampleRate: number; | ||
maskAllInputs: boolean; | ||
useCompression: boolean; | ||
networkDetailHasUrls: boolean; | ||
maskAllText: boolean; | ||
networkCaptureBodies: boolean; | ||
networkDetailHasUrls: boolean; | ||
networkRequestHasHeaders: boolean; | ||
networkResponseHasHeaders: boolean; | ||
sessionSampleRate: number; | ||
useCompression: boolean; | ||
useCompressionOption: boolean; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorted these fields, no changes. this object is duplicated in sentry, so i'm happy for the re-use here. |
||
|
||
export type BreadcrumbFrame = | ||
|
@@ -125,16 +134,68 @@ export type BreadcrumbFrame = | |
| FocusFrame | ||
| SlowClickFrame | ||
| MutationFrame | ||
| BaseReplayFrame; | ||
| BaseBreadcrumbFrame; | ||
|
||
export interface SpanFrame { | ||
interface BaseSpanFrame { | ||
op: string; | ||
description: string; | ||
startTimestamp: number; | ||
endTimestamp: number; | ||
data: AllEntryData; | ||
data?: undefined | Record<string, any>; | ||
} | ||
|
||
interface HistoryFrame extends BaseSpanFrame { | ||
data: HistoryData; | ||
op: 'navigation.push'; | ||
} | ||
|
||
interface LargestContentfulPaintFrame extends BaseSpanFrame { | ||
data: LargestContentfulPaintData; | ||
op: 'largest-contentful-paint'; | ||
} | ||
|
||
interface MemoryFrame extends BaseSpanFrame { | ||
data: MemoryData, | ||
op: 'memory', | ||
} | ||
|
||
interface NavigationFrame extends BaseSpanFrame { | ||
data: NavigationData | ||
op: 'navigation.navigate' | 'navigation.reload' | 'navigation.back'; | ||
ryan953 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
interface NetworkRequestFrame extends BaseSpanFrame { | ||
data: NetworkRequestData | ReplayNetworkRequestData; | ||
op: 'resource.fetch' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about xhr? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think xhr payloads are shaped like |
||
} | ||
|
||
interface PaintFrame extends BaseSpanFrame { | ||
data: PaintData; | ||
op: 'paint'; | ||
} | ||
|
||
interface ResourceFrame extends BaseSpanFrame { | ||
data: ResourceData; | ||
op: | ||
| 'resource.css' | ||
| 'resource.iframe' | ||
| 'resource.img' | ||
| 'resource.link' | ||
| 'resource.other' | ||
| 'resource.script' | ||
| 'resource.xhr'; | ||
} | ||
|
||
export type SpanFrame = | ||
| BaseSpanFrame | ||
| HistoryFrame | ||
| LargestContentfulPaintFrame | ||
| MemoryFrame | ||
| NavigationFrame | ||
| NetworkRequestFrame | ||
| PaintFrame | ||
| ResourceFrame; | ||
|
||
export type ReplayFrame = BreadcrumbFrame | SpanFrame; | ||
|
||
interface RecordingCustomEvent { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm we have this duplicated here but I forgot why... might be because our fork of rrweb, it wasn't exported? cc @mydea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took that duplicate definition out, as you saw below.
Now getsentry/sentry-javascript is importing from
'@sentry-internal/rrweb'
and getsentry/sentry will import from getsentry/sentry-javascripthopefully i can skip @sentry-internal/rrweb altogether if i've cross referenced everything correctly.