Class: Insight::Instrumentation::Setup
- Inherits:
-
Object
- Object
- Insight::Instrumentation::Setup
- Defined in:
- lib/insight/instrumentation/setup.rb
Instance Method Summary (collapse)
- - (Object) call(env)
-
- (Setup) initialize(app)
constructor
A new instance of Setup.
- - (Object) setup(env)
- - (Object) teardown(env, status, headers, body)
Constructor Details
- (Setup) initialize(app)
A new instance of Setup
3 4 5 |
# File 'lib/insight/instrumentation/setup.rb', line 3 def initialize(app) @app = app end |
Instance Method Details
- (Object) call(env)
25 26 27 28 29 30 |
# File 'lib/insight/instrumentation/setup.rb', line 25 def call(env) setup(env) status, headers, body = @app.call(env) teardown(env, status, headers, body) return [status, headers, body] end |
- (Object) setup(env)
7 8 9 10 11 12 13 14 15 |
# File 'lib/insight/instrumentation/setup.rb', line 7 def setup(env) instrument = Instrument.new PackageDefinition.start instrument.start(env) env["insight.instrument"] = instrument Thread::current["insight.instrument"] = instrument end |
- (Object) teardown(env, status, headers, body)
17 18 19 20 21 22 23 |
# File 'lib/insight/instrumentation/setup.rb', line 17 def teardown(env, status, headers, body) instrument, env["insight.instrument"] = env["insight.instrument"], nil instrument.finish(env, status, headers, body) Thread::current["insight.instrument"] = nil env["insight.duration"] = instrument.duration end |