Class: Promenade::Raindrops::Stats
- Inherits:
-
Object
- Object
- Promenade::Raindrops::Stats
- Defined in:
- lib/promenade/raindrops/stats.rb
Instance Attribute Summary collapse
-
#active_workers ⇒ Object
readonly
Returns the value of attribute active_workers.
-
#listener_address ⇒ Object
readonly
Returns the value of attribute listener_address.
-
#queued_requests ⇒ Object
readonly
Returns the value of attribute queued_requests.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(listener_address: nil) ⇒ Stats
constructor
A new instance of Stats.
- #instrument ⇒ Object
Constructor Details
#initialize(listener_address: nil) ⇒ Stats
Returns a new instance of Stats.
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/promenade/raindrops/stats.rb', line 20 def initialize(listener_address: nil) return unless defined?(::Raindrops) return unless defined?(::Raindrops::Linux.tcp_listener_stats) @listener_address = listener_address || "127.0.0.1:#{ENV.fetch('PORT', 3000)}" stats = ::Raindrops::Linux.tcp_listener_stats([@listener_address])[@listener_address] @active_workers = stats.active @queued_requests = stats.queued end |
Instance Attribute Details
#active_workers ⇒ Object (readonly)
Returns the value of attribute active_workers.
18 19 20 |
# File 'lib/promenade/raindrops/stats.rb', line 18 def active_workers @active_workers end |
#listener_address ⇒ Object (readonly)
Returns the value of attribute listener_address.
18 19 20 |
# File 'lib/promenade/raindrops/stats.rb', line 18 def listener_address @listener_address end |
#queued_requests ⇒ Object (readonly)
Returns the value of attribute queued_requests.
18 19 20 |
# File 'lib/promenade/raindrops/stats.rb', line 18 def queued_requests @queued_requests end |
Class Method Details
.instrument(listener_address: nil) ⇒ Object
37 38 39 |
# File 'lib/promenade/raindrops/stats.rb', line 37 def self.instrument(listener_address: nil) new(listener_address: listener_address).instrument end |