class Async::Container::Statistics
Tracks various statistics relating to child instances in a container.
Attributes
failures[R]
How many child instances have failed. @attribute [Integer]
restarts[R]
How many child instances have been restarted. @attribute [Integer]
spawns[R]
How many child instances have been spawned. @attribute [Integer]
Public Class Methods
new()
click to toggle source
# File lib/async/container/statistics.rb, line 29 def initialize @spawns = 0 @restarts = 0 @failures = 0 end
Public Instance Methods
<<(other)
click to toggle source
Append another statistics instance into this one. @parameter other [Statistics] The statistics to append.
# File lib/async/container/statistics.rb, line 70 def << other @spawns += other.spawns @restarts += other.restarts @failures += other.failures end
failed?()
click to toggle source
Whether there have been any failures. @returns [Boolean] If the failure count is greater than 0.
# File lib/async/container/statistics.rb, line 64 def failed? @failures > 0 end
failure!()
click to toggle source
Increment the number of failures by 1.
# File lib/async/container/statistics.rb, line 58 def failure! @failures += 1 end
restart!()
click to toggle source
Increment the number of restarts by 1.
# File lib/async/container/statistics.rb, line 53 def restart! @restarts += 1 end
spawn!()
click to toggle source
Increment the number of spawns by 1.
# File lib/async/container/statistics.rb, line 48 def spawn! @spawns += 1 end