class Resilient::CircuitBreaker::Metrics::Bucket

Attributes

timestamp_end[R]
timestamp_start[R]

Public Class Methods

new(timestamp_start, timestamp_end) click to toggle source
# File lib/resilient/circuit_breaker/metrics/bucket.rb, line 8
def initialize(timestamp_start, timestamp_end)
  @timestamp_start = timestamp_start
  @timestamp_end = timestamp_end
end

Public Instance Methods

include?(timestamp) click to toggle source
# File lib/resilient/circuit_breaker/metrics/bucket.rb, line 17
def include?(timestamp)
  timestamp >= @timestamp_start && timestamp <= @timestamp_end
end
prune_before(window_size) click to toggle source
# File lib/resilient/circuit_breaker/metrics/bucket.rb, line 13
def prune_before(window_size)
  @timestamp_end - window_size.seconds
end