Class: Memprof::Tracer

Inherits:
Object
  • Object
show all
Defined in:
lib/memprof/tracer.rb

Overview

Middleware for tracing requests

require 'memprof/tracer'
config.middleware.use(Memprof::Tracer)

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Tracer

Returns a new instance of Tracer.



13
14
15
# File 'lib/memprof/tracer.rb', line 13

def initialize(app)
  @app=app
end

Instance Method Details

#call(env) ⇒ Object



16
17
18
19
# File 'lib/memprof/tracer.rb', line 16

def call(env)
  Memprof.trace_filename ||= "/tmp/memprof_tracer-#{Process.pid}.json"
  Memprof.trace_request(env){ @app.call(env) }
end