newrelic_rpm 6.3.0.355 → 6.8.0.360
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +50 -10
- data/CHANGELOG.md +198 -0
- data/Guardfile +7 -1
- data/lib/new_relic/agent.rb +80 -0
- data/lib/new_relic/agent/agent.rb +87 -26
- data/lib/new_relic/agent/agent_logger.rb +4 -0
- data/lib/new_relic/agent/attribute_filter.rb +7 -7
- data/lib/new_relic/agent/attributes.rb +152 -0
- data/lib/new_relic/agent/autostart.rb +19 -14
- data/lib/new_relic/agent/commands/agent_command_router.rb +2 -21
- data/lib/new_relic/agent/configuration/default_source.rb +129 -39
- data/lib/new_relic/agent/configuration/environment_source.rb +4 -2
- data/lib/new_relic/agent/configuration/event_harvest_config.rb +45 -0
- data/lib/new_relic/agent/configuration/high_security_source.rb +1 -0
- data/lib/new_relic/agent/configuration/manager.rb +13 -9
- data/lib/new_relic/agent/configuration/server_source.rb +33 -9
- data/lib/new_relic/agent/configuration/yaml_source.rb +10 -5
- data/lib/new_relic/agent/connect/request_builder.rb +11 -13
- data/lib/new_relic/agent/connect/response_handler.rb +1 -1
- data/lib/new_relic/agent/cross_app_monitor.rb +1 -1
- data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +2 -2
- data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +8 -8
- data/lib/new_relic/agent/distributed_trace_intrinsics.rb +90 -0
- data/lib/new_relic/agent/distributed_trace_metrics.rb +74 -0
- data/lib/new_relic/agent/distributed_trace_monitor.rb +2 -12
- data/lib/new_relic/agent/distributed_trace_payload.rb +9 -76
- data/lib/new_relic/agent/distributed_trace_transport_type.rb +43 -0
- data/lib/new_relic/agent/error_collector.rb +2 -2
- data/lib/new_relic/agent/error_event_aggregator.rb +2 -1
- data/lib/new_relic/agent/error_trace_aggregator.rb +1 -0
- data/lib/new_relic/agent/event_aggregator.rb +26 -32
- data/lib/new_relic/agent/guid_generator.rb +28 -0
- data/lib/new_relic/agent/inbound_request_monitor.rb +2 -2
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +24 -42
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +45 -69
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +70 -53
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +25 -18
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +33 -47
- data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +4 -4
- data/lib/new_relic/agent/instrumentation/grape.rb +2 -3
- data/lib/new_relic/agent/instrumentation/{evented_subscriber.rb → notifications_subscriber.rb} +7 -66
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +2 -3
- data/lib/new_relic/agent/javascript_instrumentor.rb +1 -1
- data/lib/new_relic/agent/logging.rb +129 -0
- data/lib/new_relic/agent/new_relic_service.rb +7 -9
- data/lib/new_relic/agent/priority_sampled_buffer.rb +2 -0
- data/lib/new_relic/agent/span_event_aggregator.rb +2 -4
- data/lib/new_relic/agent/span_event_primitive.rb +29 -7
- data/lib/new_relic/agent/sql_sampler.rb +1 -1
- data/lib/new_relic/agent/threading/backtrace_service.rb +3 -3
- data/lib/new_relic/agent/threading/thread_profile.rb +9 -23
- data/lib/new_relic/agent/trace_context.rb +244 -0
- data/lib/new_relic/agent/trace_context_payload.rb +134 -0
- data/lib/new_relic/agent/trace_context_request_monitor.rb +42 -0
- data/lib/new_relic/agent/tracer.rb +32 -0
- data/lib/new_relic/agent/transaction.rb +26 -20
- data/lib/new_relic/agent/transaction/abstract_segment.rb +2 -2
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +20 -101
- data/lib/new_relic/agent/transaction/external_request_segment.rb +18 -5
- data/lib/new_relic/agent/transaction/segment.rb +7 -1
- data/lib/new_relic/agent/transaction/trace.rb +3 -8
- data/lib/new_relic/agent/transaction/trace_builder.rb +0 -1
- data/lib/new_relic/agent/transaction/trace_context.rb +159 -0
- data/lib/new_relic/agent/transaction/trace_node.rb +8 -3
- data/lib/new_relic/agent/transaction_error_primitive.rb +4 -11
- data/lib/new_relic/agent/transaction_event_primitive.rb +3 -11
- data/lib/new_relic/agent/transaction_event_recorder.rb +3 -3
- data/lib/new_relic/agent/transaction_sampler.rb +1 -5
- data/lib/new_relic/cli/commands/deployments.rb +1 -1
- data/lib/new_relic/coerce.rb +29 -6
- data/lib/new_relic/control/instance_methods.rb +10 -1
- data/lib/new_relic/dependency_detection.rb +4 -4
- data/lib/new_relic/noticed_error.rb +8 -4
- data/lib/new_relic/rack/browser_monitoring.rb +10 -8
- data/lib/new_relic/version.rb +1 -1
- data/lib/tasks/config.rake +1 -2
- data/newrelic_rpm.gemspec +13 -4
- data/test/agent_helper.rb +95 -9
- data/true +0 -0
- metadata +58 -24
- data/lib/new_relic/agent/commands/xray_session.rb +0 -55
- data/lib/new_relic/agent/commands/xray_session_collection.rb +0 -161
- data/lib/new_relic/agent/configuration/event_data.rb +0 -39
- data/lib/new_relic/agent/transaction/attributes.rb +0 -154
- data/lib/new_relic/agent/transaction/xray_sample_buffer.rb +0 -64
- data/lib/tasks/versions.html.erb +0 -28
- data/lib/tasks/versions.postface.html +0 -8
- data/lib/tasks/versions.preface.html +0 -9
- data/lib/tasks/versions.rake +0 -65
- data/lib/tasks/versions.txt.erb +0 -14
@@ -0,0 +1,43 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# This file is distributed under New Relic's license terms.
|
3
|
+
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
|
+
|
5
|
+
module NewRelic
|
6
|
+
module Agent
|
7
|
+
module DistributedTraceTransportType
|
8
|
+
extend self
|
9
|
+
|
10
|
+
UNKNOWN = 'Unknown'.freeze
|
11
|
+
|
12
|
+
ALLOWABLE_TRANSPORT_TYPES = Set.new(%w[
|
13
|
+
Unknown
|
14
|
+
HTTP
|
15
|
+
HTTPS
|
16
|
+
Kafka
|
17
|
+
JMS
|
18
|
+
IronMQ
|
19
|
+
AMQP
|
20
|
+
Queue
|
21
|
+
Other
|
22
|
+
]).freeze
|
23
|
+
|
24
|
+
URL_SCHEMES = {
|
25
|
+
'http' => 'HTTP'.freeze,
|
26
|
+
'https' => 'HTTPS'.freeze
|
27
|
+
}
|
28
|
+
|
29
|
+
RACK_URL_SCHEME = 'rack.url_scheme'.freeze
|
30
|
+
|
31
|
+
def from value
|
32
|
+
return value if ALLOWABLE_TRANSPORT_TYPES.include?(value)
|
33
|
+
|
34
|
+
UNKNOWN
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
def for_rack_request request
|
39
|
+
URL_SCHEMES[request[RACK_URL_SCHEME]]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -18,9 +18,9 @@ module NewRelic
|
|
18
18
|
attr_reader :error_trace_aggregator, :error_event_aggregator
|
19
19
|
|
20
20
|
# Returns a new error collector
|
21
|
-
def initialize
|
21
|
+
def initialize events
|
22
22
|
@error_trace_aggregator = ErrorTraceAggregator.new(MAX_ERROR_QUEUE_LENGTH)
|
23
|
-
@error_event_aggregator = ErrorEventAggregator.new
|
23
|
+
@error_event_aggregator = ErrorEventAggregator.new events
|
24
24
|
|
25
25
|
# lookup of exception class names to ignore. Hash for fast access
|
26
26
|
@ignore = {}
|
@@ -13,7 +13,8 @@ module NewRelic
|
|
13
13
|
|
14
14
|
named :ErrorEventAggregator
|
15
15
|
capacity_key :'error_collector.max_event_samples_stored'
|
16
|
-
|
16
|
+
enabled_keys :'error_collector.enabled',
|
17
|
+
:'error_collector.capture_events'
|
17
18
|
buffer_class PrioritySampledBuffer
|
18
19
|
|
19
20
|
def record noticed_error, transaction_payload = nil
|
@@ -91,6 +91,7 @@ module NewRelic
|
|
91
91
|
|
92
92
|
def register_config_callbacks
|
93
93
|
Agent.config.register_callback(:'error_collector.enabled') do |enabled|
|
94
|
+
reset! if enabled == false
|
94
95
|
::NewRelic::Agent.logger.debug "Error traces will #{enabled ? '' : 'not '}be sent to the New Relic service."
|
95
96
|
end
|
96
97
|
end
|
@@ -8,20 +8,6 @@ module NewRelic
|
|
8
8
|
module Agent
|
9
9
|
class EventAggregator
|
10
10
|
class << self
|
11
|
-
# This architecture requires that every aggregator
|
12
|
-
# implementation provide its own `named`, `capacity_key`, and
|
13
|
-
# `enabled_...` settings. In particular, we do not allow
|
14
|
-
# subclasses to share these values from an intermediate
|
15
|
-
# superclass.
|
16
|
-
|
17
|
-
def inherited(subclass)
|
18
|
-
# Prevent uninitialized variable warnings; we have to do
|
19
|
-
# this as soon as the subclass is defined, before its
|
20
|
-
# implementor calls enabled_key() or enabled_fn().
|
21
|
-
subclass.instance_variable_set(:@enabled_key, nil)
|
22
|
-
subclass.instance_variable_set(:@enabled_fn, nil)
|
23
|
-
end
|
24
|
-
|
25
11
|
def named named = nil
|
26
12
|
named ? @named = named.to_s.freeze : @named
|
27
13
|
end
|
@@ -30,10 +16,25 @@ module NewRelic
|
|
30
16
|
key ? @capacity_key = key : @capacity_key
|
31
17
|
end
|
32
18
|
|
33
|
-
|
34
|
-
|
19
|
+
# An aggregator can specify one or more keys to check to see if it is
|
20
|
+
# enabled. Multiple keys will be &&'d and the enabled status of the
|
21
|
+
# aggregator will be reset when agent configuration changes.
|
22
|
+
|
23
|
+
def enabled_keys *keys
|
24
|
+
if keys.empty?
|
25
|
+
@enabled_keys ||= []
|
26
|
+
else
|
27
|
+
@enabled_keys = Array(keys)
|
28
|
+
@enabled_fn = ->(){ @enabled_keys.all? { |k| Agent.config[k] } }
|
29
|
+
end
|
35
30
|
end
|
36
31
|
|
32
|
+
alias_method :enabled_key, :enabled_keys
|
33
|
+
|
34
|
+
# This can be used instead of `enabled_key(s)` for more fine grained
|
35
|
+
# control over whether an aggregator should be enabled. The enabled fn
|
36
|
+
# will be reevaluated after configuration changes
|
37
|
+
|
37
38
|
def enabled_fn fn = nil
|
38
39
|
fn ? @enabled_fn = fn : @enabled_fn
|
39
40
|
end
|
@@ -47,13 +48,13 @@ module NewRelic
|
|
47
48
|
end
|
48
49
|
end
|
49
50
|
|
50
|
-
def initialize
|
51
|
+
def initialize events
|
51
52
|
@lock = Mutex.new
|
52
53
|
@buffer = self.class.buffer_class.new NewRelic::Agent.config[self.class.capacity_key]
|
53
|
-
@enabled = false
|
54
|
+
@enabled = self.class.enabled_fn ? self.class.enabled_fn.call : false
|
54
55
|
@notified_full = false
|
55
56
|
register_capacity_callback
|
56
|
-
register_enabled_callback
|
57
|
+
register_enabled_callback events
|
57
58
|
after_initialize
|
58
59
|
end
|
59
60
|
|
@@ -66,7 +67,6 @@ module NewRelic
|
|
66
67
|
end
|
67
68
|
|
68
69
|
def enabled?
|
69
|
-
return self.class.enabled_fn.call if self.class.enabled_fn
|
70
70
|
@enabled
|
71
71
|
end
|
72
72
|
|
@@ -126,18 +126,12 @@ module NewRelic
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
-
def register_enabled_callback
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
NewRelic::Agent.config.register_callback(self.class.enabled_key) do |enabled|
|
137
|
-
# intentionally unsynchronized for liveness
|
138
|
-
@enabled = enabled
|
139
|
-
::NewRelic::Agent.logger.debug "#{self.class.named} will #{enabled ? '' : 'not '}be sent to the New Relic service."
|
140
|
-
end
|
129
|
+
def register_enabled_callback events
|
130
|
+
events.subscribe(:server_source_configuration_added) {
|
131
|
+
@enabled = self.class.enabled_fn.call
|
132
|
+
reset! if @enabled == false
|
133
|
+
::NewRelic::Agent.logger.debug "#{self.class.named} will #{@enabled ? '' : 'not '}be sent to the New Relic service."
|
134
|
+
}
|
141
135
|
end
|
142
136
|
|
143
137
|
def notify_if_full
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# This file is distributed under New Relic's license terms.
|
3
|
+
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
|
+
|
5
|
+
module NewRelic
|
6
|
+
module Agent
|
7
|
+
module GuidGenerator
|
8
|
+
|
9
|
+
HEX_DIGITS = (0..15).map{|i| i.to_s(16)}
|
10
|
+
|
11
|
+
module_function
|
12
|
+
|
13
|
+
# This method intentionally does not use SecureRandom, because it relies
|
14
|
+
# on urandom, which raises an exception in MRI when the interpreter runs
|
15
|
+
# out of allocated file descriptors.
|
16
|
+
# The guids generated by this method may not be _secure_, but they are
|
17
|
+
# random enough for our purposes.
|
18
|
+
def generate_guid length = 16
|
19
|
+
guid = ''
|
20
|
+
length.times do |a|
|
21
|
+
guid << HEX_DIGITS[rand(16)]
|
22
|
+
end
|
23
|
+
guid
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -20,8 +20,8 @@ module NewRelic
|
|
20
20
|
attr_reader :obfuscator
|
21
21
|
|
22
22
|
def initialize(events)
|
23
|
-
events.subscribe(:
|
24
|
-
# This requires :encoding_key, so must wait until :
|
23
|
+
events.subscribe(:initial_configuration_complete) do
|
24
|
+
# This requires :encoding_key, so must wait until :initial_configuration_complete
|
25
25
|
setup_obfuscator
|
26
26
|
on_finished_configuring(events)
|
27
27
|
end
|
@@ -1,77 +1,59 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
|
-
require 'new_relic/agent/instrumentation/
|
4
|
+
require 'new_relic/agent/instrumentation/notifications_subscriber'
|
5
5
|
|
6
6
|
module NewRelic
|
7
7
|
module Agent
|
8
8
|
module Instrumentation
|
9
|
-
class ActionCableSubscriber <
|
9
|
+
class ActionCableSubscriber < NotificationsSubscriber
|
10
10
|
|
11
11
|
PERFORM_ACTION = 'perform_action.action_cable'.freeze
|
12
12
|
|
13
|
-
def start
|
13
|
+
def start(name, id, payload) #THREAD_LOCAL_ACCESS
|
14
14
|
return unless state.is_execution_traced?
|
15
|
-
|
16
|
-
if
|
17
|
-
|
15
|
+
|
16
|
+
finishable = if name == PERFORM_ACTION
|
17
|
+
Tracer.start_transaction_or_segment(
|
18
|
+
name: transaction_name_from_payload(payload),
|
19
|
+
category: :action_cable
|
20
|
+
)
|
18
21
|
else
|
19
|
-
|
22
|
+
Tracer.start_segment(name: metric_name_from_payload(name, payload))
|
20
23
|
end
|
24
|
+
push_segment(id, finishable)
|
21
25
|
rescue => e
|
22
26
|
log_notification_error e, name, 'start'
|
23
27
|
end
|
24
28
|
|
25
|
-
def finish
|
29
|
+
def finish(name, id, payload) #THREAD_LOCAL_ACCESS
|
26
30
|
return unless state.is_execution_traced?
|
27
|
-
|
31
|
+
|
28
32
|
notice_error payload if payload.key? :exception
|
29
|
-
|
30
|
-
|
31
|
-
else
|
32
|
-
stop_recording_metrics event
|
33
|
-
end
|
33
|
+
finishable = pop_segment(id)
|
34
|
+
finishable.finish if finishable
|
34
35
|
rescue => e
|
35
36
|
log_notification_error e, name, 'finish'
|
36
37
|
end
|
37
38
|
|
38
39
|
private
|
39
40
|
|
40
|
-
def
|
41
|
-
|
42
|
-
name: transaction_name_from_event(event),
|
43
|
-
category: :action_cable
|
44
|
-
)
|
45
|
-
end
|
46
|
-
|
47
|
-
def finish_transaction event
|
48
|
-
(finishable = event.payload[:finishable]) && finishable.finish
|
49
|
-
end
|
50
|
-
|
51
|
-
def start_recording_metrics event
|
52
|
-
event.payload[:segment] = Tracer.start_segment name: metric_name_from_event(event)
|
53
|
-
end
|
54
|
-
|
55
|
-
def stop_recording_metrics event
|
56
|
-
event.payload[:segment].finish if event.payload[:segment]
|
57
|
-
end
|
58
|
-
|
59
|
-
def transaction_name_from_event event
|
60
|
-
"Controller/ActionCable/#{event.payload[:channel_class]}/#{event.payload[:action]}"
|
41
|
+
def transaction_name_from_payload(payload)
|
42
|
+
"Controller/ActionCable/#{payload[:channel_class]}/#{payload[:action]}"
|
61
43
|
end
|
62
44
|
|
63
|
-
def
|
64
|
-
"Ruby/ActionCable/#{
|
45
|
+
def metric_name_from_payload(name, payload)
|
46
|
+
"Ruby/ActionCable/#{payload[:channel_class]}/#{action_name(name)}"
|
65
47
|
end
|
66
48
|
|
67
|
-
DOT_ACTION_CABLE =
|
68
|
-
EMPTY_STRING =
|
49
|
+
DOT_ACTION_CABLE = '.action_cable'.freeze
|
50
|
+
EMPTY_STRING = ''.freeze
|
69
51
|
|
70
|
-
def
|
71
|
-
|
52
|
+
def action_name(name)
|
53
|
+
name.gsub DOT_ACTION_CABLE, EMPTY_STRING
|
72
54
|
end
|
73
55
|
|
74
|
-
def notice_error
|
56
|
+
def notice_error(payload)
|
75
57
|
NewRelic::Agent.notice_error payload[:exception_object]
|
76
58
|
end
|
77
59
|
end
|
@@ -1,24 +1,24 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
|
-
require 'new_relic/agent/instrumentation/
|
4
|
+
require 'new_relic/agent/instrumentation/notifications_subscriber'
|
5
5
|
require 'new_relic/agent/instrumentation/ignore_actions'
|
6
6
|
require 'new_relic/agent/parameter_filtering'
|
7
7
|
|
8
8
|
module NewRelic
|
9
9
|
module Agent
|
10
10
|
module Instrumentation
|
11
|
-
class ActionControllerSubscriber <
|
11
|
+
class ActionControllerSubscriber < NotificationsSubscriber
|
12
12
|
|
13
13
|
def start(name, id, payload) #THREAD_LOCAL_ACCESS
|
14
14
|
# @req is a historically stable but not guaranteed Rails header property
|
15
15
|
request = payload[:headers].instance_variable_get(:@req)
|
16
16
|
|
17
|
-
|
18
|
-
push_event(event)
|
17
|
+
controller_class = controller_class(payload)
|
19
18
|
|
20
|
-
if state.is_execution_traced? && !
|
21
|
-
|
19
|
+
if state.is_execution_traced? && !should_ignore(payload, controller_class)
|
20
|
+
finishable = start_transaction_or_segment(payload, request, controller_class)
|
21
|
+
push_segment(id, finishable)
|
22
22
|
else
|
23
23
|
# if this transaction is ignored, make sure child
|
24
24
|
# transaction are also ignored
|
@@ -30,11 +30,12 @@ module NewRelic
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def finish(name, id, payload) #THREAD_LOCAL_ACCESS
|
33
|
-
|
34
|
-
event.payload.merge!(payload)
|
33
|
+
finishable = pop_segment(id)
|
35
34
|
|
36
|
-
if state.is_execution_traced?
|
37
|
-
|
35
|
+
if state.is_execution_traced? \
|
36
|
+
&& !should_ignore(payload, controller_class(payload))
|
37
|
+
|
38
|
+
finishable.finish
|
38
39
|
else
|
39
40
|
Agent.instance.pop_trace_execution_flag
|
40
41
|
end
|
@@ -42,77 +43,52 @@ module NewRelic
|
|
42
43
|
log_notification_error(e, name, 'finish')
|
43
44
|
end
|
44
45
|
|
45
|
-
def
|
46
|
-
|
47
|
-
name:
|
48
|
-
category:
|
49
|
-
options:
|
50
|
-
request:
|
46
|
+
def start_transaction_or_segment(payload, request, controller_class)
|
47
|
+
Tracer.start_transaction_or_segment(
|
48
|
+
name: format_metric_name(payload[:action], controller_class),
|
49
|
+
category: :controller,
|
50
|
+
options: {
|
51
|
+
request: request,
|
51
52
|
filtered_params: NewRelic::Agent::ParameterFiltering.filter_using_rails(
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
payload[:params],
|
54
|
+
Rails.application.config.filter_parameters
|
55
|
+
),
|
56
|
+
apdex_start_time: queue_start(request),
|
57
|
+
ignore_apdex: NewRelic::Agent::Instrumentation::IgnoreActions.is_filtered?(
|
58
|
+
ControllerInstrumentation::NR_IGNORE_APDEX_KEY,
|
59
|
+
controller_class,
|
60
|
+
payload[:action]
|
61
|
+
),
|
62
|
+
ignore_enduser: NewRelic::Agent::Instrumentation::IgnoreActions.is_filtered?(
|
63
|
+
ControllerInstrumentation::NR_IGNORE_ENDUSER_KEY,
|
64
|
+
controller_class,
|
65
|
+
payload[:action]
|
66
|
+
)
|
57
67
|
}
|
58
68
|
)
|
59
69
|
end
|
60
70
|
|
61
|
-
def
|
62
|
-
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
|
-
class ControllerEvent < Event
|
67
|
-
attr_accessor :parent
|
68
|
-
attr_reader :queue_start, :request
|
69
|
-
|
70
|
-
def initialize(name, start, ending, transaction_id, payload, request)
|
71
|
-
# We have a different initialize parameter list, so be explicit
|
72
|
-
super(name, start, ending, transaction_id, payload)
|
73
|
-
|
74
|
-
@request = request
|
75
|
-
@controller_class = payload[:controller].split('::') \
|
76
|
-
.inject(Object){|m,o| m.const_get(o)}
|
77
|
-
|
78
|
-
if request && request.respond_to?(:env)
|
79
|
-
@queue_start = QueueTime.parse_frontend_timestamp(request.env, self.time)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def metric_name
|
84
|
-
@metric_name || "Controller/#{metric_path}/#{metric_action}"
|
71
|
+
def format_metric_name(metric_action, controller_name)
|
72
|
+
controller_class = ::NewRelic::LanguageSupport.constantize(controller_name)
|
73
|
+
"Controller/#{controller_class.controller_path}/#{metric_action}"
|
85
74
|
end
|
86
75
|
|
87
|
-
def
|
88
|
-
|
76
|
+
def controller_class(payload)
|
77
|
+
::NewRelic::LanguageSupport.constantize(payload[:controller])
|
89
78
|
end
|
90
79
|
|
91
|
-
def
|
92
|
-
payload[:action]
|
93
|
-
end
|
94
|
-
|
95
|
-
def ignored?
|
96
|
-
_is_filtered?(ControllerInstrumentation::NR_DO_NOT_TRACE_KEY)
|
97
|
-
end
|
98
|
-
|
99
|
-
def apdex_ignored?
|
100
|
-
_is_filtered?(ControllerInstrumentation::NR_IGNORE_APDEX_KEY)
|
101
|
-
end
|
102
|
-
|
103
|
-
def enduser_ignored?
|
104
|
-
_is_filtered?(ControllerInstrumentation::NR_IGNORE_ENDUSER_KEY)
|
105
|
-
end
|
106
|
-
|
107
|
-
def _is_filtered?(key)
|
80
|
+
def should_ignore(payload, controller_class)
|
108
81
|
NewRelic::Agent::Instrumentation::IgnoreActions.is_filtered?(
|
109
|
-
|
110
|
-
|
111
|
-
|
82
|
+
ControllerInstrumentation::NR_DO_NOT_TRACE_KEY,
|
83
|
+
controller_class,
|
84
|
+
payload[:action]
|
85
|
+
)
|
112
86
|
end
|
113
87
|
|
114
|
-
def
|
115
|
-
|
88
|
+
def queue_start(request)
|
89
|
+
if request && request.respond_to?(:env)
|
90
|
+
QueueTime.parse_frontend_timestamp(request.env, Time.now)
|
91
|
+
end
|
116
92
|
end
|
117
93
|
end
|
118
94
|
end
|