Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2303)

Unified Diff: dashboard/dashboard/models/anomaly.py

Issue 2557743004: Adding in abs delta column to the alerts table (Closed)
Patch Set: adding in tests Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dashboard/dashboard/find_anomalies_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dashboard/dashboard/models/anomaly.py
diff --git a/dashboard/dashboard/models/anomaly.py b/dashboard/dashboard/models/anomaly.py
index 9334f786ba721256d742a19bf6129d39b6595218..bc3e296855b78c2e0f19bff0f4d18eec85389c75 100644
--- a/dashboard/dashboard/models/anomaly.py
+++ b/dashboard/dashboard/models/anomaly.py
@@ -67,6 +67,11 @@ class Anomaly(alert.Alert):
return 100 * difference / self.median_before_anomaly
@property
+ def absolute_delta(self):
+ """The absolute change from before the anomaly to after."""
+ return self.median_after_anomaly - self.median_before_anomaly
+
+ @property
def direction(self):
"""Whether the change is numerically an increase or decrease."""
if self.median_before_anomaly < self.median_after_anomaly:
@@ -78,7 +83,14 @@ class Anomaly(alert.Alert):
if abs(self.percent_changed) == sys.float_info.max:
return FREAKIN_HUGE
else:
- return str('%.1f%%' % abs(self.percent_changed))
+ return '%.1f%%' % abs(self.percent_changed)
+
+ def GetDisplayAbsoluteChanged(self):
+ """Gets a string showing the absolute change."""
+ if abs(self.absolute_delta) == sys.float_info.max:
+ return FREAKIN_HUGE
+ else:
+ return '%f' % abs(self.absolute_delta)
def SetIsImprovement(self, test=None):
"""Sets whether the alert is an improvement for the given test."""
« no previous file with comments | « dashboard/dashboard/find_anomalies_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698