Class: Resque::Integration::QueuesInfo::Config
- Inherits:
-
Object
- Object
- Resque::Integration::QueuesInfo::Config
- Defined in:
- lib/resque/integration/queues_info/config.rb
Instance Method Summary collapse
- #channel(queue) ⇒ Object
- #data ⇒ Object
-
#initialize(config_path) ⇒ Config
constructor
A new instance of Config.
- #max_age(queue) ⇒ Object
- #max_failures_count(queue, period) ⇒ Object
- #max_size(queue) ⇒ Object
- #warn_age(queue) ⇒ Object
- #warn_channel(queue) ⇒ Object
- #warn_failures_count(queue, period) ⇒ Object
- #warn_size(queue) ⇒ Object
Constructor Details
#initialize(config_path) ⇒ Config
Returns a new instance of Config.
7 8 9 10 11 |
# File 'lib/resque/integration/queues_info/config.rb', line 7 def initialize(config_path) config = load_config(config_path) @defaults = config['defaults'] @queues = (config['queues']) end |
Instance Method Details
#channel(queue) ⇒ Object
37 38 39 40 |
# File 'lib/resque/integration/queues_info/config.rb', line 37 def channel(queue) channel = threshold(queue, 'channel') Array.wrap(channel).join(' ') end |
#data ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/resque/integration/queues_info/config.rb', line 47 def data @data ||= @queues.map do |queue_name, _queue_params| { '{#QUEUE}' => queue_name, '{#CHANNEL}' => channel(queue_name), '{#THRESHOLD_AGE}' => max_age(queue_name), '{#THRESHOLD_SIZE}' => max_size(queue_name), '{#THRESHOLD_FAILURES_PER_5M}' => max_failures_count(queue_name, '5m'), '{#THRESHOLD_FAILURES_PER_1H}' => max_failures_count(queue_name, '1h'), '{#WARNING_CHANNEL}' => warn_channel(queue_name), '{#WARNING_AGE}' => warn_age(queue_name), '{#WARNING_SIZE}' => warn_size(queue_name), '{#WARNING_FAILURES_PER_5M}' => warn_failures_count(queue_name, '5m'), '{#WARNING_FAILURES_PER_1H}' => warn_failures_count(queue_name, '1h') } end end |
#max_age(queue) ⇒ Object
13 14 15 |
# File 'lib/resque/integration/queues_info/config.rb', line 13 def max_age(queue) threshold(queue, 'max_age') end |
#max_failures_count(queue, period) ⇒ Object
29 30 31 |
# File 'lib/resque/integration/queues_info/config.rb', line 29 def max_failures_count(queue, period) threshold(queue, "max_failures_count_per_#{period}") end |
#max_size(queue) ⇒ Object
21 22 23 |
# File 'lib/resque/integration/queues_info/config.rb', line 21 def max_size(queue) threshold(queue, 'max_size') end |
#warn_age(queue) ⇒ Object
17 18 19 |
# File 'lib/resque/integration/queues_info/config.rb', line 17 def warn_age(queue) threshold(queue, 'warn_age') end |
#warn_channel(queue) ⇒ Object
42 43 44 45 |
# File 'lib/resque/integration/queues_info/config.rb', line 42 def warn_channel(queue) channel = threshold(queue, 'warn_channel') Array.wrap(channel).join(' ') end |
#warn_failures_count(queue, period) ⇒ Object
33 34 35 |
# File 'lib/resque/integration/queues_info/config.rb', line 33 def warn_failures_count(queue, period) threshold(queue, "warn_failures_count_per_#{period}") end |
#warn_size(queue) ⇒ Object
25 26 27 |
# File 'lib/resque/integration/queues_info/config.rb', line 25 def warn_size(queue) threshold(queue, 'warn_size') end |