Sha256: 27dd4a5f587a0fae20408e2130513afdd9eb2a7e1737de0386a74f39f42e2736

Contents?: true

Size: 514 Bytes

Versions: 1

Compression:

Stored size: 514 Bytes

Contents

module Stackprofiler
  class DataCollector
    def initialize(app, options = {})
      @app = app
    end

    def call(env)
      puts env['PATH_INFO']
      if env['QUERY_STRING'] =~ /profile=true/
        out = nil
        profile = StackProf.run(mode: :wall, interval: 1000, raw: true) { out = @app.call env }

        req = Rack::Request.new env
        run = Run.new req.fullpath, profile, Time.now
        RunDataSource.runs << run

        out
      else
        @app.call env
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stackprofiler-0.0.1 lib/stackprofiler/data_collector.rb