17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/xmonitor/dashboard.rb', line 17
def run
init_aws_config_and_clients
query_execution_response = start_query_execution(all_metrics_by_hour_query)
query_execution_id = query_execution_response.query_execution_id
@logger.info(query_execution_id: query_execution_id)
last_get_query_execution_response = wait_for_finish_query_execution(query_execution_id)
output_location = last_get_query_execution_response.query_execution.result_configuration.output_location
@logger.info(output_location: output_location)
get_s3_object_and_process_body(output_location) do |body|
CSV.new(body, headers: true).each{|row|
puts [Time.parse(row[0]), row[1], row[2], row[3], row[4].to_f].to_csv
}
end
rescue StandardError => e
@logger.error(error: e, backtrace: e.backtrace)
end
|