class SimpleApm::Rack

Public Class Methods

new(app) click to toggle source
# File lib/simple_apm/engine.rb, line 3
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# 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