Class: Speedup::Collectors::RequestCollector

Inherits:
Collector
  • Object
show all
Defined in:
lib/speedup/collectors/request_collector.rb

Instance Method Summary collapse

Methods inherited from Collector

#context_id, #dom_id, #enabled?, #initialize, #key, key, #register, #render?, #store_event, #subscribe

Constructor Details

This class inherits a constructor from Speedup::Collectors::Collector

Instance Method Details

#event_to_data(evt) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/speedup/collectors/request_collector.rb', line 27

def event_to_data(evt)
  data = {}
  data[:time] = evt.time
  data[:duration] = evt.duration
  data[:controller] = evt.payload[:controller]
  data[:action] = evt.payload[:action]
  data[:path] = evt.payload[:path]
  if evt.payload.key?(:exception)
    data[:error] = true
    Speedup.request.store_event(:exception, evt.payload[:exception] )
  end
  data[:view_duration] = evt.payload[:view_runtime]
  data[:db_duration] = evt.payload[:db_runtime]

  data
end

#filter_event?(evt) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/speedup/collectors/request_collector.rb', line 23

def filter_event?(evt)
  super || evt.payload[:controller].start_with?('Speedup')
end

#parse_optionsObject



6
7
8
# File 'lib/speedup/collectors/request_collector.rb', line 6

def parse_options
  # pass
end

#resultsObject

The data results that are inserted at the end of the request for use in deferred placeholders in the Peek the bar.

Returns Hash.



14
15
16
# File 'lib/speedup/collectors/request_collector.rb', line 14

def results
  {}
end

#setup_subscribesObject



18
19
20
# File 'lib/speedup/collectors/request_collector.rb', line 18

def setup_subscribes
  register('process_action.action_controller')
end