diff --git a/lib/resque/integration/queues_info/config.rb b/lib/resque/integration/queues_info/config.rb index 7770c2b..15d409f 100644 --- a/lib/resque/integration/queues_info/config.rb +++ b/lib/resque/integration/queues_info/config.rb @@ -27,9 +27,14 @@ def channel(queue) end def data - @data ||= @queues.map do |k, v| + @data ||= @queues.map do |queue_name, _queue_params| { - "{#QUEUE}" => k + '{#QUEUE}' => 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'), + '{#CHANNEL}' => channel(queue_name) } end end diff --git a/spec/resque/integration/queues_info_spec.rb b/spec/resque/integration/queues_info_spec.rb index 502b691..be30e5d 100644 --- a/spec/resque/integration/queues_info_spec.rb +++ b/spec/resque/integration/queues_info_spec.rb @@ -326,4 +326,35 @@ expect(queue_info.threshold_failures_count(third_queue_name, '1h')).to eq 70 end end + + describe '#data' do + it do + expect(queue_info.data).to eq [ + { + '{#QUEUE}' => 'first', + '{#THRESHOLD_AGE}' => 20, + '{#THRESHOLD_SIZE}' => 100, + '{#THRESHOLD_FAILURES_PER_5M}' => 15, + '{#THRESHOLD_FAILURES_PER_1H}' => 90, + '{#CHANNEL}' => 'first' + }, + { + '{#QUEUE}' => 'third', + '{#THRESHOLD_AGE}' => 30, + '{#THRESHOLD_SIZE}' => 100, + '{#THRESHOLD_FAILURES_PER_5M}' => 15, + '{#THRESHOLD_FAILURES_PER_1H}' => 70, + '{#CHANNEL}' => 'first' + }, + { + '{#QUEUE}' => 'second_queue', + '{#THRESHOLD_AGE}' => nil, + '{#THRESHOLD_SIZE}' => nil, + '{#THRESHOLD_FAILURES_PER_5M}' => nil, + '{#THRESHOLD_FAILURES_PER_1H}' => nil, + '{#CHANNEL}' => 'first second' + } + ] + end + end end