24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/newrelic/thor.rb', line 24
def self.included(base)
base.class_eval do
include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation
no_commands do
alias_method :invoke_command_original, :invoke_command
def invoke_command(*args)
command = args.first
return unless perform_trace_for_command?(command)
::NewRelic::Thor.start
trace_options = {
:class_name => self.class.name,
:name => command.name,
:category => "OtherTransaction/Thor"
}
perform_action_with_newrelic_trace(trace_options) do
invoke_command_original(*args)
end
end
end
private
def perform_trace_for_command?(command)
!BLACKLISTED_COMMAND_NAMES.include?(command.name)
end
end
end
|