Skip to content

feat: Add source map images to debug_meta - #7168

Merged
lforst merged 16 commits into
developfrom
lforst-sourcemap-debug-meta
Feb 23, 2023
Merged

feat: Add source map images to debug_meta#7168
lforst merged 16 commits into
developfrom
lforst-sourcemap-debug-meta

Conversation

@lforst

Copy link
Copy Markdown
Contributor

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

github-actionsBot commented Feb 13, 2023

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
@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 developFebruary 14, 2023 08:53
@github-actions

github-actionsBot commented Feb 14, 2023

Copy link
Copy Markdown
Contributor

Replay SDK metrics 🚀

Plain+Sentry+Replay
RevisionValueValueDiffRatioValueDiffRatio
LCPThis PR f8047f672.23 ms94.84 ms+22.61 ms+31.30 %126.23 ms+54.00 ms+74.75 %
Previous e9eec2767.47 ms102.63 ms+35.17 ms+52.13 %128.85 ms+61.38 ms+90.98 %
CLSThis PR f8047f60.06 ms0.06 ms+0.00 ms+0.02 %0.06 ms+0.00 ms+0.10 %
Previous e9eec270.06 ms0.06 ms+0.00 ms+0.07 %0.06 ms-0.00 ms-0.33 %
CPUThis PR f8047f614.10 %14.83 %+0.73 pp+5.17 %20.34 %+6.23 pp+44.20 %
Previous e9eec2719.40 %19.02 %-0.37 pp-1.92 %25.44 %+6.04 pp+31.16 %
JS heap avgThis PR f8047f61.94 MB1.99 MB+48.6 kB+2.50 %2.87 MB+924.07 kB+47.55 %
Previous e9eec271.94 MB1.99 MB+45.82 kB+2.36 %2.87 MB+927.84 kB+47.75 %
JS heap maxThis PR f8047f62.3 MB2.58 MB+280.68 kB+12.19 %3.36 MB+1.05 MB+45.76 %
Previous e9eec272.3 MB2.55 MB+249.12 kB+10.82 %3.35 MB+1.05 MB+45.46 %
netTxThis PR f8047f60 B0 B0 Bn/a2.22 kB+2.22 kBn/a
Previous e9eec270 B0 B0 Bn/a2.21 kB+2.21 kBn/a
netRxThis PR f8047f60 B0 B0 Bn/a41 B+41 Bn/a
Previous e9eec270 B0 B0 Bn/a41 B+41 Bn/a
netCountThis PR f8047f6000n/a1+1n/a
Previous e9eec27000n/a1+1n/a
netTimeThis PR f8047f60.00 ms0.00 ms0.00 msn/a78.28 ms+78.28 msn/a
Previous e9eec270.00 ms0.00 ms0.00 msn/a88.58 ms+88.58 msn/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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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.

@AbhiPrasadAbhiPrasad left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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
Copy Markdown
ContributorAuthor

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
Copy Markdown
ContributorAuthor

Updated in relay: getsentry/relay#1869

@lforst
lforst merged commit e4d3146 into developFeb 23, 2023
@lforst
lforst deleted the lforst-sourcemap-debug-meta branch February 23, 2023 10:35
Sign up for freeto 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

@lforst@mydea@AbhiPrasad