Sha256: cf4816672cd93913cd94ac43f3f834304a223967bda29d9ebd70b615c540ae77

Contents?: true

Size: 1.07 KB

Versions: 9

Compression:

Stored size: 1.07 KB

Contents

module Speedup
  module Collectors
    class RequestCollector < Collector


      def parse_options
        # pass
      end

      # The data results that are inserted at the end of the request for use in
      # deferred placeholders in the Peek the bar.
      #
      # Returns Hash.
      def results
        {}
      end

      def setup_subscribes
        register('process_action.action_controller')
      end


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

      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

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
speedup-rails-0.0.15 lib/speedup/collectors/request_collector.rb
speedup-rails-0.0.13 lib/speedup/collectors/request_collector.rb
speedup-rails-0.0.12 lib/speedup/collectors/request_collector.rb
speedup-rails-0.0.10 lib/speedup/collectors/request_collector.rb
speedup-rails-0.0.9 lib/speedup/collectors/request_collector.rb
speedup-rails-0.0.7 lib/speedup/collectors/request_collector.rb
speedup-rails-0.0.6 lib/speedup/collectors/request_collector.rb
speedup-rails-0.0.3 lib/speedup/collectors/request_collector.rb
speedup-rails-0.0.2 lib/speedup/collectors/request_collector.rb