feat: Add source map images to debug_meta#7168
Conversation
size-limit report 📦
|
Replay SDK metrics 🚀
develop |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Revision | LCP | CLS | CPU | JS heap avg | JS heap max | netTx | netRx | netCount | netTime |
|---|---|---|---|---|---|---|---|---|---|
| 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 |
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; |
There was a problem hiding this comment.
Where is this _sentryDebugIds actually set? Can't find it anywhere in the codebase...?
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
I would invert this, to do an early return:
if (!debugIdMap) {
return;
}This is more readable IMHO.
There was a problem hiding this comment.
Good point. Never was a big early return person but here it makes sense.
| 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); | ||
| } | ||
| }); | ||
| } | ||
| }); | ||
| } |
There was a problem hiding this comment.
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 => { |
There was a problem hiding this comment.
l: Can this just be a single reduce call?
Sometimes you just get overruled by the principal architect. Life do be like that sometimes. |
|
Updated in relay: getsentry/relay#1869 |

Resolves #7161
Ref: getsentry/develop#836
This PR changes our current implementation that puts
debug_idonto individual stack frames to an implementation that leverages the debug meta interface on events. Each entry inimagesrepresents a mapping from a source file to a source map file.