gitlab-org--gitlab-foss/scripts/generate-memory-metrics-on-boot
Aleksei Lipniagov f44719f39c Get memory data after booting app in production
Preload the app in `production` env, hit it with a single request, and
gather total gem memory consumption data using `derailed exec perf:mem`
from `derailed_benchmarks`. Present the result as MR metrics.
2019-06-28 20:12:50 +03:00

11 lines
425 B
Ruby
Executable file

#!/usr/bin/env ruby
abort "usage: #{__FILE__} <memory_bundle_mem_file_name>" unless ARGV.length == 1
memory_bundle_mem_file_name = ARGV.first
full_report = File.open(memory_bundle_mem_file_name).read
stats = /TOP: (?<total_mibs_str>.*) MiB/.match(full_report)
abort 'failed to process the benchmark output' unless stats
puts "total_memory_used_by_dependencies_on_boot_prod_env_mb #{stats[:total_mibs_str].to_f.round(1)}"