class RailsPerformance::Rails::MiddlewareTraceStorerAndCleanup
Public Class Methods
new(app)
click to toggle source
# File lib/rails_performance/rails/middleware.rb, line 4 def initialize(app) @app = app end
Public Instance Methods
call(env)
click to toggle source
# File lib/rails_performance/rails/middleware.rb, line 8 def call(env) dup.call!(env) end
call!(env)
click to toggle source
# File lib/rails_performance/rails/middleware.rb, line 12 def call!(env) if %r{#{RailsPerformance.mount_at}}.match?(env["PATH_INFO"]) RailsPerformance.skip = true end @status, @headers, @response = @app.call(env) if !RailsPerformance.skip RailsPerformance::Models::TraceRecord.new( request_id: CurrentRequest.current.request_id, value: CurrentRequest.current.tracings ).save end CurrentRequest.cleanup [@status, @headers, @response] end