Class: ScoutApm::Instant::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/scout_apm/instant/middleware.rb

Overview

Note that this middleware never even gets inserted unless Rails environment is development (See Railtie)

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



48
49
50
# File 'lib/scout_apm/instant/middleware.rb', line 48

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



52
53
54
55
56
57
58
59
60
61
# File 'lib/scout_apm/instant/middleware.rb', line 52

def call(env)
  rack_response = @app.call(env)
  begin
    DevTraceResponseManipulator.new(env, rack_response).call
  rescue Exception => e
    # If anything went wrong at all, just bail out and return the unmodified response.
    ScoutApm::Agent.instance.context.logger.debug("DevTrace: Raised an exception: #{e.message}, #{e.backtrace}")
    rack_response
  end
end