From 0f465f2a13f0f89d6931ef22056071cbbf155610 Mon Sep 17 00:00:00 2001 From: Anika Kumar Date: Tue, 5 Nov 2024 12:46:56 -0800 Subject: [PATCH] result is actually in MB not bytes --- .../indexer_autoscaler_lambda/concurrency_scaler.rb | 2 +- .../indexer_autoscaler_lambda/concurrency_scaler_spec.rb | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/elasticgraph-indexer_autoscaler_lambda/lib/elastic_graph/indexer_autoscaler_lambda/concurrency_scaler.rb b/elasticgraph-indexer_autoscaler_lambda/lib/elastic_graph/indexer_autoscaler_lambda/concurrency_scaler.rb index ed36c1be..ce510627 100644 --- a/elasticgraph-indexer_autoscaler_lambda/lib/elastic_graph/indexer_autoscaler_lambda/concurrency_scaler.rb +++ b/elasticgraph-indexer_autoscaler_lambda/lib/elastic_graph/indexer_autoscaler_lambda/concurrency_scaler.rb @@ -116,7 +116,7 @@ def get_min_free_storage(cluster_name) ] }) - metric_response.metric_data_results.first.values.first / (1024 * 1024) # result is in bytes + metric_response.metric_data_results.first.values.first end def get_queue_attributes(queue_urls) diff --git a/elasticgraph-indexer_autoscaler_lambda/spec/unit/elastic_graph/indexer_autoscaler_lambda/concurrency_scaler_spec.rb b/elasticgraph-indexer_autoscaler_lambda/spec/unit/elastic_graph/indexer_autoscaler_lambda/concurrency_scaler_spec.rb index e985da1c..4f839c5f 100644 --- a/elasticgraph-indexer_autoscaler_lambda/spec/unit/elastic_graph/indexer_autoscaler_lambda/concurrency_scaler_spec.rb +++ b/elasticgraph-indexer_autoscaler_lambda/spec/unit/elastic_graph/indexer_autoscaler_lambda/concurrency_scaler_spec.rb @@ -242,11 +242,10 @@ def lambda_client_with_concurrency(concurrency) def cloudwatch_client_with_storage_metrics(free_storage) ::Aws::CloudWatch::Client.new(stub_responses: true).tap do |cloudwatch_client| cloudwatch_client.stub_responses(:get_metric_data, { - # return values are in bytes metric_data_results: [ { id: "minFreeStorageAcrossNodes", - values: [(free_storage * 1024 * 1024).to_f], + values: [free_storage.to_f], timestamps: [::Time.parse("2024-10-30T12:00:00Z")] } ]