Skip to content

Commit 9553dcb

Browse files
committed
track when a special stack trace symbolication occurs
1 parent 8ca201f commit 9553dcb

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

front_end/core/host/RNPerfMetrics.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,15 @@ class RNPerfMetrics {
270270
});
271271
}
272272

273+
stackTraceSymbolicationSucceeded(specialHermesFrameTypes: string[]): void {
274+
this.sendEvent({
275+
eventName: 'StackTraceSymbolicationSucceeded',
276+
params: {
277+
specialHermesFrameTypes,
278+
},
279+
});
280+
}
281+
273282
panelShown(_panelName: string, _isLaunching?: boolean): void {
274283
// no-op
275284
// We only care about the "main" and "drawer" panels for now via panelShownInLocation(…)
@@ -443,10 +452,18 @@ export type StackTraceSymbolicationFailed = Readonly<{
443452
}>,
444453
}>;
445454

455+
export type StackTraceSymbolicationSucceeded = Readonly<{
456+
eventName: 'StackTraceSymbolicationSucceeded',
457+
params: Readonly<{
458+
specialHermesFrameTypes: string[],
459+
}>,
460+
}>;
461+
446462
export type ReactNativeChromeDevToolsEvent =
447463
EntrypointLoadingStartedEvent|EntrypointLoadingFinishedEvent|DebuggerReadyEvent|BrowserVisibilityChangeEvent|
448464
BrowserErrorEvent|RemoteDebuggingTerminatedEvent|DeveloperResourceLoadingStartedEvent|
449465
DeveloperResourceLoadingFinishedEvent|FuseboxSetClientMetadataStartedEvent|FuseboxSetClientMetadataFinishedEvent|
450-
MemoryPanelActionStartedEvent|MemoryPanelActionFinishedEvent|PanelShownEvent|PanelClosedEvent|StackTraceSymbolicationFailed;
466+
MemoryPanelActionStartedEvent|MemoryPanelActionFinishedEvent|PanelShownEvent|PanelClosedEvent|
467+
StackTraceSymbolicationFailed|StackTraceSymbolicationSucceeded;
451468

452469
export type DecoratedReactNativeChromeDevToolsEvent = CommonEventFields&ReactNativeChromeDevToolsEvent;

front_end/panels/console/ErrorStackParser.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ export function parseSourcePositionsFromErrorStack(
5959

6060
const lines = stack.split('\n');
6161
const linkInfos = [];
62+
const specialHermesFramesParsed = new Set<SpecialHermesStackTraceFrameTypes>();
63+
6264
for (const line of lines) {
6365
const match = /^\s*at\s(async\s)?/.exec(line);
6466
if (!match) {
@@ -100,6 +102,9 @@ export function parseSourcePositionsFromErrorStack(
100102
const splitResult = Common.ParsedURL.ParsedURL.splitLineAndColumn(linkCandidate);
101103
const specialHermesFrameType = getSpecialHermesStackTraceFrameType(splitResult);
102104
if (splitResult.url === '<anonymous>' || specialHermesFrameType !== null) {
105+
if (specialHermesFrameType !== null) {
106+
specialHermesFramesParsed.add(specialHermesFrameType);
107+
}
103108
if (linkInfos.length && linkInfos[linkInfos.length - 1].isCallFrame && !linkInfos[linkInfos.length - 1].link) {
104109
// Combine builtin frames.
105110
linkInfos[linkInfos.length - 1].line += `\n${line}`;
@@ -130,6 +135,11 @@ export function parseSourcePositionsFromErrorStack(
130135
},
131136
});
132137
}
138+
139+
if (linkInfos?.length) {
140+
Host.rnPerfMetrics.stackTraceSymbolicationSucceeded(Array.from(specialHermesFramesParsed));
141+
}
142+
133143
return linkInfos;
134144
}
135145

0 commit comments

Comments
 (0)