Class: Tpt::Rails::PumaStatsCollector::PumaStats
- Inherits:
-
Object
- Object
- Tpt::Rails::PumaStatsCollector::PumaStats
- Defined in:
- lib/tpt/rails/puma_stats_collector.rb
Instance Method Summary collapse
- #backlog ⇒ Object
- #booted_workers ⇒ Object
- #clustered? ⇒ Boolean
-
#initialize(stats) ⇒ PumaStats
constructor
A new instance of PumaStats.
- #max_threads ⇒ Object
- #pool_capacity ⇒ Object
- #running ⇒ Object
- #to_s ⇒ Object
- #workers ⇒ Object
Constructor Details
#initialize(stats) ⇒ PumaStats
Returns a new instance of PumaStats.
3 4 5 |
# File 'lib/tpt/rails/puma_stats_collector.rb', line 3 def initialize(stats) @stats = JSON.parse(stats, symbolize_names: true) end |
Instance Method Details
#backlog ⇒ Object
23 24 25 |
# File 'lib/tpt/rails/puma_stats_collector.rb', line 23 def backlog get_stat(:backlog) end |
#booted_workers ⇒ Object
15 16 17 |
# File 'lib/tpt/rails/puma_stats_collector.rb', line 15 def booted_workers @stats.fetch(:booted_workers, 1) end |
#clustered? ⇒ Boolean
7 8 9 |
# File 'lib/tpt/rails/puma_stats_collector.rb', line 7 def clustered? @stats.has_key?(:workers) end |
#max_threads ⇒ Object
31 32 33 |
# File 'lib/tpt/rails/puma_stats_collector.rb', line 31 def max_threads get_stat(:max_threads) end |
#pool_capacity ⇒ Object
27 28 29 |
# File 'lib/tpt/rails/puma_stats_collector.rb', line 27 def pool_capacity get_stat(:pool_capacity) end |
#running ⇒ Object
19 20 21 |
# File 'lib/tpt/rails/puma_stats_collector.rb', line 19 def running get_stat(:running) end |
#to_s ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/tpt/rails/puma_stats_collector.rb', line 35 def to_s { workers: workers, booted_workers: booted_workers, running: running, backlog: backlog, pool_capacity: pool_capacity, max_threads: max_threads }.to_json end |
#workers ⇒ Object
11 12 13 |
# File 'lib/tpt/rails/puma_stats_collector.rb', line 11 def workers @stats.fetch(:workers, 1) end |