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.



42
43
44
45
46
# File 'lib/scout_apm/instruments/middleware_detailed.rb', line 42

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

Instance Method Details

#call(env) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/scout_apm/instruments/middleware_detailed.rb', line 48

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