kfaraz commented on code in PR #20708:
URL: https://github.com/apache/druid/pull/20708#discussion_r4377643397


##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/CostBasedAutoScaler.java:
##########
@@ -463,6 +463,29 @@ static int[] computeValidTaskCounts(
     return result.toIntArray();
   }
 
+  /**
+   * Extracts the average processing rate (records per second) from the task 
stats.
+   *
+   * @param taskStats the stats map from supervisor.getStats()
+   */
+  static double extractAvgProcessingRate(Map<String, Map<String, Object>> 
taskStats)
+  {
+    if (taskStats == null || taskStats.isEmpty()) {
+      return -1.;
+    }
+
+    // First try using the running average if available
+    final double runningAverage = extractAutoscalerMetric(
+        taskStats,
+        SeekableStreamIndexTaskRunner.PROCESSING_RATE_RUNNING_AVG
+    );
+    if (runningAverage >= 0) {

Review Comment:
   Hmm, yeah, I guess if we are handling mixed versions, might as well do it 
right.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to