Class: SidekiqQueueStatus::Metric

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq_queue_status/metric.rb

Direct Known Subclasses

FailureRate, QueueLatency

Defined Under Namespace

Classes: Result

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMetric

Returns a new instance of Metric.



15
16
17
18
# File 'lib/sidekiq_queue_status/metric.rb', line 15

def initialize
  @errors = []
  @result = monitor
end

Class Attribute Details

.configObject

Returns the value of attribute config.



6
7
8
# File 'lib/sidekiq_queue_status/metric.rb', line 6

def config
  @config
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



14
15
16
# File 'lib/sidekiq_queue_status/metric.rb', line 14

def errors
  @errors
end

#resultObject (readonly)

Returns the value of attribute result.



14
15
16
# File 'lib/sidekiq_queue_status/metric.rb', line 14

def result
  @result
end

Class Method Details

.allObject



7
8
9
10
11
# File 'lib/sidekiq_queue_status/metric.rb', line 7

def all
  metrics = QueueLatency.new, FailureRate.new
  errors = metrics.map(&:errors).flatten
  Result.new(*metrics.map(&:result), errors)
end

Instance Method Details

#error(message) ⇒ Object



20
21
22
# File 'lib/sidekiq_queue_status/metric.rb', line 20

def error(message)
  @errors << message
end