newrelic_rpm 6.2.0.354 → 6.7.0.359
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +27 -5
- data/CHANGELOG.md +157 -6
- data/lib/new_relic/agent.rb +49 -0
- data/lib/new_relic/agent/agent.rb +110 -146
- data/lib/new_relic/agent/commands/agent_command_router.rb +2 -21
- data/lib/new_relic/agent/configuration/default_source.rb +103 -41
- 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 +35 -1
- data/lib/new_relic/agent/connect/request_builder.rb +69 -0
- data/lib/new_relic/agent/connect/response_handler.rb +61 -0
- data/lib/new_relic/agent/cross_app_monitor.rb +1 -1
- 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/hostname.rb +1 -1
- 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 +46 -74
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +70 -53
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +168 -0
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +40 -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/notifications_subscriber.rb +76 -0
- data/lib/new_relic/agent/instrumentation/{rails5 → rails_notifications}/action_cable.rb +5 -6
- data/lib/new_relic/agent/instrumentation/{rails5 → rails_notifications}/action_controller.rb +3 -3
- data/lib/new_relic/agent/instrumentation/{rails4 → rails_notifications}/action_view.rb +3 -3
- data/lib/new_relic/agent/javascript_instrumentor.rb +1 -1
- data/lib/new_relic/agent/logging.rb +125 -0
- data/lib/new_relic/agent/new_relic_service.rb +0 -4
- data/lib/new_relic/agent/parameter_filtering.rb +18 -5
- data/lib/new_relic/agent/priority_sampled_buffer.rb +2 -0
- data/lib/new_relic/agent/span_event_aggregator.rb +2 -5
- 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/tracer.rb +32 -0
- data/lib/new_relic/agent/transaction.rb +0 -2
- 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_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/control/class_methods.rb +7 -1
- data/lib/new_relic/control/frameworks/{rails5.rb → rails_notifications.rb} +1 -1
- 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 +7 -0
- data/test/agent_helper.rb +18 -5
- metadata +17 -16
- 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/instrumentation/active_record_4.rb +0 -42
- data/lib/new_relic/agent/instrumentation/active_record_5.rb +0 -41
- data/lib/new_relic/agent/instrumentation/evented_subscriber.rb +0 -104
- data/lib/new_relic/agent/instrumentation/rails4/action_controller.rb +0 -32
- data/lib/new_relic/agent/instrumentation/rails5/action_view.rb +0 -27
- data/lib/new_relic/agent/transaction/xray_sample_buffer.rb +0 -64
- data/lib/new_relic/control/frameworks/rails6.rb +0 -14
@@ -1,161 +0,0 @@
|
|
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
|
-
require 'forwardable'
|
6
|
-
require 'thread'
|
7
|
-
require 'new_relic/agent/commands/xray_session'
|
8
|
-
|
9
|
-
module NewRelic
|
10
|
-
module Agent
|
11
|
-
module Commands
|
12
|
-
class XraySessionCollection
|
13
|
-
extend Forwardable
|
14
|
-
|
15
|
-
def initialize(backtrace_service, event_listener)
|
16
|
-
@backtrace_service = backtrace_service
|
17
|
-
|
18
|
-
# This lock protects access to the sessions hash, but it's expected
|
19
|
-
# that individual session objects within the hash will be manipulated
|
20
|
-
# outside the lock. This is safe because manipulation of the session
|
21
|
-
# objects is expected from only a single thread (the harvest thread)
|
22
|
-
@sessions_lock = Mutex.new
|
23
|
-
@sessions = {}
|
24
|
-
|
25
|
-
if event_listener
|
26
|
-
event_listener.subscribe(:before_harvest, &method(:cleanup_finished_sessions))
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def handle_active_xray_sessions(agent_command)
|
31
|
-
# If X-Rays are disabled, just be quiet about it and don't start the
|
32
|
-
# command. Other hosts might be running the X-Ray, so we don't need
|
33
|
-
# to bark on every get_agent_commands.
|
34
|
-
if !NewRelic::Agent.config[:'xray_session.enabled']
|
35
|
-
NewRelic::Agent.logger.debug("Not responding to X-Ray command because of config 'xray_session.enabled' = #{NewRelic::Agent.config[:'xray_session.enabled']}")
|
36
|
-
return
|
37
|
-
end
|
38
|
-
|
39
|
-
incoming_ids = agent_command.arguments["xray_ids"]
|
40
|
-
deactivate_for_incoming_sessions(incoming_ids)
|
41
|
-
activate_sessions(incoming_ids)
|
42
|
-
end
|
43
|
-
|
44
|
-
def session_id_for_transaction_name(name)
|
45
|
-
@sessions_lock.synchronize do
|
46
|
-
@sessions.each do |id, session|
|
47
|
-
return id if session.key_transaction_name == name
|
48
|
-
end
|
49
|
-
end
|
50
|
-
nil
|
51
|
-
end
|
52
|
-
|
53
|
-
NO_PROFILES = [].freeze
|
54
|
-
|
55
|
-
def harvest_thread_profiles
|
56
|
-
return NO_PROFILES unless NewRelic::Agent::Threading::BacktraceService.is_supported?
|
57
|
-
|
58
|
-
profiles = active_thread_profiling_sessions.map do |session|
|
59
|
-
NewRelic::Agent.logger.debug("Harvesting profile for X-Ray session #{session.inspect}")
|
60
|
-
@backtrace_service.harvest(session.key_transaction_name)
|
61
|
-
end
|
62
|
-
profiles.reject! {|p| p.empty?}
|
63
|
-
profiles.compact
|
64
|
-
end
|
65
|
-
|
66
|
-
def stop_all_sessions
|
67
|
-
deactivate_for_incoming_sessions([])
|
68
|
-
end
|
69
|
-
|
70
|
-
def cleanup_finished_sessions
|
71
|
-
finished_session_ids.each do |id|
|
72
|
-
NewRelic::Agent.logger.debug("Finished X-Ray session #{id} by duration. Removing it from active sessions.")
|
73
|
-
remove_session_by_id(id)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
|
78
|
-
### Internals
|
79
|
-
|
80
|
-
def new_relic_service
|
81
|
-
NewRelic::Agent.instance.service
|
82
|
-
end
|
83
|
-
|
84
|
-
# These are unsynchonized and should only be used for testing
|
85
|
-
def_delegators :@sessions, :[], :include?
|
86
|
-
|
87
|
-
def active_thread_profiling_sessions
|
88
|
-
@sessions_lock.synchronize do
|
89
|
-
@sessions.values.select { |s| s.active? && s.run_profiler? }
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
### Session activation
|
94
|
-
|
95
|
-
def activate_sessions(incoming_ids)
|
96
|
-
lookup_metadata_for(ids_to_activate(incoming_ids)).each do |raw|
|
97
|
-
add_session(XraySession.new(raw))
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
def ids_to_activate(incoming_ids)
|
102
|
-
@sessions_lock.synchronize { incoming_ids - @sessions.keys }
|
103
|
-
end
|
104
|
-
|
105
|
-
# Please don't hold the @sessions_lock across me! Calling the service
|
106
|
-
# is time-consuming, and will block request threads. Which is rude.
|
107
|
-
def lookup_metadata_for(ids_to_activate)
|
108
|
-
return [] if ids_to_activate.empty?
|
109
|
-
|
110
|
-
NewRelic::Agent.logger.debug("Retrieving metadata for X-Ray sessions #{ids_to_activate.inspect}")
|
111
|
-
new_relic_service.get_xray_metadata(ids_to_activate)
|
112
|
-
end
|
113
|
-
|
114
|
-
def add_session(session)
|
115
|
-
NewRelic::Agent.logger.debug("Adding X-Ray session #{session.inspect}")
|
116
|
-
NewRelic::Agent.increment_metric("Supportability/XraySessions/Starts")
|
117
|
-
|
118
|
-
@sessions_lock.synchronize { @sessions[session.id] = session }
|
119
|
-
|
120
|
-
session.activate
|
121
|
-
if session.run_profiler?
|
122
|
-
@backtrace_service.subscribe(session.key_transaction_name, session.command_arguments)
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
### Session deactivation
|
127
|
-
|
128
|
-
def deactivate_for_incoming_sessions(incoming_ids)
|
129
|
-
ids_to_remove(incoming_ids).each do |session_id|
|
130
|
-
remove_session_by_id(session_id)
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
def ids_to_remove(incoming_ids)
|
135
|
-
@sessions_lock.synchronize { @sessions.keys - incoming_ids }
|
136
|
-
end
|
137
|
-
|
138
|
-
def remove_session_by_id(id)
|
139
|
-
session = @sessions_lock.synchronize { @sessions.delete(id) }
|
140
|
-
|
141
|
-
if session
|
142
|
-
NewRelic::Agent.logger.debug("Removing X-Ray session #{session.inspect}")
|
143
|
-
NewRelic::Agent.increment_metric("Supportability/XraySessions/Stops")
|
144
|
-
|
145
|
-
if session.run_profiler?
|
146
|
-
@backtrace_service.unsubscribe(session.key_transaction_name)
|
147
|
-
end
|
148
|
-
session.deactivate
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
def finished_session_ids
|
153
|
-
@sessions_lock.synchronize do
|
154
|
-
@sessions.map{|k, s| k if s.finished?}.compact
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
end
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end
|
@@ -1,42 +0,0 @@
|
|
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
|
-
require 'new_relic/agent/instrumentation/active_record_prepend'
|
6
|
-
require 'new_relic/agent/instrumentation/active_record_subscriber'
|
7
|
-
require 'new_relic/agent/prepend_supportability'
|
8
|
-
|
9
|
-
DependencyDetection.defer do
|
10
|
-
named :active_record_4
|
11
|
-
|
12
|
-
depends_on do
|
13
|
-
defined?(::ActiveRecord) && defined?(::ActiveRecord::Base) &&
|
14
|
-
defined?(::ActiveRecord::VERSION) &&
|
15
|
-
::ActiveRecord::VERSION::MAJOR.to_i == 4
|
16
|
-
end
|
17
|
-
|
18
|
-
depends_on do
|
19
|
-
!NewRelic::Agent.config[:disable_activerecord_instrumentation] &&
|
20
|
-
!NewRelic::Agent::Instrumentation::ActiveRecordSubscriber.subscribed?
|
21
|
-
end
|
22
|
-
|
23
|
-
executes do
|
24
|
-
::NewRelic::Agent.logger.info 'Installing ActiveRecord 4 instrumentation'
|
25
|
-
end
|
26
|
-
|
27
|
-
executes do
|
28
|
-
ActiveSupport::Notifications.subscribe('sql.active_record',
|
29
|
-
NewRelic::Agent::Instrumentation::ActiveRecordSubscriber.new)
|
30
|
-
|
31
|
-
ActiveSupport.on_load(:active_record) do
|
32
|
-
::NewRelic::Agent::PrependSupportability.record_metrics_for(::ActiveRecord::Base, ::ActiveRecord::Relation)
|
33
|
-
|
34
|
-
if NewRelic::Agent.config[:prepend_active_record_instrumentation]
|
35
|
-
::ActiveRecord::Base.prepend ::NewRelic::Agent::Instrumentation::ActiveRecordPrepend::BaseExtensions
|
36
|
-
::ActiveRecord::Relation.prepend ::NewRelic::Agent::Instrumentation::ActiveRecordPrepend::RelationExtensions
|
37
|
-
else
|
38
|
-
::NewRelic::Agent::Instrumentation::ActiveRecordHelper.instrument_additional_methods
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,41 +0,0 @@
|
|
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
|
-
require 'new_relic/agent/instrumentation/active_record_subscriber'
|
6
|
-
require 'new_relic/agent/instrumentation/active_record_prepend'
|
7
|
-
|
8
|
-
DependencyDetection.defer do
|
9
|
-
named :active_record_5
|
10
|
-
|
11
|
-
depends_on do
|
12
|
-
defined?(::ActiveRecord) && defined?(::ActiveRecord::Base) &&
|
13
|
-
defined?(::ActiveRecord::VERSION) &&
|
14
|
-
::ActiveRecord::VERSION::MAJOR.to_i == 5
|
15
|
-
end
|
16
|
-
|
17
|
-
depends_on do
|
18
|
-
!NewRelic::Agent.config[:disable_activerecord_instrumentation] &&
|
19
|
-
!NewRelic::Agent::Instrumentation::ActiveRecordSubscriber.subscribed?
|
20
|
-
end
|
21
|
-
|
22
|
-
executes do
|
23
|
-
::NewRelic::Agent.logger.info 'Installing ActiveRecord 5 instrumentation'
|
24
|
-
end
|
25
|
-
|
26
|
-
executes do
|
27
|
-
ActiveSupport::Notifications.subscribe('sql.active_record',
|
28
|
-
NewRelic::Agent::Instrumentation::ActiveRecordSubscriber.new)
|
29
|
-
|
30
|
-
ActiveSupport.on_load(:active_record) do
|
31
|
-
::NewRelic::Agent::PrependSupportability.record_metrics_for(::ActiveRecord::Base, ::ActiveRecord::Relation)
|
32
|
-
::ActiveRecord::Base.prepend ::NewRelic::Agent::Instrumentation::ActiveRecordPrepend::BaseExtensions
|
33
|
-
::ActiveRecord::Relation.prepend ::NewRelic::Agent::Instrumentation::ActiveRecordPrepend::RelationExtensions
|
34
|
-
|
35
|
-
if ::ActiveRecord::VERSION::MINOR.to_i == 1 &&
|
36
|
-
::ActiveRecord::VERSION::TINY.to_i >= 6
|
37
|
-
::ActiveRecord::Base.prepend ::NewRelic::Agent::Instrumentation::ActiveRecordPrepend::BaseExtensions516
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,104 +0,0 @@
|
|
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 Instrumentation
|
8
|
-
class EventedSubscriber
|
9
|
-
def initialize
|
10
|
-
@queue_key = ['NewRelic', self.class.name, object_id].join('-')
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.subscribed?
|
14
|
-
# TODO: need to talk to Rails core about an API for this,
|
15
|
-
# rather than digging through Listener ivars
|
16
|
-
ActiveSupport::Notifications.notifier.instance_variable_get(:@subscribers) \
|
17
|
-
.find{|s| s.instance_variable_get(:@delegate).class == self }
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.subscribe(pattern)
|
21
|
-
if !subscribed?
|
22
|
-
ActiveSupport::Notifications.subscribe(pattern, new)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def start(name, id, payload)
|
27
|
-
event = ActiveSupport::Notifications::Event.new(name, Time.now, nil, id, payload)
|
28
|
-
push_event(event)
|
29
|
-
return event
|
30
|
-
end
|
31
|
-
|
32
|
-
def finish(name, id, payload)
|
33
|
-
pop_event(id)
|
34
|
-
end
|
35
|
-
|
36
|
-
def log_notification_error(error, name, event_type)
|
37
|
-
# These are important enough failures that we want the backtraces
|
38
|
-
# logged at error level, hence the explicit log_exception call.
|
39
|
-
NewRelic::Agent.logger.error("Error during #{event_type} callback for event '#{name}':")
|
40
|
-
NewRelic::Agent.logger.log_exception(:error, error)
|
41
|
-
end
|
42
|
-
|
43
|
-
def push_event(event)
|
44
|
-
parent = event_stack[event.transaction_id].last
|
45
|
-
if parent && event.respond_to?(:parent=)
|
46
|
-
event.parent = parent
|
47
|
-
parent << event
|
48
|
-
end
|
49
|
-
event_stack[event.transaction_id].push event
|
50
|
-
end
|
51
|
-
|
52
|
-
def pop_event(transaction_id)
|
53
|
-
event = event_stack[transaction_id].pop
|
54
|
-
event.end = Time.now
|
55
|
-
return event
|
56
|
-
end
|
57
|
-
|
58
|
-
def event_stack
|
59
|
-
Thread.current[@queue_key] ||= Hash.new {|h,id| h[id] = [] }
|
60
|
-
end
|
61
|
-
|
62
|
-
def state
|
63
|
-
NewRelic::Agent::Tracer.state
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
# Taken from ActiveSupport::Notifications::Event, pasted here
|
68
|
-
# with a couple minor additions so we don't have a hard
|
69
|
-
# dependency on ActiveSupport::Notifications.
|
70
|
-
#
|
71
|
-
# Represents an instrumentation event, provides timing and metric
|
72
|
-
# name information useful when recording metrics.
|
73
|
-
class Event
|
74
|
-
attr_reader :name, :time, :transaction_id, :payload, :children
|
75
|
-
attr_accessor :end, :parent, :frame
|
76
|
-
|
77
|
-
def initialize(name, start, ending, transaction_id, payload)
|
78
|
-
@name = name
|
79
|
-
@payload = payload.dup
|
80
|
-
@time = start
|
81
|
-
@transaction_id = transaction_id
|
82
|
-
@end = ending
|
83
|
-
@children = []
|
84
|
-
end
|
85
|
-
|
86
|
-
def metric_name
|
87
|
-
raise NotImplementedError
|
88
|
-
end
|
89
|
-
|
90
|
-
def duration
|
91
|
-
self.end - time
|
92
|
-
end
|
93
|
-
|
94
|
-
def <<(event)
|
95
|
-
@children << event
|
96
|
-
end
|
97
|
-
|
98
|
-
def parent_of?(event)
|
99
|
-
@children.include? event
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
@@ -1,32 +0,0 @@
|
|
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
|
-
require 'new_relic/agent/instrumentation/action_controller_subscriber'
|
5
|
-
require 'new_relic/agent/prepend_supportability'
|
6
|
-
|
7
|
-
|
8
|
-
DependencyDetection.defer do
|
9
|
-
@name = :rails4_controller
|
10
|
-
|
11
|
-
depends_on do
|
12
|
-
defined?(::Rails::VERSION::MAJOR) && ::Rails::VERSION::MAJOR.to_i == 4
|
13
|
-
end
|
14
|
-
|
15
|
-
depends_on do
|
16
|
-
defined?(ActionController) && defined?(ActionController::Base)
|
17
|
-
end
|
18
|
-
|
19
|
-
executes do
|
20
|
-
::NewRelic::Agent.logger.info 'Installing Rails 4 Controller instrumentation'
|
21
|
-
end
|
22
|
-
|
23
|
-
executes do
|
24
|
-
class ActionController::Base
|
25
|
-
include NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
26
|
-
end
|
27
|
-
NewRelic::Agent::Instrumentation::ActionControllerSubscriber \
|
28
|
-
.subscribe(/^process_action.action_controller$/)
|
29
|
-
|
30
|
-
::NewRelic::Agent::PrependSupportability.record_metrics_for(::ActionController::Base)
|
31
|
-
end
|
32
|
-
end
|
@@ -1,27 +0,0 @@
|
|
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
|
-
require 'new_relic/agent/instrumentation/action_view_subscriber'
|
5
|
-
require 'new_relic/agent/prepend_supportability'
|
6
|
-
|
7
|
-
DependencyDetection.defer do
|
8
|
-
@name = :rails5_view
|
9
|
-
|
10
|
-
depends_on do
|
11
|
-
defined?(::Rails::VERSION::MAJOR) && ::Rails::VERSION::MAJOR.to_i == 5
|
12
|
-
end
|
13
|
-
|
14
|
-
depends_on do
|
15
|
-
!NewRelic::Agent.config[:disable_view_instrumentation] &&
|
16
|
-
!NewRelic::Agent::Instrumentation::ActionViewSubscriber.subscribed?
|
17
|
-
end
|
18
|
-
|
19
|
-
executes do
|
20
|
-
NewRelic::Agent.logger.info 'Installing Rails 5 view instrumentation'
|
21
|
-
end
|
22
|
-
|
23
|
-
executes do
|
24
|
-
NewRelic::Agent::Instrumentation::ActionViewSubscriber.subscribe(/render_.+\.action_view$/)
|
25
|
-
NewRelic::Agent::PrependSupportability.record_metrics_for(::ActionView::Base, ::ActionView::Template, ::ActionView::Renderer)
|
26
|
-
end
|
27
|
-
end
|
@@ -1,64 +0,0 @@
|
|
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
|
-
require 'new_relic/agent/transaction/transaction_sample_buffer'
|
6
|
-
|
7
|
-
module NewRelic
|
8
|
-
module Agent
|
9
|
-
class Transaction
|
10
|
-
class XraySampleBuffer < TransactionSampleBuffer
|
11
|
-
|
12
|
-
attr_writer :xray_session_collection
|
13
|
-
|
14
|
-
def initialize
|
15
|
-
super
|
16
|
-
|
17
|
-
# Memoize the config setting since this happens per request
|
18
|
-
@enabled = NewRelic::Agent.config[:'xray_session.allow_traces']
|
19
|
-
NewRelic::Agent.config.register_callback(:'xray_session.allow_traces') do |new_value|
|
20
|
-
@enabled = new_value
|
21
|
-
end
|
22
|
-
|
23
|
-
@capacity = NewRelic::Agent.config[:'xray_session.max_samples']
|
24
|
-
NewRelic::Agent.config.register_callback(:'xray_session.max_samples') do |new_value|
|
25
|
-
@capacity = new_value
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def xray_session_collection
|
30
|
-
@xray_session_collection ||= NewRelic::Agent.instance.agent_command_router.xray_session_collection
|
31
|
-
end
|
32
|
-
|
33
|
-
def capacity
|
34
|
-
@capacity
|
35
|
-
end
|
36
|
-
|
37
|
-
def truncate_samples
|
38
|
-
# First in wins, so stop on allow_sample? instead of truncating
|
39
|
-
end
|
40
|
-
|
41
|
-
def allow_sample?(sample)
|
42
|
-
!full? && !lookup_session_id(sample).nil?
|
43
|
-
end
|
44
|
-
|
45
|
-
def enabled?
|
46
|
-
@enabled
|
47
|
-
end
|
48
|
-
|
49
|
-
|
50
|
-
private
|
51
|
-
|
52
|
-
def add_sample(sample)
|
53
|
-
super(sample)
|
54
|
-
sample.xray_session_id = lookup_session_id(sample)
|
55
|
-
end
|
56
|
-
|
57
|
-
def lookup_session_id(sample)
|
58
|
-
xray_session_collection.session_id_for_transaction_name(sample.transaction_name)
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|