Sha256: 311a8de0357b5d82f9d81eb75b1c864ee9ae17958a067048f855dbdec48bb57a
Contents?: true
Size: 726 Bytes
Versions: 7
Compression:
Stored size: 726 Bytes
Contents
module SystemMetrics class Middleware def initialize(app, collector, path_exclude_patterns) @app = app @collector = collector @path_exclude_patterns = path_exclude_patterns end def call(env) if exclude_path? env["PATH_INFO"] @app.call(env) else @collector.collect do response = notifications.instrument "request.rack", :path => env["PATH_INFO"], :method => env["REQUEST_METHOD"] do @app.call(env) end end end end protected def exclude_path?(path) @path_exclude_patterns.any? { |pattern| pattern =~ path } end def notifications ActiveSupport::Notifications end end end
Version data entries
7 entries across 7 versions & 1 rubygems