6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/speedshop/cloudwatch/puma.rb', line 6
def collect
stats = ::Puma.stats_hash
if stats[:worker_status]
%i[workers booted_workers old_workers].each do |m|
Reporter.instance.report(metric: metric_name_for(m), value: stats[m] || 0)
end
report_aggregate_worker_stats(stats)
else
%i[running backlog pool_capacity max_threads].each do |m|
Reporter.instance.report(metric: metric_name_for(m), value: stats[m] || 0)
end
end
rescue => e
Speedshop::Cloudwatch.log_error("Failed to collect Puma metrics: #{e.message}", e)
end
|