Class: Airbrake::Queue
- Inherits:
-
Object
- Object
- Airbrake::Queue
- Includes:
- HashKeyable, Ignorable, Stashable
- Defined in:
- lib/airbrake-ruby/queue.rb
Overview
Queue represents a queue (worker).
Instance Attribute Summary collapse
Attributes included from Ignorable
Instance Method Summary collapse
- #cargo ⇒ Object
- #destination ⇒ Object
- #hash ⇒ Object
-
#initialize(queue:, error_count:, groups: {}, timing: nil, time: Time.now) ⇒ Queue
constructor
A new instance of Queue.
- #merge(other) ⇒ Object
-
#route ⇒ String
Queues don’t have routes, but we want to define this to make sure our filter API is consistent (other models define this property).
- #to_h ⇒ Object
Methods included from Stashable
Methods included from Ignorable
Methods included from HashKeyable
Constructor Details
#initialize(queue:, error_count:, groups: {}, timing: nil, time: Time.now) ⇒ Queue
Returns a new instance of Queue.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/airbrake-ruby/queue.rb', line 14 def initialize( queue:, error_count:, groups: {}, timing: nil, time: Time.now ) @time_utc = TimeTruncate.utc_truncate_minutes(time) @queue = queue @error_count = error_count @groups = groups @timing = timing @time = time end |
Instance Attribute Details
#error_count ⇒ Object
12 13 14 |
# File 'lib/airbrake-ruby/queue.rb', line 12 def error_count @error_count end |
#groups ⇒ Object
12 13 14 |
# File 'lib/airbrake-ruby/queue.rb', line 12 def groups @groups end |
#queue ⇒ Object
12 13 14 |
# File 'lib/airbrake-ruby/queue.rb', line 12 def queue @queue end |
#time ⇒ Object
12 13 14 |
# File 'lib/airbrake-ruby/queue.rb', line 12 def time @time end |
#timing ⇒ Object
12 13 14 |
# File 'lib/airbrake-ruby/queue.rb', line 12 def timing @timing end |
Instance Method Details
#cargo ⇒ Object
33 34 35 |
# File 'lib/airbrake-ruby/queue.rb', line 33 def cargo 'queues' end |
#destination ⇒ Object
29 30 31 |
# File 'lib/airbrake-ruby/queue.rb', line 29 def destination 'queues-stats' end |
#hash ⇒ Object
45 46 47 48 49 50 |
# File 'lib/airbrake-ruby/queue.rb', line 45 def hash { 'queue' => queue, 'time' => @time_utc, }.hash end |
#merge(other) ⇒ Object
52 53 54 |
# File 'lib/airbrake-ruby/queue.rb', line 52 def merge(other) self.error_count += other.error_count end |
#route ⇒ String
Queues don’t have routes, but we want to define this to make sure our filter API is consistent (other models define this property)
61 62 63 |
# File 'lib/airbrake-ruby/queue.rb', line 61 def route '' end |
#to_h ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/airbrake-ruby/queue.rb', line 37 def to_h { 'queue' => queue, 'errorCount' => error_count, 'time' => @time_utc, } end |