Class: Takwimu::Rack
- Inherits:
-
Object
- Object
- Takwimu::Rack
- Defined in:
- lib/takwimu/rack.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, reporter, options = {}) ⇒ Rack
constructor
A new instance of Rack.
Constructor Details
#initialize(app, reporter, options = {}) ⇒ Rack
Returns a new instance of Rack.
4 5 6 7 8 |
# File 'lib/takwimu/rack.rb', line 4 def initialize(app, reporter, = {}) @reporter = reporter @meters = Array(.fetch(:meters, [ResourceUsage])) @app = build_instrumented_app(app, @meters) end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/takwimu/rack.rb', line 10 def call(env) env[TIMINGS] = {} env[GAUGES] = [] @app.call(env).tap { @reporter.report env } end |