Dennis-Mircea commented on code in PR #1099:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/1099#discussion_r3426489076
##########
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/ScalingMetricEvaluator.java:
##########
@@ -588,4 +635,76 @@ protected static double computeEdgeDataRate(
to);
return getRate(ScalingMetric.NUM_RECORDS_OUT, from, metricsHistory);
}
+
+ /**
+ * Executes the provided custom metric evaluator for the given job vertex.
Calls {@link
+ * FlinkAutoscalerEvaluator#evaluateVertexMetrics} to evaluate scaling
metrics.
+ *
+ * @param vertex The job vertex being evaluated.
+ * @param evaluatedMetrics Current evaluated metrics.
+ * @param customEvaluationSession A tuple containing the custom metric
evaluator and evaluation
+ * context.
+ * @return A map of scaling metrics, with its corresponding evaluated
scaling metric.
+ */
+ @VisibleForTesting
+ protected static Map<ScalingMetric, EvaluatedScalingMetric>
runCustomEvaluator(
+ JobVertexID vertex,
+ Map<ScalingMetric, EvaluatedScalingMetric> evaluatedMetrics,
+ Tuple2<FlinkAutoscalerEvaluator, FlinkAutoscalerEvaluator.Context>
+ customEvaluationSession) {
+ try {
+ return customEvaluationSession.f0.evaluateVertexMetrics(
+ vertex, evaluatedMetrics, customEvaluationSession.f1);
+ } catch (UnsupportedOperationException e) {
+ LOG.warn(
+ "Custom metric evaluator {} tried accessing an
un-modifiable view.",
+ customEvaluationSession.f0.getClass(),
+ e);
+ } catch (Exception e) {
+ LOG.warn(
+ "Custom metric evaluator {} threw an exception.",
+ customEvaluationSession.f0.getClass(),
+ e);
+ }
+
+ return Collections.emptyMap();
+ }
+
+ /**
+ * Merges the incoming evaluated metrics into actual evaluated metrics.
+ *
+ * @param actual The target evaluated metrics map to merge into.
+ * @param incoming The incoming map containing new evaluated metrics map
to be merged
+ * (nullable).
+ */
Review Comment:
Same explanation as the previous one!
--
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]