Sha256: 95590621b9b8038535fdb9f4b84ded98522f7292b9a7373b148dc50922a2c5a4
Contents?: true
Size: 1003 Bytes
Versions: 3
Compression:
Stored size: 1003 Bytes
Contents
require 'fozzie_rails' require 'fozzie/rack/middleware' module Fozzie module Rails # Time and record each request through a given Rails app # This middlewware times server processing for a resource, not view render. class Middleware < Fozzie::Rack::Middleware # Generates the statistics key for the current path def generate_key(env) path_str, request_method = env['PATH_INFO'], env['REQUEST_METHOD'] return nil unless path_str begin routing = routing_lookup path = routing.recognize_path(path_str, :method => request_method) stat = [path[:controller], path[:action], "render"].join('.') stat rescue => exc S.increment "routing.error" nil end end def routing_lookup (rails_version >= 3 ? ::Rails.application.routes : ::ActionController::Routing::Routes) end def rails_version ::Rails.version.to_i end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fozzie_rails-0.0.4 | lib/fozzie/rails/middleware.rb |
fozzie_rails-0.0.2 | lib/fozzie/rails/middleware.rb |
fozzie_rails-0.0.1 | lib/fozzie/rails/middleware.rb |