Skip to content

Conversation

@rbro112
Copy link
Member

@rbro112 rbro112 commented Dec 16, 2025

Adds Xray diff to size comparison page. Implements the treemap diff client-side leveraging diff_items, allowing us to never be tied to backend comparison for this, which should allow us to easily iterate on this in the future.

Screenshot 2025-12-16 at 9 35 28 AM

Resolves EME-207

@rbro112 rbro112 requested a review from a team as a code owner December 16, 2025 02:08
Copy link
Member Author

rbro112 commented Dec 16, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added Scope: Frontend Automatically applied to PRs that change frontend components Scope: Backend Automatically applied to PRs that change backend components labels Dec 16, 2025
@github-actions
Copy link
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##           master   #105016       +/-   ##
============================================
- Coverage   80.28%    58.17%   -22.11%     
============================================
  Files        9397      9273      -124     
  Lines      403677    400242     -3435     
  Branches    25925     25924        -1     
============================================
- Hits       324073    232825    -91248     
- Misses      79164    166977    +87813     
  Partials      440       440               

Comment on lines +164 to +115
// Determine the diff type based on the aggregated size diff
if (totalSizeDiff > 0) {
node.diff_type = 'increased';
} else if (totalSizeDiff < 0) {
node.diff_type = 'decreased';
}
}

This comment was marked as outdated.

@rbro112 rbro112 changed the title Xray diff feat(preprod): Xray diff Dec 16, 2025
@linear
Copy link

linear bot commented Dec 16, 2025

EME-207 X-Ray Diff

<Separator orientation="horizontal" border="primary" />

<Stack gap="md">
<Heading as="h2">{t('Size diff')}</Heading>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you make this "Size Diff"? Or maybe we go back to our tried and true "X-Ray Diff", main thing is capitalizing second letter, thats convention in rest of sentry for these headings

Copy link
Member Author

@rbro112 rbro112 Dec 16, 2025

Choose a reason for hiding this comment

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

Will do "X-Ray Diff" - copied this from designs so that's why I chose the caps

throw new Error(`Diff type ${element.diff_type} not found`);
}

const data: any = {
Copy link
Member

Choose a reason for hiding this comment

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

nit: is there a type to use for this? I see we are using TreemapSeriesOption below

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah but leads to some strange type errors, but I just added ignores for those.

);
}

const ButtonContainer = styled(Flex)`
Copy link
Member

Choose a reason for hiding this comment

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

nit: it seems like most of this could be done via component props but will leave that up to you

tooltip={tooltip}
onChartReady={handleChartReady}
/>
<ButtonContainer
Copy link
Member

Choose a reason for hiding this comment

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

nit: or maybe ButtonContainer could be shared, but also up to you

import {buildTreeFromDiffItems, buildTreemapDiff} from './treemapDiffUtils';

describe('treemapDiffUtils', () => {
describe('buildTreeFromDiffItems', () => {
Copy link
Member

Choose a reason for hiding this comment

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

One edge case we dealt with at Emerge that might be worth having a test case for:

        (A -50MB)
      |          |
(B -51MB)   (C +1MB)

B and C are children of A. In this case A and B should show green since they were reduced, but C should show red since it increased despite the overall parent decreasing.

@rbro112 rbro112 merged commit 44535ba into master Dec 16, 2025
48 checks passed
@rbro112 rbro112 deleted the ryan/xray_diff branch December 16, 2025 22:27
@github-actions github-actions bot locked and limited conversation to collaborators Jan 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants