Class: Appsignal::Hooks::PumaProbe Private
- Defined in:
- lib/appsignal/hooks/puma.rb
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.
Instance Method Summary collapse
- #call ⇒ Object private
-
#initialize ⇒ PumaProbe
constructor
private
A new instance of PumaProbe.
Constructor Details
#initialize ⇒ PumaProbe
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 PumaProbe.
49 50 51 |
# File 'lib/appsignal/hooks/puma.rb', line 49 def initialize @hostname = Appsignal.config[:hostname] || Socket.gethostname end |
Instance Method Details
#call ⇒ 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.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/appsignal/hooks/puma.rb', line 53 def call puma_stats = fetch_puma_stats return unless puma_stats stats = JSON.parse puma_stats, :symbolize_names => true counts = {} count_keys = [:backlog, :running, :pool_capacity, :max_threads] if stats[:worker_status] # 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 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 |