Skip to content
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

feat: Add source map images to debug_meta #7168

Merged
merged 16 commits into from Feb 23, 2023
Merged

Conversation

lforst
Copy link
Member

@lforst lforst commented Feb 13, 2023

Resolves #7161
Ref: getsentry/develop#836

This PR changes our current implementation that puts debug_id onto individual stack frames to an implementation that leverages the debug meta interface on events. Each entry in images represents a mapping from a source file to a source map file.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.13 KB (+0.19% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 62.42 KB (+0.31% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.77 KB (+0.28% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 55.56 KB (+0.35% 🔺)
@sentry/browser - Webpack (gzipped + minified) 20.5 KB (+0.31% 🔺)
@sentry/browser - Webpack (minified) 67 KB (+0.28% 🔺)
@sentry/react - Webpack (gzipped + minified) 20.53 KB (+0.31% 🔺)
@sentry/nextjs Client - Webpack (gzipped + minified) 47.97 KB (+0.14% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 27.08 KB (+0.2% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.33 KB (+0.16% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 42.67 KB (+0.38% 🔺)
@sentry/replay - Webpack (gzipped + minified) 36.67 KB (0%)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 60.27 KB (+0.07% 🔺)
@sentry/browser + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 53.82 KB (+0.1% 🔺)

Base automatically changed from lforst-put-abspath-in-stackframe to develop February 14, 2023 08:53
@github-actions
Copy link
Contributor

github-actions bot commented Feb 14, 2023

Replay SDK metrics 🚀

    Plain +Sentry +Replay
Revision Value Value Diff Ratio Value Diff Ratio
LCP This PR f8047f6 72.23 ms 94.84 ms +22.61 ms +31.30 % 126.23 ms +54.00 ms +74.75 %
Previous e9eec27 67.47 ms 102.63 ms +35.17 ms +52.13 % 128.85 ms +61.38 ms +90.98 %
CLS This PR f8047f6 0.06 ms 0.06 ms +0.00 ms +0.02 % 0.06 ms +0.00 ms +0.10 %
Previous e9eec27 0.06 ms 0.06 ms +0.00 ms +0.07 % 0.06 ms -0.00 ms -0.33 %
CPU This PR f8047f6 14.10 % 14.83 % +0.73 pp +5.17 % 20.34 % +6.23 pp +44.20 %
Previous e9eec27 19.40 % 19.02 % -0.37 pp -1.92 % 25.44 % +6.04 pp +31.16 %
JS heap avg This PR f8047f6 1.94 MB 1.99 MB +48.6 kB +2.50 % 2.87 MB +924.07 kB +47.55 %
Previous e9eec27 1.94 MB 1.99 MB +45.82 kB +2.36 % 2.87 MB +927.84 kB +47.75 %
JS heap max This PR f8047f6 2.3 MB 2.58 MB +280.68 kB +12.19 % 3.36 MB +1.05 MB +45.76 %
Previous e9eec27 2.3 MB 2.55 MB +249.12 kB +10.82 % 3.35 MB +1.05 MB +45.46 %
netTx This PR f8047f6 0 B 0 B 0 B n/a 2.22 kB +2.22 kB n/a
Previous e9eec27 0 B 0 B 0 B n/a 2.21 kB +2.21 kB n/a
netRx This PR f8047f6 0 B 0 B 0 B n/a 41 B +41 B n/a
Previous e9eec27 0 B 0 B 0 B n/a 41 B +41 B n/a
netCount This PR f8047f6 0 0 0 n/a 1 +1 n/a
Previous e9eec27 0 0 0 n/a 1 +1 n/a
netTime This PR f8047f6 0.00 ms 0.00 ms 0.00 ms n/a 78.28 ms +78.28 ms n/a
Previous e9eec27 0.00 ms 0.00 ms 0.00 ms n/a 88.58 ms +88.58 ms n/a

Previous results on branch: develop

RevisionLCPCLSCPUJS heap avgJS heap maxnetTxnetRxnetCountnetTime
e9eec27+61.38 ms-0.00 ms+6.04 pp+927.84 kB+1.05 MB+2.21 kB+41 B+1+88.58 ms
d604022+58.83 ms-0.00 ms+7.65 pp+930.16 kB+1.05 MB+2.21 kB+41 B+1+109.63 ms
a961e57+54.75 ms-0.00 ms+6.50 pp+929.18 kB+1.07 MB+2.21 kB+41 B+1+92.73 ms
f7c0a2f+46.14 ms+0.00 ms+6.37 pp+921.47 kB+1.06 MB+2.23 kB+41 B+1+207.30 ms
cb19818+57.16 ms+0.00 ms+11.95 pp+1.07 MB+2.21 MB+2.52 kB+41 B+1+111.50 ms
ee301c3+71.07 ms-0.00 ms+12.64 pp+1.07 MB+2.22 MB+2.55 kB+41 B+1+94.67 ms
93c4759+61.10 ms-0.00 ms+12.72 pp+1.08 MB+2.19 MB+2.57 kB+41 B+1+116.75 ms
274f489+63.60 ms-0.00 ms+11.56 pp+1.08 MB+2.2 MB+2.56 kB+41 B+1+116.60 ms
4827b60+58.67 ms+0.00 ms+18.38 pp+1.07 MB+2.22 MB+2.6 kB+41 B+1+91.21 ms
c3806eb+79.85 ms-0.00 ms+12.10 pp+1.05 MB+2.16 MB+2.54 kB+41 B+1+93.58 ms

*) pp - percentage points - an absolute difference between two percentages.
Last updated: Tue, 14 Feb 2023 10:39:37 GMT

* Applies debug metadata images to the event in order to apply source maps by looking up their debug ID.
*/
export function applyDebugMetadata(event: Event, stackParser: StackParser): void {
const debugIdMap = GLOBAL_OBJ._sentryDebugIds;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this _sentryDebugIds actually set? Can't find it anywhere in the codebase...?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I should definitely add a comment explaining this --> 485b981

*/
export function applyDebugMetadata(event: Event, stackParser: StackParser): void {
const debugIdMap = GLOBAL_OBJ._sentryDebugIds;
if (debugIdMap) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would invert this, to do an early return:

if (!debugIdMap) {
  return;
}

This is more readable IMHO.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Never was a big early return person but here it makes sense.

Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can go with the debug meta approach

crying cat thumbs up

And I think unit test is fine, no need to think more about possible validation

Comment on lines 139 to 150
const errorAbsPaths = new Set<string>();
if (event && event.exception && event.exception.values) {
event.exception.values.forEach(exception => {
if (exception.stacktrace && exception.stacktrace.frames) {
exception.stacktrace.frames.forEach(frame => {
if (frame.abs_path) {
errorAbsPaths.add(frame.abs_path);
}
});
}
});
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: if we try catch this we can get rid of all the undefined checks ^^


// Build a map of abs_path -> debug_id
const absPathDebugIdMap: Record<string, string> = {};
Object.keys(debugIdMap).forEach(debugIdStackTrace => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: Can this just be a single reduce call?

@lforst
Copy link
Member Author

lforst commented Feb 14, 2023

I guess we can go with the debug meta approach

Sometimes you just get overruled by the principal architect. Life do be like that sometimes.

@lforst
Copy link
Member Author

lforst commented Feb 23, 2023

Updated in relay: getsentry/relay#1869

@lforst lforst merged commit e4d3146 into develop Feb 23, 2023
@lforst lforst deleted the lforst-sourcemap-debug-meta branch February 23, 2023 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rethink where to put debug_id in event Payload
3 participants