Class: Sidekiq::Routing::QueueComposition::Report
- Inherits:
-
Struct
- Object
- Struct
- Sidekiq::Routing::QueueComposition::Report
- Defined in:
- lib/sidekiq/routing/queue_composition.rb
Instance Attribute Summary collapse
-
#queue ⇒ Object
Returns the value of attribute queue.
-
#rows ⇒ Object
Returns the value of attribute rows.
-
#scan_limit ⇒ Object
Returns the value of attribute scan_limit.
-
#scanned ⇒ Object
Returns the value of attribute scanned.
-
#size ⇒ Object
Returns the value of attribute size.
Instance Method Summary collapse
- #offender ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ Object (also: #inspect)
Instance Attribute Details
#queue ⇒ Object
Returns the value of attribute queue
10 11 12 |
# File 'lib/sidekiq/routing/queue_composition.rb', line 10 def queue @queue end |
#rows ⇒ Object
Returns the value of attribute rows
10 11 12 |
# File 'lib/sidekiq/routing/queue_composition.rb', line 10 def rows @rows end |
#scan_limit ⇒ Object
Returns the value of attribute scan_limit
10 11 12 |
# File 'lib/sidekiq/routing/queue_composition.rb', line 10 def scan_limit @scan_limit end |
#scanned ⇒ Object
Returns the value of attribute scanned
10 11 12 |
# File 'lib/sidekiq/routing/queue_composition.rb', line 10 def scanned @scanned end |
#size ⇒ Object
Returns the value of attribute size
10 11 12 |
# File 'lib/sidekiq/routing/queue_composition.rb', line 10 def size @size end |
Instance Method Details
#offender ⇒ Object
11 12 13 |
# File 'lib/sidekiq/routing/queue_composition.rb', line 11 def offender rows.first end |
#to_h ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/sidekiq/routing/queue_composition.rb', line 15 def to_h { "queue" => queue, "rows" => rows.map(&:dup), "scanned" => scanned, "size" => size, "scan_limit" => scan_limit } end |
#to_s ⇒ Object Also known as: inspect
25 26 27 28 29 30 31 32 |
# File 'lib/sidekiq/routing/queue_composition.rb', line 25 def to_s lines = rows.map do |row| age = row["oldest_age_seconds"] ? "#{row["oldest_age_seconds"].round}s ago" : "n/a" format("%-55s count=%-9d oldest=%s", row["class"], row["count"], age) end lines << "scanned #{scanned} of #{size} (cap #{scan_limit})" lines.join("\n") end |