-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
chore: Add missing fields into Replay NetworkRequestData type #8284
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
13092c3
Reset
ryan953 ce4889d
refactor SpanFrame to use a base class and map op to data
ryan953 4db6b20
cleanup extra exports that are not needed
ryan953 889cb13
Replace ReplayNetworkRequestData, which has start/endTimestamp, with …
ryan953 de36842
break circular dependency
ryan953 0ec4343
prettier
ryan953 dbcc440
combine xhr and fetch request types
ryan953 69f73ee
re-export rrweb event/node types and enums
ryan953 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from './performance'; | ||
export * from './replay'; | ||
export * from './replayFrame'; | ||
export * from './request'; | ||
export * from './rrweb'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
import type { Breadcrumb, FetchBreadcrumbData, XhrBreadcrumbData } from '@sentry/types'; | ||
|
||
import type { AllEntryData } from './performance'; | ||
import type { EventType } from './rrweb'; | ||
|
||
interface BaseReplayFrame { | ||
import type { EventType } from '@sentry-internal/rrweb'; | ||
import type { Breadcrumb } from '@sentry/types'; | ||
|
||
import type { | ||
HistoryData, | ||
LargestContentfulPaintData, | ||
MemoryData, | ||
NavigationData, | ||
NetworkRequestData, | ||
PaintData, | ||
ResourceData, | ||
} from './performance'; | ||
|
||
interface BaseBreadcrumbFrame { | ||
timestamp: number; | ||
/** | ||
* For compatibility reasons | ||
|
@@ -29,43 +37,31 @@ 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 { | ||
category: 'fetch'; | ||
type: 'http'; | ||
data: FetchBreadcrumbData; | ||
} | ||
|
||
interface InputFrame extends BaseReplayFrame { | ||
interface InputFrame extends BaseBreadcrumbFrame { | ||
category: 'ui.input'; | ||
message: string; | ||
} | ||
|
||
interface XhrFrame extends BaseReplayFrame { | ||
category: 'xhr'; | ||
type: 'http'; | ||
data: XhrBreadcrumbData; | ||
} | ||
|
||
/* Breadcrumbs from Replay */ | ||
interface MutationFrameData { | ||
count: number; | ||
limit: boolean; | ||
} | ||
interface MutationFrame extends BaseReplayFrame { | ||
interface MutationFrame extends BaseBreadcrumbFrame { | ||
category: 'replay.mutations'; | ||
data: MutationFrameData; | ||
} | ||
|
@@ -77,16 +73,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,46 +91,89 @@ 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 = | ||
| ConsoleFrame | ||
| ClickFrame | ||
| FetchFrame | ||
| InputFrame | ||
| XhrFrame | ||
| KeyboardEventFrame | ||
| BlurFrame | ||
| 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_forward'; | ||
} | ||
|
||
interface PaintFrame extends BaseSpanFrame { | ||
data: PaintData; | ||
op: 'paint'; | ||
} | ||
|
||
interface RequestFrame extends BaseSpanFrame { | ||
data: NetworkRequestData; | ||
op: 'resource.fetch' | 'resource.xhr'; | ||
} | ||
|
||
interface ResourceFrame extends BaseSpanFrame { | ||
data: ResourceData; | ||
op: 'resource.css' | 'resource.iframe' | 'resource.img' | 'resource.link' | 'resource.other' | 'resource.script'; | ||
} | ||
|
||
export type SpanFrame = | ||
| BaseSpanFrame | ||
| HistoryFrame | ||
| RequestFrame | ||
| LargestContentfulPaintFrame | ||
| MemoryFrame | ||
| NavigationFrame | ||
| PaintFrame | ||
| ResourceFrame; | ||
|
||
export type ReplayFrame = BreadcrumbFrame | SpanFrame; | ||
|
||
interface RecordingCustomEvent { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
type JsonObject = Record<string, unknown>; | ||
type JsonArray = unknown[]; | ||
|
||
export type NetworkBody = JsonObject | JsonArray | string; | ||
|
||
export type NetworkMetaWarning = 'JSON_TRUNCATED' | 'TEXT_TRUNCATED' | 'INVALID_JSON' | 'URL_SKIPPED'; | ||
|
||
interface NetworkMeta { | ||
warnings?: NetworkMetaWarning[]; | ||
} | ||
|
||
export interface ReplayNetworkRequestOrResponse { | ||
size?: number; | ||
body?: NetworkBody; | ||
headers: Record<string, string>; | ||
_meta?: NetworkMeta; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
new file to prevent circular refs.