feat(protocol): Add new frame fields for metric kit flamegraphs#5539
feat(protocol): Add new frame fields for metric kit flamegraphs#5539noahsmartin merged 2 commits intomasterfrom
Conversation
d55d573 to
3a1981c
Compare
Dav1dde
left a comment
There was a problem hiding this comment.
Would be good if you can also add a small changelog message.
jjbayer
left a comment
There was a problem hiding this comment.
I believe this should this go into FrameData: "Auxiliary information about the frame that is platform specific."
relay/relay-event-schema/src/protocol/stacktrace.rs
Lines 132 to 135 in 3a1981c
|
My previous comment might be wrong, the doc on relay/relay-event-schema/src/protocol/stacktrace.rs Lines 209 to 211 in 3a1981c |
3a1981c to
eb9b029
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
|
|
||
| /// The number of times this frame was sampled, used for flamegraphs provided by iOS. | ||
| #[metastructure(skip_serialization = "null")] | ||
| pub sample_count: Annotated<u64>, |
There was a problem hiding this comment.
Frame indices break after stacktrace trimming
Medium Severity
parent_index encodes positional relationships within stacktrace.frames, but existing normalization/trimming logic can remove frames from the middle of the list. After trimming, parent_index can point at the wrong frame or a removed one, breaking MetricKit flamegraph reconstruction and potentially causing downstream consumers to error.


MetricKit provides app hang data on iOS which the cocoa SDK reports as an event. However, the stacktrace metric kit provides is really a "call stack tree" each node has a sample count and a parent. The best way to visualize it is a flamegraph, so this PR adds the relevant fields to relay allowing us to show the flamegraph on the issue detail page.
It doesn't look that useful yet because the frames are not symbolicated when I run it locally, but once this is merged I'll be able to run it on prod data with the frontend updates to see a symbolicated flamegraph:

Another way of doing this that I considered when chatting with @jan-auer was to include this in the frame
databut I tried that and it didn't seem like the fields in data were preserved. This seems to work well though, and IMO is a bit cleaner than just throwing it indata.WIP Frontend PR: getsentry/sentry#106412
WIP SDK PR: getsentry/sentry-cocoa#7185