Class: SimpleApm::Rack
- Inherits:
-
Object
- Object
- SimpleApm::Rack
- Defined in:
- lib/simple_apm/engine.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Rack
constructor
A new instance of Rack.
Constructor Details
#initialize(app) ⇒ Rack
Returns a new instance of Rack.
3 4 5 |
# File 'lib/simple_apm/engine.rb', line 3 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/simple_apm/engine.rb', line 7 def call(env) if SimpleApm::Redis.ping && SimpleApm::Redis.running? SimpleApm::ProcessingThread.start! Thread.current['action_dispatch.request_id'] = env['action_dispatch.request_id'] Thread.current[:current_process_memory] = GetProcessMem.new.mb Thread.current[:net_http_during] = 0.0 end @app.call(env) end |