diff --git a/src/sentry/preprod/size_analysis/grouptype.py b/src/sentry/preprod/size_analysis/grouptype.py index 26134e46047195..6d03b72e55f634 100644 --- a/src/sentry/preprod/size_analysis/grouptype.py +++ b/src/sentry/preprod/size_analysis/grouptype.py @@ -193,7 +193,7 @@ def extract_value(self, data_packet: SizeAnalysisDataPacket) -> SizeAnalysisEval return self._extract_head(data_packet) - self._extract_base(data_packet) case "relative_diff": base = self._extract_base(data_packet) - return (self._extract_head(data_packet) - base) / base + return ((self._extract_head(data_packet) - base) / base) * 100 case _: raise ValueError(f"Unknown threshold_type: {threshold_type}") diff --git a/tests/sentry/preprod/size_analysis/test_grouptype.py b/tests/sentry/preprod/size_analysis/test_grouptype.py index e35cdb909ac01b..f14d659b5d7c35 100644 --- a/tests/sentry/preprod/size_analysis/test_grouptype.py +++ b/tests/sentry/preprod/size_analysis/test_grouptype.py @@ -281,11 +281,11 @@ def test_evaluate_relative_diff(self): condition_group = self.create_data_condition_group( organization=self.project.organization, ) - # Trigger when relative diff > 0.1 (10%) + # Trigger when relative diff > 10 (10%) self.create_data_condition( condition_group=condition_group, type=Condition.GREATER, - comparison=0.1, + comparison=10, condition_result=DetectorPriorityLevel.HIGH, ) detector = self.create_detector( @@ -296,7 +296,7 @@ def test_evaluate_relative_diff(self): workflow_condition_group=condition_group, ) - # (5000000 - 4000000) / 4000000 = 0.25 > 0.1 + # (5000000 - 4000000) / 4000000 = 25% > 10% data_packet: SizeAnalysisDataPacket = DataPacket( source_id="test", packet={ @@ -316,11 +316,11 @@ def test_evaluate_relative_diff_no_trigger_when_below_threshold(self): condition_group = self.create_data_condition_group( organization=self.project.organization, ) - # Trigger when relative diff > 0.1 (10%) + # Trigger when relative diff > 10 (10%) self.create_data_condition( condition_group=condition_group, type=Condition.GREATER, - comparison=0.1, + comparison=10, condition_result=DetectorPriorityLevel.HIGH, ) detector = self.create_detector( @@ -331,7 +331,7 @@ def test_evaluate_relative_diff_no_trigger_when_below_threshold(self): workflow_condition_group=condition_group, ) - # (5000000 - 4900000) / 4900000 ≈ 0.02 < 0.1 + # (5000000 - 4900000) / 4900000 ≈ 2.04% < 10% data_packet: SizeAnalysisDataPacket = DataPacket( source_id="test", packet={