Skip to content

fix(preprod): Align relative_diff extract_value with frontend percentage convention#111682

Merged
mtopo27 merged 1 commit into
masterfrom
mtopo27/fix-relative-diff-for-monitors
Mar 26, 2026
Merged

fix(preprod): Align relative_diff extract_value with frontend percentage convention#111682
mtopo27 merged 1 commit into
masterfrom
mtopo27/fix-relative-diff-for-monitors

Conversation

@mtopo27

@mtopo27 mtopo27 commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

extract_value for relative_diff monitors returned a ratio (e.g. 0.05 for a 5% increase), but the frontend stores percentage-scale values (e.g. 5.0). The condition operator.gt(0.05, 5.0) was always false, so relative_diff monitors created through the UI never fired.

This multiplies by 100 in extract_value so both sides use percentage-scale values, consistent with how VCS status checks already compute diffs. Tests updated to match.

Feature is released = False so no production impact.

refs EME-985

…age convention

extract_value returned a ratio (0.05 for 5%) while the frontend stores
percentage-scale values (5.0 for 5%), so the condition check was always
false and relative_diff monitors never triggered. Multiply by 100 to
match the frontend convention and align with VCS status checks.

Refs LINEAR-EME-985
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 26, 2026
@linear-code

linear-code Bot commented Mar 26, 2026

Copy link
Copy Markdown

Comment thread src/sentry/preprod/size_analysis/grouptype.py
@mtopo27

mtopo27 commented Mar 26, 2026

Copy link
Copy Markdown
Contributor Author

Frontend reference — this is where the percentage value is saved without dividing by 100:

static/app/views/detectors/components/forms/mobileBuild/mobileBuildFormData.tsx:67-68

comparison: isPercentage
  ? parseFloat(data.highThreshold)   // user types "5", stores 5.0 (not 0.05)

Backend reference — VCS status checks already use percentage-scale correctly:

src/sentry/preprod/vcs/status_checks/size/tasks.py:711

percent_diff = (diff / base_value) * 100
return percent_diff > rule.value

This fix aligns monitors with that same convention.

@mtopo27 mtopo27 merged commit c2b23ac into master Mar 26, 2026
67 checks passed
@mtopo27 mtopo27 deleted the mtopo27/fix-relative-diff-for-monitors branch March 26, 2026 21:38
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 11, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants