gyfora commented on code in PR #571:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/571#discussion_r1172469980


##########
flink-kubernetes-operator-autoscaler/src/main/java/org/apache/flink/kubernetes/operator/autoscaler/AutoScalerInfo.java:
##########
@@ -86,20 +87,24 @@ public AutoScalerInfo(Map<String, String> data) {
         configMap.setData(Preconditions.checkNotNull(data));
     }
 
-    @SneakyThrows
-    public SortedMap<Instant, Map<JobVertexID, Map<ScalingMetric, Double>>> 
getMetricHistory() {
+    public SortedMap<Instant, CollectedMetrics> getMetricHistory() {
         var historyYaml = configMap.getData().get(COLLECTED_METRICS_KEY);
         if (historyYaml == null) {
             return new TreeMap<>();
         }
 
-        return YAML_MAPPER.readValue(decompress(historyYaml), new 
TypeReference<>() {});
+        try {
+            return YAML_MAPPER.readValue(decompress(historyYaml), new 
TypeReference<>() {});
+        } catch (JsonProcessingException e) {
+            LOG.error(
+                    "Could not deserialize metric history, possibly the format 
changed. Discarding...");
+            return new TreeMap<>();

Review Comment:
   Maybe a better solution would be to throw an exception and clear the 
autoscaler info completely. That will basically reset the history. 



-- 
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