Gerrrr commented on code in PR #161:
URL: https://github.com/apache/otava/pull/161#discussion_r3742392777


##########
otava/series.py:
##########
@@ -386,32 +295,37 @@ def append(self, time, new_data, attributes):
                 max_pvalue=self.options.max_pvalue,
                 min_magnitude=self.options.min_magnitude,
                 new_data=len(new_data[metric]),
-                old_weak_cp=self.weak_change_points.get(metric, [])
+                
old_weak_cp=self.weak_change_points.get_change_points_for_metric(metric),
             )
-            result[metric] = []
+            if metric not in result:
+                result[metric] = []
             for c in change_points:
                 result[metric].append(
-                    ChangePoint(
-                        index=c.index, qhat=0.0, 
time=self.__series.time[c.index], metric=metric, stats=c.stats
+                    ChangePointGroup(
+                        time=self.__series.time[c.index],
+                        changes={metric: c},
+                        attributes=self.__series.attributes_at(c.index),
                     )
                 )
-            weak_change_points[metric] = []
+            if metric not in weak_change_points:
+                weak_change_points[metric] = []
             for c in weak_cps:
                 weak_change_points[metric].append(
-                    ChangePoint(
-                        index=c.index, qhat=0.0, 
time=self.__series.time[c.index], metric=metric, stats=c.stats
+                    ChangePointGroup(
+                        time=self.__series.time[c.index],
+                        changes={metric: c},
+                        attributes=self.__series.attributes_at(c.index),
                     )
                 )
+            # TODO: Remove this. It should not be a requirement that metrics 
have the same history.
             fill_missing(self.__series.data[metric])
 
-        # If some metrics didn't participate in this round, we still keep 
them, but update the ones
-        # We did recompute
-        for metric in result.keys():
-            self.change_points[metric] = result[metric]
-        for metric in weak_change_points.keys():
-            self.weak_change_points[metric] = weak_change_points[metric]
-        self.change_points_by_time = 
self.__group_change_points_by_time(self.__series, self.change_points)
-        return result, weak_change_points
+        r = ChangePointsByMetric.from_dict(result)
+        w = ChangePointsByMetric.from_dict(weak_change_points)

Review Comment:
   62ce90f



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to