Class: AppsignalPumaPlugin Private
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
AppsignalPumaPlugin
Class to handle the logic of translating the Puma stats to AppSignal metrics.
Defined Under Namespace
Classes: Statsd
Instance Method Summary collapse
- #call(stats) ⇒ Object private
-
#initialize ⇒ AppsignalPumaPlugin
constructor
private
A new instance of AppsignalPumaPlugin.
Constructor Details
#initialize ⇒ AppsignalPumaPlugin
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of AppsignalPumaPlugin.
83 84 85 86 |
# File 'lib/puma/plugin/appsignal.rb', line 83 def initialize @hostname = fetch_hostname @statsd = Statsd.new end |
Instance Method Details
#call(stats) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/puma/plugin/appsignal.rb', line 88 def call(stats) counts = {} count_keys = [:backlog, :running, :pool_capacity, :max_threads] if stats[:worker_status] # Clustered mode - Multiple workers stats[:worker_status].each do |worker| stat = worker[:last_status] count_keys.each do |key| count_if_present counts, key, stat end end gauge(:workers, stats[:workers], :type => :count) gauge(:workers, stats[:booted_workers], :type => :booted) gauge(:workers, stats[:old_workers], :type => :old) else # Single mode - Single worker count_keys.each do |key| count_if_present counts, key, stats end end gauge(:connection_backlog, counts[:backlog]) if counts[:backlog] gauge(:pool_capacity, counts[:pool_capacity]) if counts[:pool_capacity] gauge(:threads, counts[:running], :type => :running) if counts[:running] gauge(:threads, counts[:max_threads], :type => :max) if counts[:max_threads] end |