From f202d26c28e4726be9944e95d3a4953d73f8989f Mon Sep 17 00:00:00 2001 From: Bart de Water Date: Wed, 20 May 2020 22:25:55 -0400 Subject: [PATCH] Track Puma master changes to stats method --- lib/puma/plugin/statsd.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/puma/plugin/statsd.rb b/lib/puma/plugin/statsd.rb index fdebc55..51af776 100644 --- a/lib/puma/plugin/statsd.rb +++ b/lib/puma/plugin/statsd.rb @@ -117,11 +117,13 @@ def register_hooks in_background(&method(:stats_loop)) end - def fetch_stats - stats = Puma.stats - if stats.is_a?(Hash) - stats - else + if Puma.respond_to?(:stats_hash) + def fetch_stats + Puma.stats_hash + end + else + def fetch_stats + stats = Puma.stats JSON.parse(stats, symbolize_names: true) end end