Conversation
|
🚨 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 |
static/app/views/detectors/components/forms/mobileBuild/mobileBuildFormData.tsx
Outdated
Show resolved
Hide resolved
static/app/views/detectors/components/forms/mobileBuild/mobileBuildFormData.tsx
Show resolved
Hide resolved
static/app/views/detectors/components/forms/mobileBuild/mobileBuildFormData.tsx
Outdated
Show resolved
Hide resolved
static/app/views/detectors/components/forms/mobileBuild/mobileBuildFormData.tsx
Outdated
Show resolved
Hide resolved
static/app/views/detectors/components/forms/mobileBuild/mobileBuildFormData.tsx
Outdated
Show resolved
Hide resolved
|
This PR has a migration; here is the generated SQL for for --
-- Create model SizeAnalysisSubscription
--
CREATE TABLE "sentry_sizeanalysissubscription" ("id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "date_updated" timestamp with time zone NOT NULL, "date_added" timestamp with time zone NOT NULL, "project_id" bigint NOT NULL);
ALTER TABLE "sentry_sizeanalysissubscription" ADD CONSTRAINT "sentry_sizeanalysiss_project_id_41e3355e_fk_sentry_pr" FOREIGN KEY ("project_id") REFERENCES "sentry_project" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "sentry_sizeanalysissubscription" VALIDATE CONSTRAINT "sentry_sizeanalysiss_project_id_41e3355e_fk_sentry_pr";
CREATE INDEX CONCURRENTLY "sentry_sizeanalysissubscription_project_id_41e3355e" ON "sentry_sizeanalysissubscription" ("project_id"); |
faf4368 to
3f32d87
Compare
759cbb5 to
3117ac8
Compare
Add PreprodSizeAnalysisGroupType (type_id=11003) with detector handler and validators that integrate with the workflow engine to emit issues when build size thresholds are exceeded. - PreprodSizeAnalysisDetectorHandler: evaluates DataPackets from size comparisons and produces IssueOccurrences - PreprodSizeAnalysisDetectorValidato validate detector creation via the API - Register the GroupType import in preprod/grouptype.py PRs: - #108208 Add size_analysis detector (this PR) - #108209 Hook size analysis detector to diff - #108210 Add new issue type to frontend - #108211 Add size monitor UI [Design doc](https://www.notion.so/sentry/Size-Monitors-3068b10e4b5d805ca57de084d1b4eba6) This stack of PRs is missing a handful of important features: - Filters - Detailed data on the occurrence - Some UI polish but it works end to end.
3de16ed to
1d56ea9
Compare
Add PREPROD_SIZE_ANALYSIS to the IssueType enum, IssueTitle mapping, and occurrence type lookup (type_id 11003) so the frontend can recognize and label Size Analysis issues. PRs: - #108208 Add size_analysis detector - #108209 Hook size analysis detector to diff - #108210 Add new issue type to frontend (this PR) - #108211 Add size monitor UI The old issue types will later be deprecated: ``` 11001: IssueType.PREPROD_STATIC, 11002: IssueType.PREPROD_DELTA, ``` [Design doc](https://www.notion.so/sentry/Size-Monitors-3068b10e4b5d805ca57de084d1b4eba6)
Replace direct Kafka occurrence production with the workflow engine's DataPacket pipeline. maybe_emit_issues() now looks up SizeAnalysisSubscriptions for the project and feeds size deltas into process_data_packet(), which resolves linked detectors and evaluates them instead of using a hardcoded threshold. PRs: - #108208 Add size_analysis detector - #108209 Hook size analysis detector to diff (this PR) - #108210 Add new issue type to frontend - #108211 Add size monitor UI [Design doc](https://www.notion.so/sentry/Size-Monitors-3068b10e4b5d805ca57de084d1b4eba6)
3117ac8 to
ed9ae01
Compare
2888387 to
9469914
Compare
9469914 to
f117bb3
Compare
malwilley
left a comment
There was a problem hiding this comment.
Looking good! Just a few comments.
There is some similar code/styling that we could probably consolidate into reusable components, but nothing too egregious and it's probably better to wait for more use cases before doing that.
| } | ||
|
|
||
| return t('Above %(value)s%(unit)s', { | ||
| value: comparisonValue, |
| ) | ||
| ) | ||
| ); | ||
| const mediumThreshold = String( |
There was a problem hiding this comment.
I thought there was no medium threshold?
There was a problem hiding this comment.
Yep! We were once the fence a bit but we've decided to start with just low & high. Removed.
| const isPercentage = thresholdType === 'relative_diff'; | ||
| const threshold = highThreshold; | ||
| const thresholdUnit = isPercentage ? '%' : 'MB'; | ||
| const thresholdDisplay = threshold ? `${threshold} ${thresholdUnit}` : '...'; |
There was a problem hiding this comment.
nit: usually we use the unicode character …
| ); | ||
| } | ||
|
|
||
| const PreviewTable = styled('div')` |
There was a problem hiding this comment.
Can you achieve this with the Grid component? There are quite a few styles in this component that you could replace with the layout scraps: https://sentry.sentry.io/stories/core/grid/
There was a problem hiding this comment.
changed to use Grid!
| display: contents; | ||
|
|
||
| > * { | ||
| background: ${p => p.theme.tokens.background.secondary}; |
There was a problem hiding this comment.
Could these styles be applied to HeaderCell? (or even better use the layout and typography scraps)
There was a problem hiding this comment.
Updated this to be a lot nicer (and use Flex/Text etc) however still a little ugly in places.
|
|
||
| return ( | ||
| <Container> | ||
| <Section |
There was a problem hiding this comment.
Thank you for making this! We were planning on adding this to the other monitor types as well, so it would be nice if we had the visual component added to detectors/components/forms/common/ (called something like DetectorIssuePreview?)
There was a problem hiding this comment.
Moved most the content to static/app/views/detectors/components/forms/common/detectorIssuePreview.tsx
with a new component DetectorIssuePreview
Add PreprodSizeAnalysisGroupType (type_id=11003) with detector handler and validators that integrate with the workflow engine to emit issues when build size thresholds are exceeded. - PreprodSizeAnalysisDetectorHandler: evaluates DataPackets from size comparisons and produces IssueOccurrences - PreprodSizeAnalysisDetectorValidato validate detector creation via the API - Register the GroupType import in preprod/grouptype.py PRs: - #108208 Add size_analysis detector (this PR) - #108209 Hook size analysis detector to diff - #108210 Add new issue type to frontend - #108211 Add size monitor UI [Design doc](https://www.notion.so/sentry/Size-Monitors-3068b10e4b5d805ca57de084d1b4eba6) This stack of PRs is missing a handful of important features: - Filters - Detailed data on the occurrence - Some UI polish but it works end to end.
Add PREPROD_SIZE_ANALYSIS to the IssueType enum, IssueTitle mapping, and occurrence type lookup (type_id 11003) so the frontend can recognize and label Size Analysis issues. PRs: - #108208 Add size_analysis detector - #108209 Hook size analysis detector to diff - #108210 Add new issue type to frontend (this PR) - #108211 Add size monitor UI The old issue types will later be deprecated: ``` 11001: IssueType.PREPROD_STATIC, 11002: IssueType.PREPROD_DELTA, ``` [Design doc](https://www.notion.so/sentry/Size-Monitors-3068b10e4b5d805ca57de084d1b4eba6)
Add PreprodSizeAnalysisGroupType (type_id=11003) with detector handler and validators that integrate with the workflow engine to emit issues when build size thresholds are exceeded. - PreprodSizeAnalysisDetectorHandler: evaluates DataPackets from size comparisons and produces IssueOccurrences - PreprodSizeAnalysisDetectorValidato validate detector creation via the API - Register the GroupType import in preprod/grouptype.py PRs: - #108208 Add size_analysis detector (this PR) - #108209 Hook size analysis detector to diff - #108210 Add new issue type to frontend - #108211 Add size monitor UI [Design doc](https://www.notion.so/sentry/Size-Monitors-3068b10e4b5d805ca57de084d1b4eba6) This stack of PRs is missing a handful of important features: - Filters - Detailed data on the occurrence - Some UI polish but it works end to end.
Add PREPROD_SIZE_ANALYSIS to the IssueType enum, IssueTitle mapping, and occurrence type lookup (type_id 11003) so the frontend can recognize and label Size Analysis issues. PRs: - #108208 Add size_analysis detector - #108209 Hook size analysis detector to diff - #108210 Add new issue type to frontend (this PR) - #108211 Add size monitor UI The old issue types will later be deprecated: ``` 11001: IssueType.PREPROD_STATIC, 11002: IssueType.PREPROD_DELTA, ``` [Design doc](https://www.notion.so/sentry/Size-Monitors-3068b10e4b5d805ca57de084d1b4eba6)
Replace direct Kafka occurrence production with the workflow engine's DataPacket pipeline. maybe_emit_issues() now looks up SizeAnalysisSubscriptions for the project and feeds size deltas into process_data_packet(), which resolves linked detectors and evaluates them instead of using a hardcoded threshold. PRs: - #108208 Add size_analysis detector - #108209 Hook size analysis detector to diff (this PR) - #108210 Add new issue type to frontend - #108211 Add size monitor UI [Design doc](https://www.notion.so/sentry/Size-Monitors-3068b10e4b5d805ca57de084d1b4eba6)
f117bb3 to
42ecb2c
Compare
cca1f63 to
db5ea49
Compare
static/app/views/detectors/components/forms/mobileBuild/previewSection.tsx
Show resolved
Hide resolved
3a93a8d to
12d8162
Compare
static/app/views/detectors/components/forms/mobileBuild/mobileBuildFormData.tsx
Show resolved
Hide resolved
12d8162 to
0949d4f
Compare
|
|
||
| return ( | ||
| <Container> | ||
| <Section |
There was a problem hiding this comment.
Moved most the content to static/app/views/detectors/components/forms/common/detectorIssuePreview.tsx
with a new component DetectorIssuePreview
| ); | ||
| } | ||
|
|
||
| const PreviewTable = styled('div')` |
There was a problem hiding this comment.
changed to use Grid!
| } | ||
|
|
||
| return t('Above %(value)s%(unit)s', { | ||
| value: comparisonValue, |
| display: contents; | ||
|
|
||
| > * { | ||
| background: ${p => p.theme.tokens.background.secondary}; |
There was a problem hiding this comment.
Updated this to be a lot nicer (and use Flex/Text etc) however still a little ugly in places.
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.
|
|
||
| const threshold = Number(highThreshold); | ||
| const regression = isPercentage ? 0.05 : 1; | ||
| const actual = threshold === undefined ? undefined : threshold + regression; |
There was a problem hiding this comment.
Preview shows incorrect value when threshold is empty
Medium Severity
Number() never returns undefined — it returns NaN or a number. So the check threshold === undefined on line 35 is always false. When highThreshold is an empty string (the default form value), Number('') evaluates to 0, making actual = 0 + regression (i.e. 1 for MB or 0.05 for percentage). The preview then incorrectly shows something like "1 MB > … Threshold" on initial load instead of showing ellipsis for both values. The guard needs to check highThreshold (the original string) for emptiness rather than checking the already-converted numeric threshold against undefined.



Add list, detail, and create/edit views for the preprod_size_analysis
detector type ("Mobile Builds"). Users can configure a metric
(install/download size), measurement (absolute/diff/relative), optional
build filters, and priority thresholds. Includes a live preview section,
detector type selection form, and routes at /detectors/mobile-builds/.
PRs:
Design doc