class Woody::Statsd::Sinatra::Middleware
Public Class Methods
new(app)
click to toggle source
# File lib/woody/statsd/sinatra/middleware.rb, line 7 def initialize(app) @app = app end
Public Instance Methods
call(env)
click to toggle source
# File lib/woody/statsd/sinatra/middleware.rb, line 11 def call(env) start_time = Time.now status, headers, body = @app.call(env) time_took = (1000 * (Time.now - start_time)).round if stat = env[Helpers::RACK_ENV_KEY] Reporter.report(stat, time_took, status) end [status, headers, body] end