Class: Events

Inherits:
InformatorBase show all
Defined in:
lib/ns24-dashing-collector/informators/events.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEvents

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_pObject

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

#redisObject (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

#infoObject



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

#metricObject



17
18
19
# File 'lib/ns24-dashing-collector/informators/events.rb', line 17

def metric
  'events_processed'
end