Class: Harness::RackInstrumenter
- Inherits:
-
Object
- Object
- Harness::RackInstrumenter
- Includes:
- Instrumentation
- Defined in:
- lib/harness/rack.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, namespace = nil) ⇒ RackInstrumenter
constructor
A new instance of RackInstrumenter.
- #stat_name(name, type = nil) ⇒ Object
Constructor Details
#initialize(app, namespace = nil) ⇒ RackInstrumenter
Returns a new instance of RackInstrumenter.
9 10 11 |
# File 'lib/harness/rack.rb', line 9 def initialize(app, namespace = nil) @app, @namespace = app, namespace end |
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/harness/rack.rb', line 13 def call(env) status, headers, body = time stat_name('rack.request', 'all') do @app.call env end increment "#{stat_name("rack.request")}.#{status}" [status, headers, body] end |
#stat_name(name, type = nil) ⇒ Object
23 24 25 |
# File 'lib/harness/rack.rb', line 23 def stat_name(name, type = nil) [name, @namespace, type].compact.join('.') end |