lib/stackprof/middleware.rb in stackprof-0.2.7 vs lib/stackprof/middleware.rb in stackprof-0.2.8
- old
+ new
@@ -7,18 +7,19 @@
@options = options
@num_reqs = options[:save_every] || nil
Middleware.mode = options[:mode] || :cpu
Middleware.interval = options[:interval] || 1000
+ Middleware.raw = options[:raw] || false
Middleware.enabled = options[:enabled]
Middleware.path = options[:path] || 'tmp'
at_exit{ Middleware.save } if options[:save_at_exit]
end
def call(env)
enabled = Middleware.enabled?(env)
- StackProf.start(mode: Middleware.mode, interval: Middleware.interval) if enabled
+ StackProf.start(mode: Middleware.mode, interval: Middleware.interval, raw: Middleware.raw) if enabled
@app.call(env)
ensure
if enabled
StackProf.stop
if @num_reqs && (@num_reqs-=1) == 0
@@ -27,10 +28,10 @@
end
end
end
class << self
- attr_accessor :enabled, :mode, :interval, :path
+ attr_accessor :enabled, :mode, :interval, :raw, :path
def enabled?(env)
if enabled.respond_to?(:call)
enabled.call(env)
else