Class: InfluxDB::Metrics::Controller

Inherits:
Event
  • Object
show all
Defined in:
lib/influxdb/metrics/controller.rb

Instance Method Summary collapse

Methods inherited from Event

#subscribe

Instance Method Details

#handle(_name, start, finish, _id, payload) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/influxdb/metrics/controller.rb', line 11

def handle(_name, start, finish, _id, payload)
  metric = shared_info(start, finish, payload)
  timing = duration(start, finish)

  view = (payload[:view_runtime] || 0).ceil
  db =  (payload[:db_runtime] || 0).ceil

  write_point 'controller', metric.merge(value: timing)
  write_point 'view', metric.merge(value: view)
  write_point 'db', metric.merge(value: db)
rescue => e
  log :debug, "Unable to process action: #{e.message}"
end

#subscribe_toObject



7
8
9
# File 'lib/influxdb/metrics/controller.rb', line 7

def subscribe_to
  'process_action.action_controller'
end