Module: Watchman::Rails::ControllerBenchmark

Defined in:
lib/watchman/rails/controller_benchmark.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
# File 'lib/watchman/rails/controller_benchmark.rb', line 5

def self.included(base)
  base.class_eval do
    around_action :watchman_rails_controller_benchmark
  end
end

Instance Method Details

#watchman_rails_controller_benchmarkObject



11
12
13
14
15
16
17
18
19
# File 'lib/watchman/rails/controller_benchmark.rb', line 11

def watchman_rails_controller_benchmark
  bench_controller_name = self.class
                              .name
                              .underscore
                              .gsub("/", "_")
                              .gsub(/_controller$/, "")

  Watchman.benchmark("rails.controllers", :tags => [bench_controller_name, action_name]) { yield }
end