Class: ElasticGraph::IndexerAutoscalerLambda::LambdaFunction

Inherits:
Object
  • Object
show all
Includes:
LambdaSupport::LambdaFunction
Defined in:
lib/elastic_graph/indexer_autoscaler_lambda/lambda_function.rb

Instance Method Summary collapse

Constructor Details

#initializeLambdaFunction

Returns a new instance of LambdaFunction.



17
18
19
20
21
# File 'lib/elastic_graph/indexer_autoscaler_lambda/lambda_function.rb', line 17

def initialize
  require "elastic_graph/indexer_autoscaler_lambda"

  @concurrency_scaler = ElasticGraph::IndexerAutoscalerLambda.from_env.concurrency_scaler
end

Instance Method Details

#handle_request(event:, context:) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/elastic_graph/indexer_autoscaler_lambda/lambda_function.rb', line 23

def handle_request(event:, context:)
  @concurrency_scaler.tune_indexer_concurrency(
    queue_urls: event.fetch("queue_urls"),
    min_cpu_target: event.fetch("min_cpu_target"),
    max_cpu_target: event.fetch("max_cpu_target"),
    maximum_concurrency: event.fetch("maximum_concurrency"),
    required_free_storage_in_mb: event.fetch("required_free_storage_in_mb"),
    indexer_function_name: event.fetch("indexer_function_name"),
    cluster_name: event.fetch("cluster_name")
  )
end