-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(profiling): Add platform to envelope item header
#18954
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| isChunkFormat?: boolean; | ||
| } | ||
|
|
||
| export function validateProfileItemHeader(header: Record<string, unknown>): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really sorry for the nitpicking here but I'm curious on your thoughts: I don't particularly like the pattern of these "validator" functions. Here's why:
- I have to jump when debugging tests to get to the actual assertions
- the stack traces when the test fails point to this validator instead of the failed test. Not ideal when the validator is used in a lot of places
Also specifically for this case: We only check that the header includes some properties but we don't assert on its entire content.
I get that the larger validateProfile helper, encapsulates a lot more assertions. Making it more justified. But for this case, with only two assertions, I'd personally avoid DRY and directly add the assertions; or even change it to just one expect(header).toEqual(...) for extra robustness.
Feel free to ignore/overrule me here :D I might be missing a reason for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used this validator function here to make sure that when testing the headers, this set of assertions is used - so not a crazy reason that would overrule your concerns :D
Yes, it would make sense to just change it to this one-line assertion. The function only makes sense for the very large chunk-testing part.
Changed it to: expect(itemHeader).toEqual({ type: 'profile_chunk', platform: 'javascript' });
Lms24
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing my review!
Adds the missing
platformin the envelope item header.Related: getsentry/sentry-docs#16135
Closes https://linear.app/getsentry/issue/JS-1540/ui-profiling-add-platform-to-profile-chunk-item-header (internal Linear)