Class: Pinba::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/pinba/middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



3
4
5
# File 'lib/pinba/middleware.rb', line 3

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
# File 'lib/pinba/middleware.rb', line 7

def call(env)
  Pinba.start :script_name => env['PATH_INFO']
  res = @app.call(env)
  Pinba.stop :status => res[0], :server_name => env['SERVER_NAME'], :document_size => res[1]['Content-Length'].to_i
  res
end