Class: Events
- Inherits:
-
InformatorBase
- Object
- InformatorBase
- Events
- Defined in:
- lib/ns24-dashing-collector/informators/events.rb
Instance Attribute Summary collapse
-
#prev_p ⇒ Object
Returns the value of attribute prev_p.
-
#redis ⇒ Object
readonly
Returns the value of attribute redis.
Instance Method Summary collapse
- #info ⇒ Object
-
#initialize ⇒ Events
constructor
A new instance of Events.
- #metric ⇒ Object
Constructor Details
#initialize ⇒ Events
Returns a new instance of Events.
7 8 9 10 11 |
# File 'lib/ns24-dashing-collector/informators/events.rb', line 7 def initialize # configurize host = '172.22.11.142' @redis = Redis::Namespace.new('staging-resque', redis: Redis.new(host: host)) end |
Instance Attribute Details
#prev_p ⇒ Object
Returns the value of attribute prev_p.
15 16 17 |
# File 'lib/ns24-dashing-collector/informators/events.rb', line 15 def prev_p @prev_p end |
#redis ⇒ Object (readonly)
Returns the value of attribute redis.
13 14 15 |
# File 'lib/ns24-dashing-collector/informators/events.rb', line 13 def redis @redis end |
Instance Method Details
#info ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/ns24-dashing-collector/informators/events.rb', line 21 def info p = redis.get('stat:processed').to_i res = {current: p, last: prev_p || p} self.prev_p = p res end |
#metric ⇒ Object
17 18 19 |
# File 'lib/ns24-dashing-collector/informators/events.rb', line 17 def metric 'events_processed' end |