Skip to content

Commit c3fc84f

Browse files
author
Arthur Leung
committed
Fix _aggregate_metrics_timeseries_dicts_by_key naming
Signed-off-by: Arthur Leung <arcyleung@gmail.com>
1 parent a242e68 commit c3fc84f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

python/ray/serve/_private/autoscaling_state.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,11 @@ def _collect_handle_running_requests_by_replica(
306306
for replica_id, timeseries in handle_running.items():
307307
# Only include replicas that are currently running for this deployment
308308
if replica_id in self._running_replicas:
309-
timeseries_by_replica[replica_id].append(timeseries)
309+
timeseries_by_replica[replica_id].extend(timeseries)
310310

311-
return dict(timeseries_by_replica)
311+
return timeseries_by_replica
312312

313-
def _aggregate_metric(
313+
def _aggregate_metrics_timeseries_dicts_by_key(
314314
self,
315315
metrics_timeseries_dicts: List[Dict[str, List[TimeStampedValue]]],
316316
metric_key: str = ONGOING_REQUESTS_KEY,
@@ -400,7 +400,7 @@ def _aggregate_running_requests(
400400
Returns:
401401
The time-weighted average of the running requests
402402
"""
403-
return self._aggregate_metric_timeseries(
403+
return self._aggregate_metrics_timeseries_dicts_by_key(
404404
metrics_timeseries_dicts, RUNNING_REQUESTS_KEY
405405
)
406406

@@ -445,7 +445,7 @@ def _aggregate_controller_metrics(self) -> dict[str, float]:
445445

446446
# Aggregate the timeseries data for this metric
447447
if metrics_timeseries_dicts:
448-
aggregated_value = self._aggregate_metric_timeseries(
448+
aggregated_value = self._aggregate_metrics_timeseries_dicts_by_key(
449449
metrics_timeseries_dicts, metric_key
450450
)
451451
aggregated_metrics[metric_key] = aggregated_value
@@ -588,7 +588,7 @@ def _calculate_total_requests_aggregate_mode(
588588
for timeseries in queued_timeseries:
589589
ongoing_requests_metrics.append({ONGOING_REQUESTS_KEY: timeseries})
590590
# Aggregate and add running requests to total
591-
ongoing_requests_avg = self._aggregate_metric(
591+
ongoing_requests_avg = self._aggregate_metrics_timeseries_dicts_by_key(
592592
ongoing_requests_metrics, ONGOING_REQUESTS_KEY
593593
)
594594

@@ -679,9 +679,9 @@ def get_total_num_requests_and_aggregate_metrics(
679679
self,
680680
) -> tuple[
681681
float,
682-
dict[ReplicaID, float],
683-
dict[str, Dict[ReplicaID, List[Any]]],
684-
dict[str, float],
682+
Dict[ReplicaID, float],
683+
Dict[ReplicaID, List[Any]],
684+
Dict[str, float],
685685
]:
686686
"""Get average total number of requests aggregated over the past
687687
`look_back_period_s` number of seconds.

0 commit comments

Comments
 (0)