newrelic_rpm 8.13.0 → 8.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +3258 -3144
- data/CONTRIBUTING.md +1 -2
- data/README.md +1 -2
- data/init.rb +1 -1
- data/lib/new_relic/agent/agent.rb +14 -466
- data/lib/new_relic/agent/agent_helpers/connect.rb +227 -0
- data/lib/new_relic/agent/agent_helpers/harvest.rb +153 -0
- data/lib/new_relic/agent/agent_helpers/shutdown.rb +72 -0
- data/lib/new_relic/agent/agent_helpers/special_startup.rb +75 -0
- data/lib/new_relic/agent/agent_helpers/start_worker_thread.rb +167 -0
- data/lib/new_relic/agent/agent_helpers/startup.rb +202 -0
- data/lib/new_relic/agent/agent_helpers/transmit.rb +76 -0
- data/lib/new_relic/agent/configuration/default_source.rb +22 -0
- data/lib/new_relic/agent/datastores.rb +2 -2
- data/lib/new_relic/agent/guid_generator.rb +11 -2
- data/lib/new_relic/agent/instrumentation/active_job.rb +7 -7
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +2 -2
- data/lib/new_relic/agent/instrumentation/active_record.rb +9 -9
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +24 -24
- data/lib/new_relic/agent/instrumentation/active_storage.rb +2 -2
- data/lib/new_relic/agent/instrumentation/active_support.rb +12 -0
- data/lib/new_relic/agent/instrumentation/active_support_logger.rb +3 -3
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +2 -2
- data/lib/new_relic/agent/instrumentation/authlogic.rb +2 -2
- data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +3 -3
- data/lib/new_relic/agent/instrumentation/bunny.rb +4 -4
- data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/curb.rb +6 -6
- data/lib/new_relic/agent/instrumentation/custom_events_subscriber.rb +37 -0
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +50 -50
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +5 -5
- data/lib/new_relic/agent/instrumentation/elasticsearch.rb +5 -5
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +1 -1
- data/lib/new_relic/agent/instrumentation/excon.rb +9 -9
- data/lib/new_relic/agent/instrumentation/grape.rb +8 -8
- data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grpc_client.rb +3 -3
- data/lib/new_relic/agent/instrumentation/grpc_server.rb +4 -4
- data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/httpclient.rb +2 -2
- data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/httprb.rb +3 -3
- data/lib/new_relic/agent/instrumentation/logger.rb +3 -3
- data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +3 -3
- data/lib/new_relic/agent/instrumentation/memcache.rb +16 -16
- data/lib/new_relic/agent/instrumentation/mongo.rb +1 -1
- data/lib/new_relic/agent/instrumentation/net_http.rb +6 -6
- data/lib/new_relic/agent/instrumentation/padrino.rb +3 -3
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +5 -5
- data/lib/new_relic/agent/instrumentation/rack.rb +14 -14
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +5 -5
- data/lib/new_relic/agent/instrumentation/rails_middleware.rb +3 -3
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +6 -6
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +2 -2
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_view.rb +5 -3
- data/lib/new_relic/agent/instrumentation/rails_notifications/custom_events.rb +30 -0
- data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +4 -4
- data/lib/new_relic/agent/instrumentation/rake.rb +7 -7
- data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +29 -10
- data/lib/new_relic/agent/instrumentation/redis.rb +4 -4
- data/lib/new_relic/agent/instrumentation/resque.rb +9 -9
- data/lib/new_relic/agent/instrumentation/sequel.rb +2 -2
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +3 -3
- data/lib/new_relic/agent/instrumentation/sinatra.rb +7 -7
- data/lib/new_relic/agent/instrumentation/sunspot.rb +4 -4
- data/lib/new_relic/agent/instrumentation/thread.rb +3 -3
- data/lib/new_relic/agent/instrumentation/tilt.rb +3 -3
- data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +2 -2
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +1 -1
- data/lib/new_relic/agent/method_tracer_helpers.rb +6 -11
- data/lib/new_relic/agent/tracer.rb +1 -1
- data/lib/new_relic/agent/transaction/segment.rb +6 -0
- data/lib/new_relic/control/instance_methods.rb +6 -2
- data/lib/new_relic/recipes/helpers/send_deployment.rb +2 -1
- data/lib/new_relic/version.rb +1 -1
- data/lib/newrelic_rpm.rb +13 -2
- data/lib/sequel/extensions/newrelic_instrumentation.rb +1 -1
- data/lib/sequel/plugins/newrelic_instrumentation.rb +1 -1
- data/newrelic.yml +10 -0
- data/test/agent_helper.rb +5 -5
- metadata +12 -6
- data/lib/new_relic/agent/agent/shutdown.rb +0 -35
- data/lib/new_relic/agent/agent/special_startup.rb +0 -72
- data/lib/new_relic/agent/agent/start_worker_thread.rb +0 -163
- data/lib/new_relic/agent/agent/startup.rb +0 -197
@@ -9,11 +9,11 @@ DependencyDetection.defer do
|
|
9
9
|
@name = :sidekiq
|
10
10
|
|
11
11
|
depends_on do
|
12
|
-
defined?(
|
12
|
+
defined?(Sidekiq) && !NewRelic::Agent.config[:disable_sidekiq]
|
13
13
|
end
|
14
14
|
|
15
15
|
executes do
|
16
|
-
|
16
|
+
NewRelic::Agent.logger.info('Installing Sidekiq instrumentation')
|
17
17
|
end
|
18
18
|
|
19
19
|
executes do
|
@@ -46,7 +46,7 @@ DependencyDetection.defer do
|
|
46
46
|
'They will stop being monitored in version 9.0.0. ' \
|
47
47
|
'Please upgrade your Sidekiq version to continue receiving full support. '
|
48
48
|
|
49
|
-
|
49
|
+
NewRelic::Agent.logger.log_once(
|
50
50
|
:warn,
|
51
51
|
:deprecated_sidekiq_version,
|
52
52
|
deprecation_msg
|
@@ -11,24 +11,24 @@ require_relative 'sinatra/prepend'
|
|
11
11
|
DependencyDetection.defer do
|
12
12
|
named :sinatra
|
13
13
|
|
14
|
-
depends_on { defined?(
|
14
|
+
depends_on { defined?(Sinatra) && defined?(Sinatra::Base) }
|
15
15
|
depends_on { Sinatra::Base.private_method_defined?(:dispatch!) }
|
16
16
|
depends_on { Sinatra::Base.private_method_defined?(:process_route) }
|
17
17
|
depends_on { Sinatra::Base.private_method_defined?(:route_eval) }
|
18
18
|
|
19
19
|
executes do
|
20
|
-
|
20
|
+
NewRelic::Agent.logger.info('Installing Sinatra instrumentation')
|
21
21
|
end
|
22
22
|
|
23
23
|
executes do
|
24
24
|
if use_prepend?
|
25
|
-
prepend_instrument
|
25
|
+
prepend_instrument Sinatra::Base, NewRelic::Agent::Instrumentation::Sinatra::Prepend
|
26
26
|
else
|
27
27
|
chain_instrument NewRelic::Agent::Instrumentation::Sinatra::Chain
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
Sinatra::Base.class_eval { register NewRelic::Agent::Instrumentation::Sinatra::Ignorer }
|
31
|
+
Sinatra.module_eval { register NewRelic::Agent::Instrumentation::Sinatra::Ignorer }
|
32
32
|
end
|
33
33
|
|
34
34
|
executes do
|
@@ -37,7 +37,7 @@ DependencyDetection.defer do
|
|
37
37
|
require 'new_relic/rack/agent_hooks'
|
38
38
|
require 'new_relic/rack/browser_monitoring'
|
39
39
|
if use_prepend?
|
40
|
-
prepend_instrument
|
40
|
+
prepend_instrument Sinatra::Base.singleton_class, NewRelic::Agent::Instrumentation::Sinatra::Build::Prepend
|
41
41
|
else
|
42
42
|
chain_instrument NewRelic::Agent::Instrumentation::Sinatra::Build::Chain
|
43
43
|
end
|
@@ -49,7 +49,7 @@ DependencyDetection.defer do
|
|
49
49
|
deprecation_msg = 'The Ruby Agent is dropping support for Sinatra versions below 2.0.0 ' \
|
50
50
|
'in version 9.0.0. Please upgrade your Sinatra version to continue receiving full compatibility. ' \
|
51
51
|
|
52
|
-
|
52
|
+
NewRelic::Agent.logger.log_once(
|
53
53
|
:warn,
|
54
54
|
:deprecated_sinatra_version,
|
55
55
|
deprecation_msg
|
@@ -6,15 +6,15 @@ DependencyDetection.defer do
|
|
6
6
|
@name = :sunspot
|
7
7
|
|
8
8
|
depends_on do
|
9
|
-
defined?(
|
9
|
+
defined?(Sunspot)
|
10
10
|
end
|
11
11
|
|
12
12
|
executes do
|
13
|
-
|
13
|
+
NewRelic::Agent.logger.info('Installing Rails Sunspot instrumentation')
|
14
14
|
deprecation_msg = 'The instrumentation for Sunspot is deprecated. ' \
|
15
15
|
'It will be removed in version 9.0.0.'
|
16
16
|
|
17
|
-
|
17
|
+
NewRelic::Agent.logger.log_once(
|
18
18
|
:warn,
|
19
19
|
:deprecated_sunspot,
|
20
20
|
deprecation_msg
|
@@ -22,7 +22,7 @@ DependencyDetection.defer do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
executes do
|
25
|
-
|
25
|
+
Sunspot.module_eval do
|
26
26
|
class << self
|
27
27
|
%w[index index!].each do |method|
|
28
28
|
add_method_tracer method, 'SolrClient/Sunspot/index'
|
@@ -9,12 +9,12 @@ DependencyDetection.defer do
|
|
9
9
|
named :thread
|
10
10
|
|
11
11
|
executes do
|
12
|
-
|
12
|
+
NewRelic::Agent.logger.info('Installing Thread Instrumentation')
|
13
13
|
|
14
14
|
if use_prepend?
|
15
|
-
prepend_instrument
|
15
|
+
prepend_instrument Thread, NewRelic::Agent::Instrumentation::MonitoredThread::Prepend
|
16
16
|
else
|
17
|
-
chain_instrument
|
17
|
+
chain_instrument NewRelic::Agent::Instrumentation::MonitoredThread::Chain
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -9,15 +9,15 @@ require_relative 'tilt/prepend'
|
|
9
9
|
DependencyDetection.defer do
|
10
10
|
named :tilt
|
11
11
|
|
12
|
-
depends_on { defined?(
|
12
|
+
depends_on { defined?(Tilt) }
|
13
13
|
|
14
14
|
executes do
|
15
|
-
|
15
|
+
NewRelic::Agent.logger.info('Installing Tilt instrumentation')
|
16
16
|
end
|
17
17
|
|
18
18
|
executes do
|
19
19
|
if use_prepend?
|
20
|
-
prepend_instrument
|
20
|
+
prepend_instrument Tilt::Template, NewRelic::Agent::Instrumentation::Tilt::Prepend
|
21
21
|
else
|
22
22
|
chain_instrument NewRelic::Agent::Instrumentation::Tilt::Chain
|
23
23
|
end
|
@@ -36,7 +36,7 @@ module NewRelic
|
|
36
36
|
begin
|
37
37
|
yield
|
38
38
|
ensure
|
39
|
-
|
39
|
+
::NewRelic::Agent::Transaction::Segment.finish(segment)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -68,7 +68,7 @@ module NewRelic
|
|
68
68
|
segment.notice_error(NoticeableError.new(NOTICEABLE_ERROR_CLASS, response_message(request.response)))
|
69
69
|
end
|
70
70
|
|
71
|
-
|
71
|
+
::NewRelic::Agent::Transaction::Segment.finish(segment)
|
72
72
|
end
|
73
73
|
request.on_complete.unshift(callback)
|
74
74
|
rescue => e
|
@@ -18,7 +18,7 @@ DependencyDetection.defer do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
executes do
|
21
|
-
|
21
|
+
NewRelic::Agent.logger.info('Installing Typhoeus instrumentation')
|
22
22
|
require 'new_relic/agent/distributed_tracing/cross_app_tracing'
|
23
23
|
require 'new_relic/agent/http_clients/typhoeus_wrappers'
|
24
24
|
end
|
@@ -17,8 +17,7 @@ module NewRelic
|
|
17
17
|
extend self
|
18
18
|
|
19
19
|
def trace_execution_scoped(metric_names, options = NewRelic::EMPTY_HASH) # THREAD_LOCAL_ACCESS
|
20
|
-
|
21
|
-
return yield unless state.is_execution_traced?
|
20
|
+
return yield unless NewRelic::Agent::Tracer.state.is_execution_traced?
|
22
21
|
|
23
22
|
metric_names = Array(metric_names)
|
24
23
|
first_name = metric_names.shift
|
@@ -29,19 +28,15 @@ module NewRelic
|
|
29
28
|
unscoped_metrics: metric_names
|
30
29
|
)
|
31
30
|
|
32
|
-
if options[:metric] == false
|
33
|
-
segment.record_metrics = false
|
34
|
-
end
|
31
|
+
segment.record_metrics = false if options[:metric] == false
|
35
32
|
|
36
33
|
unless !options.key?(:code_information) || options[:code_information].nil? || options[:code_information].empty?
|
37
34
|
segment.code_information = options[:code_information]
|
38
35
|
end
|
39
36
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
segment.finish if segment
|
44
|
-
end
|
37
|
+
Tracer.capture_segment_error(segment) { yield }
|
38
|
+
ensure
|
39
|
+
::NewRelic::Agent::Transaction::Segment.finish(segment)
|
45
40
|
end
|
46
41
|
|
47
42
|
def code_information(object, method_name)
|
@@ -77,7 +72,7 @@ module NewRelic
|
|
77
72
|
name = Regexp.last_match(1) if object.to_s =~ /^#<Class:(.*)>$/
|
78
73
|
return name if name
|
79
74
|
|
80
|
-
raise "Unable to glean a class name from string '#{object}'"
|
75
|
+
raise "Unable to glean a class name from string '#{object}'"
|
81
76
|
end
|
82
77
|
|
83
78
|
# get at the underlying class from the singleton class
|
@@ -64,8 +64,12 @@ module NewRelic
|
|
64
64
|
|
65
65
|
# An artifact of earlier implementation, we put both #add_method_tracer and #trace_execution
|
66
66
|
# methods in the module methods.
|
67
|
-
|
68
|
-
|
67
|
+
# Rails applications load the next two lines before any other initializers are run
|
68
|
+
unless defined?(Rails::VERSION) && NewRelic::Agent.config[:defer_rails_initialization]
|
69
|
+
Module.send(:include, NewRelic::Agent::MethodTracer::ClassMethods)
|
70
|
+
Module.send(:include, NewRelic::Agent::MethodTracer)
|
71
|
+
end
|
72
|
+
|
69
73
|
init_config(options)
|
70
74
|
NewRelic::Agent.agent = NewRelic::Agent::Agent.instance
|
71
75
|
init_instrumentation
|
@@ -29,7 +29,8 @@ module SendDeployment
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def fetch_changelog
|
32
|
-
|
32
|
+
newrelic_changelog = fetch(:newrelic_changelog)
|
33
|
+
has_scm? && !newrelic_changelog ? lookup_changelog : newrelic_changelog
|
33
34
|
end
|
34
35
|
|
35
36
|
def fetch_environment
|
data/lib/new_relic/version.rb
CHANGED
data/lib/newrelic_rpm.rb
CHANGED
@@ -20,8 +20,19 @@ require 'new_relic/control'
|
|
20
20
|
if defined?(Rails::VERSION)
|
21
21
|
module NewRelic
|
22
22
|
class Railtie < Rails::Railtie
|
23
|
-
|
24
|
-
|
23
|
+
if NewRelic::Agent.config[:defer_rails_initialization]
|
24
|
+
initializer "newrelic_rpm.include_method_tracers", before: :load_config_initializers do |app|
|
25
|
+
Module.send(:include, NewRelic::Agent::MethodTracer::ClassMethods)
|
26
|
+
Module.send(:include, NewRelic::Agent::MethodTracer)
|
27
|
+
end
|
28
|
+
|
29
|
+
initializer "newrelic_rpm.start_plugin", after: :load_config_initializers do |app|
|
30
|
+
NewRelic::Control.instance.init_plugin(config: app.config)
|
31
|
+
end
|
32
|
+
else
|
33
|
+
initializer "newrelic_rpm.start_plugin", before: :load_config_initializers do |app|
|
34
|
+
NewRelic::Control.instance.init_plugin(config: app.config)
|
35
|
+
end
|
25
36
|
end
|
26
37
|
end
|
27
38
|
end
|
data/newrelic.yml
CHANGED
@@ -26,6 +26,13 @@ common: &default_settings
|
|
26
26
|
# All of the following configuration options are optional. Review them, and
|
27
27
|
# uncomment or edit them if they appear relevant to your application needs.
|
28
28
|
|
29
|
+
# An array of ActiveSupport custom events names to subscribe to and provide
|
30
|
+
# instrumentation for. For example,
|
31
|
+
# - my.custom.event
|
32
|
+
# - another.event
|
33
|
+
# - a.third.event
|
34
|
+
# active_support_custom_events_names: ""
|
35
|
+
|
29
36
|
# If `true`, all logging-related features for the agent can be enabled or disabled
|
30
37
|
# independently. If `false`, all logging-related features are disabled.
|
31
38
|
# application_logging.enabled: true
|
@@ -173,6 +180,9 @@ common: &default_settings
|
|
173
180
|
# If true, the agent won't sample the CPU usage of the host process.
|
174
181
|
# disable_cpu_sampler: false
|
175
182
|
|
183
|
+
# If true, disables ActiveSupport custom events instrumentation.
|
184
|
+
# disable_custom_events_instrumentation: false
|
185
|
+
|
176
186
|
# If true, disables DataMapper instrumentation.
|
177
187
|
# disable_data_mapper: false
|
178
188
|
|
data/test/agent_helper.rb
CHANGED
@@ -844,7 +844,7 @@ ensure
|
|
844
844
|
end
|
845
845
|
|
846
846
|
def json_dump_and_encode(object)
|
847
|
-
Base64.encode64(
|
847
|
+
Base64.encode64(JSON.dump(object))
|
848
848
|
end
|
849
849
|
|
850
850
|
def get_last_analytics_event
|
@@ -870,7 +870,7 @@ def load_cross_agent_test(name)
|
|
870
870
|
test_file_path = File.join(cross_agent_tests_dir, "#{name}.json")
|
871
871
|
data = File.read(test_file_path)
|
872
872
|
data.gsub!('callCount', 'call_count')
|
873
|
-
data =
|
873
|
+
data = JSON.load(data)
|
874
874
|
data.each { |testcase| testcase['testname'].tr!(' ', '_') if String === testcase['testname'] }
|
875
875
|
data
|
876
876
|
end
|
@@ -1014,9 +1014,9 @@ def assert_implements(instance, method, *args)
|
|
1014
1014
|
end
|
1015
1015
|
|
1016
1016
|
def defer_testing_to_min_supported_rails(test_file, min_rails_version, supports_jruby = true)
|
1017
|
-
if defined?(
|
1018
|
-
defined?(
|
1019
|
-
(
|
1017
|
+
if defined?(Rails) &&
|
1018
|
+
defined?(Rails::VERSION::STRING) &&
|
1019
|
+
(Rails::VERSION::STRING.to_f >= min_rails_version) &&
|
1020
1020
|
(supports_jruby || !NewRelic::LanguageSupport.jruby?)
|
1021
1021
|
|
1022
1022
|
yield
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.
|
4
|
+
version: 8.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tanna McClure
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2022-
|
14
|
+
date: 2022-12-14 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -162,10 +162,13 @@ files:
|
|
162
162
|
- lib/new_relic/agent.rb
|
163
163
|
- lib/new_relic/agent/adaptive_sampler.rb
|
164
164
|
- lib/new_relic/agent/agent.rb
|
165
|
-
- lib/new_relic/agent/
|
166
|
-
- lib/new_relic/agent/
|
167
|
-
- lib/new_relic/agent/
|
168
|
-
- lib/new_relic/agent/
|
165
|
+
- lib/new_relic/agent/agent_helpers/connect.rb
|
166
|
+
- lib/new_relic/agent/agent_helpers/harvest.rb
|
167
|
+
- lib/new_relic/agent/agent_helpers/shutdown.rb
|
168
|
+
- lib/new_relic/agent/agent_helpers/special_startup.rb
|
169
|
+
- lib/new_relic/agent/agent_helpers/start_worker_thread.rb
|
170
|
+
- lib/new_relic/agent/agent_helpers/startup.rb
|
171
|
+
- lib/new_relic/agent/agent_helpers/transmit.rb
|
169
172
|
- lib/new_relic/agent/agent_logger.rb
|
170
173
|
- lib/new_relic/agent/attribute_filter.rb
|
171
174
|
- lib/new_relic/agent/attribute_processing.rb
|
@@ -249,6 +252,7 @@ files:
|
|
249
252
|
- lib/new_relic/agent/instrumentation/active_record_subscriber.rb
|
250
253
|
- lib/new_relic/agent/instrumentation/active_storage.rb
|
251
254
|
- lib/new_relic/agent/instrumentation/active_storage_subscriber.rb
|
255
|
+
- lib/new_relic/agent/instrumentation/active_support.rb
|
252
256
|
- lib/new_relic/agent/instrumentation/active_support_logger.rb
|
253
257
|
- lib/new_relic/agent/instrumentation/active_support_logger/chain.rb
|
254
258
|
- lib/new_relic/agent/instrumentation/active_support_logger/instrumentation.rb
|
@@ -264,6 +268,7 @@ files:
|
|
264
268
|
- lib/new_relic/agent/instrumentation/curb/chain.rb
|
265
269
|
- lib/new_relic/agent/instrumentation/curb/instrumentation.rb
|
266
270
|
- lib/new_relic/agent/instrumentation/curb/prepend.rb
|
271
|
+
- lib/new_relic/agent/instrumentation/custom_events_subscriber.rb
|
267
272
|
- lib/new_relic/agent/instrumentation/data_mapper.rb
|
268
273
|
- lib/new_relic/agent/instrumentation/delayed_job/chain.rb
|
269
274
|
- lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb
|
@@ -334,6 +339,7 @@ files:
|
|
334
339
|
- lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb
|
335
340
|
- lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb
|
336
341
|
- lib/new_relic/agent/instrumentation/rails_notifications/action_view.rb
|
342
|
+
- lib/new_relic/agent/instrumentation/rails_notifications/custom_events.rb
|
337
343
|
- lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb
|
338
344
|
- lib/new_relic/agent/instrumentation/rake.rb
|
339
345
|
- lib/new_relic/agent/instrumentation/rake/chain.rb
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# This file is distributed under New Relic's license terms.
|
2
|
-
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
module NewRelic
|
6
|
-
module Agent
|
7
|
-
module Shutdown
|
8
|
-
# Attempt a graceful shutdown of the agent, flushing any remaining
|
9
|
-
# data.
|
10
|
-
def shutdown
|
11
|
-
return unless started?
|
12
|
-
|
13
|
-
::NewRelic::Agent.logger.info("Starting Agent shutdown")
|
14
|
-
|
15
|
-
stop_event_loop
|
16
|
-
trap_signals_for_litespeed
|
17
|
-
untraced_graceful_disconnect
|
18
|
-
revert_to_default_configuration
|
19
|
-
|
20
|
-
@started = nil
|
21
|
-
Control.reset
|
22
|
-
end
|
23
|
-
|
24
|
-
def untraced_graceful_disconnect
|
25
|
-
begin
|
26
|
-
NewRelic::Agent.disable_all_tracing do
|
27
|
-
graceful_disconnect
|
28
|
-
end
|
29
|
-
rescue => e
|
30
|
-
::NewRelic::Agent.logger.error(e)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,72 +0,0 @@
|
|
1
|
-
# This file is distributed under New Relic's license terms.
|
2
|
-
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
module NewRelic
|
6
|
-
module Agent
|
7
|
-
module SpecialStartup
|
8
|
-
# If we're using a dispatcher that forks before serving
|
9
|
-
# requests, we need to wait until the children are forked
|
10
|
-
# before connecting, otherwise the parent process sends useless data
|
11
|
-
def using_forking_dispatcher?
|
12
|
-
# TODO: MAJOR VERSION - remove :rainbows
|
13
|
-
if [:puma, :passenger, :rainbows, :unicorn].include?(Agent.config[:dispatcher])
|
14
|
-
::NewRelic::Agent.logger.info("Deferring startup of agent reporting thread because #{Agent.config[:dispatcher]} may fork.")
|
15
|
-
true
|
16
|
-
else
|
17
|
-
false
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# Return true if we're using resque and it hasn't had a chance to (potentially)
|
22
|
-
# daemonize itself. This avoids hanging when there's a Thread started
|
23
|
-
# before Resque calls Process.daemon (Jira RUBY-857)
|
24
|
-
def defer_for_resque?
|
25
|
-
NewRelic::Agent.config[:dispatcher] == :resque &&
|
26
|
-
NewRelic::Agent::Instrumentation::Resque::Helper.resque_fork_per_job? &&
|
27
|
-
!PipeChannelManager.listener.started?
|
28
|
-
end
|
29
|
-
|
30
|
-
def in_resque_child_process?
|
31
|
-
defined?(@service) && @service.is_a?(PipeService)
|
32
|
-
end
|
33
|
-
|
34
|
-
def defer_for_delayed_job?
|
35
|
-
NewRelic::Agent.config[:dispatcher] == :delayed_job &&
|
36
|
-
!NewRelic::DelayedJobInjection.worker_name
|
37
|
-
end
|
38
|
-
|
39
|
-
# This matters when the following three criteria are met:
|
40
|
-
#
|
41
|
-
# 1. A Sinatra 'classic' application is being run
|
42
|
-
# 2. The app is being run by executing the main file directly, rather
|
43
|
-
# than via a config.ru file.
|
44
|
-
# 3. newrelic_rpm is required *after* sinatra
|
45
|
-
#
|
46
|
-
# In this case, the entire application runs from an at_exit handler in
|
47
|
-
# Sinatra, and if we were to install ours, it would be executed before
|
48
|
-
# the one in Sinatra, meaning that we'd shutdown the agent too early
|
49
|
-
# and never collect any data.
|
50
|
-
def sinatra_classic_app?
|
51
|
-
(
|
52
|
-
defined?(Sinatra::Application) &&
|
53
|
-
Sinatra::Application.respond_to?(:run) &&
|
54
|
-
Sinatra::Application.run?
|
55
|
-
)
|
56
|
-
end
|
57
|
-
|
58
|
-
def should_install_exit_handler?
|
59
|
-
return false unless Agent.config[:send_data_on_exit]
|
60
|
-
|
61
|
-
!sinatra_classic_app? || Agent.config[:force_install_exit_handler]
|
62
|
-
end
|
63
|
-
|
64
|
-
def install_exit_handler
|
65
|
-
return unless should_install_exit_handler?
|
66
|
-
|
67
|
-
NewRelic::Agent.logger.debug("Installing at_exit handler")
|
68
|
-
at_exit { shutdown }
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|