Class: RServiceBus2::Stats
- Inherits:
-
Object
- Object
- RServiceBus2::Stats
- Defined in:
- lib/rservicebus2/stats.rb
Overview
Used to collect various run time stats for runtime reporting
Instance Method Summary collapse
- #inc(key) ⇒ Object
- #inc_message_type(class_name) ⇒ Object
- #inc_total_errored ⇒ Object
- #inc_total_processed ⇒ Object
- #inc_total_published ⇒ Object
- #inc_total_reply ⇒ Object
- #inc_total_sent ⇒ Object
-
#initialize ⇒ Stats
constructor
A new instance of Stats.
Constructor Details
#initialize ⇒ Stats
Returns a new instance of Stats.
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rservicebus2/stats.rb', line 4 def initialize @hash = {} @total_processed = 0 @total_errored = 0 @total_sent = 0 @total_published = 0 @total_reply = 0 @total_by_message_type = {} @written = false end |
Instance Method Details
#inc(key) ⇒ Object
38 39 40 41 |
# File 'lib/rservicebus2/stats.rb', line 38 def inc(key) @hash[key] = 0 if @hash[key].nil? @hash[key] += 1 end |
#inc_message_type(class_name) ⇒ Object
43 44 45 46 |
# File 'lib/rservicebus2/stats.rb', line 43 def (class_name) @total_by_message_type[class_name] = 0 if @total_by_message_type[class_name].nil? @total_by_message_type[class_name] += 1 end |
#inc_total_errored ⇒ Object
22 23 24 |
# File 'lib/rservicebus2/stats.rb', line 22 def inc_total_errored @total_errored += 1 end |
#inc_total_processed ⇒ Object
18 19 20 |
# File 'lib/rservicebus2/stats.rb', line 18 def inc_total_processed @total_processed += 1 end |
#inc_total_published ⇒ Object
30 31 32 |
# File 'lib/rservicebus2/stats.rb', line 30 def inc_total_published @total_published += 1 end |
#inc_total_reply ⇒ Object
34 35 36 |
# File 'lib/rservicebus2/stats.rb', line 34 def inc_total_reply @total_reply += 1 end |
#inc_total_sent ⇒ Object
26 27 28 |
# File 'lib/rservicebus2/stats.rb', line 26 def inc_total_sent @total_sent += 1 end |