CSIT-1110: Fix dashboard anomaly count range 19/13019/1
authorVratko Polak <vrpolak@cisco.com>
Wed, 13 Jun 2018 08:23:06 +0000 (10:23 +0200)
committerVratko Polak <vrpolak@cisco.com>
Wed, 13 Jun 2018 08:25:44 +0000 (10:25 +0200)
+ Dashboard tables should now report anomalies from last week only.
+ Changed handling of Nan to report regression.

Change-Id: I624b0bc84a93702a31fc79fd670bd645b963f1f7
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
resources/tools/presentation/new/generator_tables.py
resources/tools/presentation/new/utils.py

index 6951021..735fd21 100644 (file)
@@ -788,8 +788,8 @@ def table_performance_trending_dashboard(table, input_data):
                  round(last_avg / 1000000, 2),
                  '-' if isnan(rel_change_last) else rel_change_last,
                  '-' if isnan(rel_change_long) else rel_change_long,
-                 classification_lst[-long_win_size:].count("regression"),
-                 classification_lst[-long_win_size:].count("progression")])
+                 classification_lst[-win_size:].count("regression"),
+                 classification_lst[-win_size:].count("progression")])
 
     tbl_lst.sort(key=lambda rel: rel[0])
 
@@ -823,6 +823,7 @@ def table_performance_trending_dashboard(table, input_data):
     with open(txt_file_name, "w") as txt_file:
         txt_file.write(str(txt_table))
 
+
 def table_performance_trending_dashboard_html(table, input_data):
     """Generate the table(s) with algorithm:
     table_performance_trending_dashboard_html specified in the specification
index 83f4f62..a688928 100644 (file)
@@ -211,17 +211,19 @@ def archive_input_data(spec):
 def classify_anomalies(data):
     """Process the data and return anomalies and trending values.
 
-    Gathers data into groups with common trend value.
-    Decorates first value in the group to be an outlier, regression,
-    normal or progression.
+    Gather data into groups with average as trend value.
+    Decorate values within groups to be normal,
+    the first value of changed average as a regression, or a progression.
 
     :param data: Full data set with unavailable samples replaced by nan.
     :type data: pandas.Series
     :returns: Classification and trend values
     :rtype: 2-tuple, list of strings and list of floats
     """
-    bare_data = [sample for _, sample in data.iteritems()
-                 if not np.isnan(sample)]
+    # Nan mean something went wrong.
+    # Use 0.0 to cause that being reported as a severe regression.
+    bare_data = [0.0 if np.isnan(sample) else sample
+                 for _, sample in data.iteritems()]
     # TODO: Put analogous iterator into jumpavg library.
     groups = BitCountingClassifier.classify(bare_data)
     groups.reverse()  # Just to use .pop() for FIFO.