kfaraz commented on code in PR #20708:
URL: https://github.com/apache/druid/pull/20708#discussion_r4374013033
##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/CostBasedAutoScaler.java:
##########
@@ -476,14 +493,29 @@ static double extractPollIdleRatio(Map<String,
Map<String, Object>> taskStats)
return -1.;
}
+ // Use running average metric to smoothen out spikes
+ return extractAutoscalerMetric(
+ taskStats,
+ SeekableStreamIndexTaskRunner.POLL_IDLE_RATIO_RUNNING_AVG
+ );
+ }
+
+ /**
+ * Gets the value of the given metric averaged across all tasks that have
reported the metric.
+ */
+ private static double extractAutoscalerMetric(
+ Map<String, Map<String, Object>> taskStats,
+ String metricName
+ )
+ {
double sum = 0;
int count = 0;
for (Map<String, Object> groupMetrics : taskStats.values()) {
for (Object taskMetric : groupMetrics.values()) {
if (taskMetric instanceof Map) {
Object autoScalerMetricsMap = ((Map<?, ?>)
taskMetric).get(SeekableStreamIndexTaskRunner.AUTOSCALER_METRICS_KEY);
if (autoScalerMetricsMap instanceof Map) {
- Object pollIdleRatioAvg = ((Map<?, ?>)
autoScalerMetricsMap).get(SeekableStreamIndexTaskRunner.POLL_IDLE_RATIO_KEY);
+ Object pollIdleRatioAvg = ((Map<?, ?>)
autoScalerMetricsMap).get(metricName);
Review Comment:
Addressed.
--
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]