Class: ScoutApm::Instruments::MiddlewareDetailed::MiddlewareWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/scout_apm/instruments/middleware_detailed.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, name) ⇒ MiddlewareWrapper

Returns a new instance of MiddlewareWrapper.



38
39
40
41
42
# File 'lib/scout_apm/instruments/middleware_detailed.rb', line 38

def initialize(app, name)
  @app = app
  @type = "Middleware"
  @name = name
end

Instance Method Details

#call(env) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/scout_apm/instruments/middleware_detailed.rb', line 44

def call(env)
  req = ScoutApm::RequestManager.lookup
  req.start_layer( ScoutApm::Layer.new(@type, @name) )
  @app.call(env)
ensure
  req.stop_layer
end