Class: Lambdakiq::Metrics

Inherits:
Object
  • Object
show all
Defined in:
lib/lambdakiq/metrics.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event) ⇒ Metrics

Returns a new instance of Metrics.



11
12
13
14
15
16
# File 'lib/lambdakiq/metrics.rb', line 11

def initialize(event)
  @event = event
  @metrics = []
  @properties = {}
  instrument!
end

Instance Attribute Details

#eventObject (readonly)

Returns the value of attribute event.



3
4
5
# File 'lib/lambdakiq/metrics.rb', line 3

def event
  @event
end

Class Method Details

.log(event) ⇒ Object



6
7
8
# File 'lib/lambdakiq/metrics.rb', line 6

def log(event)
  new(event).log
end

Instance Method Details

#logObject



18
19
20
21
# File 'lib/lambdakiq/metrics.rb', line 18

def log
  return unless lambdakiq?
  logger.info JSON.dump(message)
end