newrelic_rpm 8.13.1 → 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 +1 -0
- data/CHANGELOG.md +3257 -3152
- data/CONTRIBUTING.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 -8
- 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 +2 -2
- 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
@@ -18,14 +18,14 @@ require_relative 'memcache/prepend'
|
|
18
18
|
DependencyDetection.defer do
|
19
19
|
named :memcache_client
|
20
20
|
|
21
|
-
depends_on { defined?
|
21
|
+
depends_on { defined? MemCache }
|
22
22
|
|
23
23
|
executes do
|
24
24
|
if use_prepend?
|
25
|
-
prepend_module =
|
26
|
-
prepend_instrument
|
25
|
+
prepend_module = NewRelic::Agent::Instrumentation::Memcache::Prepend.client_prepender(MemCache)
|
26
|
+
prepend_instrument MemCache, prepend_module, "MemcacheClient"
|
27
27
|
else
|
28
|
-
chain_instrument_target
|
28
|
+
chain_instrument_target MemCache, NewRelic::Agent::Instrumentation::Memcache::Chain, "MemcacheClient"
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -33,14 +33,14 @@ end
|
|
33
33
|
DependencyDetection.defer do
|
34
34
|
named :memcached
|
35
35
|
|
36
|
-
depends_on { defined?
|
36
|
+
depends_on { defined? Memcached }
|
37
37
|
|
38
38
|
executes do
|
39
39
|
if use_prepend?
|
40
|
-
prepend_module =
|
41
|
-
prepend_instrument
|
40
|
+
prepend_module = NewRelic::Agent::Instrumentation::Memcache::Prepend.client_prepender(Memcached)
|
41
|
+
prepend_instrument Memcached, prepend_module, "Memcached"
|
42
42
|
else
|
43
|
-
chain_instrument_target
|
43
|
+
chain_instrument_target Memcached, NewRelic::Agent::Instrumentation::Memcache::Chain, "Memcached"
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -49,16 +49,16 @@ DependencyDetection.defer do
|
|
49
49
|
named :dalli
|
50
50
|
configure_with :memcache
|
51
51
|
|
52
|
-
depends_on { defined?
|
52
|
+
depends_on { defined? Dalli::Client }
|
53
53
|
|
54
54
|
executes do
|
55
55
|
if use_prepend?
|
56
|
-
prepend_module =
|
56
|
+
prepend_module = NewRelic::Agent::Instrumentation::Memcache::Prepend
|
57
57
|
prepend_module.dalli_prependers do |client_class, instrumenting_module|
|
58
58
|
prepend_instrument client_class, instrumenting_module, "MemcachedDalli"
|
59
59
|
end
|
60
60
|
else
|
61
|
-
chain_instrument
|
61
|
+
chain_instrument NewRelic::Agent::Instrumentation::Memcache::Dalli
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
@@ -70,18 +70,18 @@ DependencyDetection.defer do
|
|
70
70
|
named :dalli_cas_client
|
71
71
|
configure_with :memcache
|
72
72
|
|
73
|
-
depends_on { defined?
|
74
|
-
depends_on {
|
73
|
+
depends_on { defined? Dalli::Client }
|
74
|
+
depends_on { NewRelic::Agent::Instrumentation::Memcache::DalliCAS.should_instrument? }
|
75
75
|
|
76
76
|
executes do
|
77
|
-
|
77
|
+
NewRelic::Agent.logger.info('Installing Dalli CAS Client Memcache instrumentation')
|
78
78
|
if use_prepend?
|
79
|
-
prepend_module =
|
79
|
+
prepend_module = NewRelic::Agent::Instrumentation::Memcache::Prepend
|
80
80
|
prepend_module.dalli_cas_prependers do |client_class, instrumenting_module|
|
81
81
|
prepend_instrument client_class, instrumenting_module, "MemcachedDalliCAS"
|
82
82
|
end
|
83
83
|
else
|
84
|
-
chain_instrument
|
84
|
+
chain_instrument NewRelic::Agent::Instrumentation::Memcache::DalliCAS
|
85
85
|
end
|
86
86
|
end
|
87
87
|
end
|
@@ -13,21 +13,21 @@ DependencyDetection.defer do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
executes do
|
16
|
-
|
16
|
+
NewRelic::Agent.logger.info('Installing Net:HTTP Wrappers')
|
17
17
|
require 'new_relic/agent/http_clients/net_http_wrappers'
|
18
18
|
end
|
19
19
|
|
20
20
|
# Airbrake uses method chaining on Net::HTTP in versions < 10.0.2 (10.0.2 updated to prepend for Net:HTTP)
|
21
21
|
conflicts_with_prepend do
|
22
|
-
defined?(
|
22
|
+
defined?(Airbrake) && defined?(Airbrake::AIRBRAKE_VERSION) && Gem::Version.create(Airbrake::AIRBRAKE_VERSION) < Gem::Version.create('10.0.2')
|
23
23
|
end
|
24
24
|
|
25
25
|
conflicts_with_prepend do
|
26
|
-
defined?(
|
26
|
+
defined?(ScoutApm)
|
27
27
|
end
|
28
28
|
|
29
29
|
conflicts_with_prepend do
|
30
|
-
defined?(
|
30
|
+
defined?(Rack::MiniProfiler)
|
31
31
|
end
|
32
32
|
|
33
33
|
conflicts_with_prepend do
|
@@ -36,9 +36,9 @@ DependencyDetection.defer do
|
|
36
36
|
|
37
37
|
executes do
|
38
38
|
if use_prepend?
|
39
|
-
prepend_instrument
|
39
|
+
prepend_instrument Net::HTTP, NewRelic::Agent::Instrumentation::NetHTTP::Prepend
|
40
40
|
else
|
41
|
-
chain_instrument
|
41
|
+
chain_instrument NewRelic::Agent::Instrumentation::NetHTTP::Chain
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -19,12 +19,12 @@ DependencyDetection.defer do
|
|
19
19
|
@name = :padrino
|
20
20
|
configure_with :sinatra
|
21
21
|
|
22
|
-
depends_on { defined?(
|
22
|
+
depends_on { defined?(Padrino) && defined?(Padrino::Routing::InstanceMethods) }
|
23
23
|
|
24
24
|
executes do
|
25
|
-
|
25
|
+
NewRelic::Agent.logger.info('Installing Padrino instrumentation')
|
26
26
|
if use_prepend?
|
27
|
-
prepend_instrument
|
27
|
+
prepend_instrument Padrino::Application, NewRelic::Agent::Instrumentation::PadrinoTracer::Prepend
|
28
28
|
else
|
29
29
|
chain_instrument NewRelic::Agent::Instrumentation::PadrinoTracer::Chain
|
30
30
|
end
|
@@ -6,18 +6,18 @@ DependencyDetection.defer do
|
|
6
6
|
@name = :passenger
|
7
7
|
|
8
8
|
depends_on do
|
9
|
-
defined?(
|
9
|
+
defined?(PhusionPassenger)
|
10
10
|
end
|
11
11
|
|
12
12
|
executes do
|
13
|
-
|
13
|
+
NewRelic::Agent.logger.debug("Installing Passenger event hooks.")
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
PhusionPassenger.on_event(:stopping_worker_process) do
|
16
|
+
NewRelic::Agent.logger.debug("Passenger stopping this process, shutdown the agent.")
|
17
17
|
NewRelic::Agent.instance.shutdown
|
18
18
|
end
|
19
19
|
|
20
|
-
|
20
|
+
PhusionPassenger.on_event(:starting_worker_process) do |forked|
|
21
21
|
# We want to reset the stats from the stats engine in case any carried
|
22
22
|
# over into the spawned process. Don't clear them in case any were
|
23
23
|
# cached. We do this even in conservative spawning.
|
@@ -13,14 +13,14 @@ DependencyDetection.defer do
|
|
13
13
|
named :rack
|
14
14
|
|
15
15
|
depends_on do
|
16
|
-
defined?(
|
16
|
+
defined?(Rack) && defined?(Rack::Builder)
|
17
17
|
end
|
18
18
|
|
19
19
|
executes do
|
20
20
|
if use_prepend?
|
21
|
-
prepend_instrument
|
21
|
+
prepend_instrument Rack::Builder, NewRelic::Agent::Instrumentation::Rack::Prepend
|
22
22
|
else
|
23
|
-
chain_instrument_target
|
23
|
+
chain_instrument_target Rack::Builder, NewRelic::Agent::Instrumentation::Rack::Chain
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -29,14 +29,14 @@ DependencyDetection.defer do
|
|
29
29
|
named :puma_rack
|
30
30
|
|
31
31
|
depends_on do
|
32
|
-
defined?(
|
32
|
+
defined?(Puma::Rack::Builder)
|
33
33
|
end
|
34
34
|
|
35
35
|
executes do
|
36
36
|
if use_prepend?
|
37
|
-
prepend_instrument
|
37
|
+
prepend_instrument Puma::Rack::Builder, NewRelic::Agent::Instrumentation::Rack::Prepend
|
38
38
|
else
|
39
|
-
chain_instrument_target
|
39
|
+
chain_instrument_target Puma::Rack::Builder, NewRelic::Agent::Instrumentation::Rack::Chain
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -45,19 +45,19 @@ DependencyDetection.defer do
|
|
45
45
|
named :rack_urlmap
|
46
46
|
|
47
47
|
depends_on do
|
48
|
-
defined?(
|
48
|
+
defined?(Rack) && defined?(Rack::URLMap)
|
49
49
|
end
|
50
50
|
|
51
51
|
depends_on do
|
52
|
-
|
52
|
+
NewRelic::Agent::Instrumentation::RackHelpers.middleware_instrumentation_enabled?
|
53
53
|
end
|
54
54
|
|
55
55
|
executes do
|
56
56
|
if use_prepend?
|
57
|
-
prepend_instrument
|
57
|
+
prepend_instrument Rack::URLMap, NewRelic::Agent::Instrumentation::Rack::URLMap::Prepend
|
58
58
|
else
|
59
|
-
chain_instrument_target
|
60
|
-
|
59
|
+
chain_instrument_target Rack::URLMap, NewRelic::Agent::Instrumentation::Rack::URLMap::Chain
|
60
|
+
NewRelic::Agent::Instrumentation::RackHelpers.instrument_url_map
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
@@ -70,14 +70,14 @@ DependencyDetection.defer do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
depends_on do
|
73
|
-
|
73
|
+
NewRelic::Agent::Instrumentation::RackHelpers.middleware_instrumentation_enabled?
|
74
74
|
end
|
75
75
|
|
76
76
|
executes do
|
77
77
|
if use_prepend?
|
78
|
-
prepend_instrument
|
78
|
+
prepend_instrument Puma::Rack::URLMap, NewRelic::Agent::Instrumentation::Rack::URLMap::Prepend
|
79
79
|
else
|
80
|
-
chain_instrument_target
|
80
|
+
chain_instrument_target Puma::Rack::URLMap, NewRelic::Agent::Instrumentation::Rack::URLMap::Chain
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
@@ -66,7 +66,7 @@ DependencyDetection.defer do
|
|
66
66
|
@name = :rails3_controller
|
67
67
|
|
68
68
|
depends_on do
|
69
|
-
defined?(
|
69
|
+
defined?(Rails::VERSION::MAJOR) && Rails::VERSION::MAJOR.to_i == 3
|
70
70
|
end
|
71
71
|
|
72
72
|
depends_on do
|
@@ -74,7 +74,7 @@ DependencyDetection.defer do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
executes do
|
77
|
-
|
77
|
+
NewRelic::Agent.logger.info('Installing Rails 3 Controller instrumentation')
|
78
78
|
end
|
79
79
|
|
80
80
|
executes do
|
@@ -92,8 +92,8 @@ DependencyDetection.defer do
|
|
92
92
|
|
93
93
|
# Enabled for Rails 3.2
|
94
94
|
depends_on do
|
95
|
-
defined?(
|
96
|
-
|
95
|
+
defined?(Rails::VERSION::MAJOR) && defined?(Rails::VERSION::MINOR) &&
|
96
|
+
Rails::VERSION::MAJOR.to_i == 3 && Rails::VERSION::MINOR.to_i == 2
|
97
97
|
end
|
98
98
|
|
99
99
|
depends_on do
|
@@ -101,7 +101,7 @@ DependencyDetection.defer do
|
|
101
101
|
end
|
102
102
|
|
103
103
|
executes do
|
104
|
-
|
104
|
+
NewRelic::Agent.logger.info('Installing Rails 3.2 view instrumentation')
|
105
105
|
end
|
106
106
|
|
107
107
|
executes do
|
@@ -8,15 +8,15 @@ DependencyDetection.defer do
|
|
8
8
|
named :rails_middleware
|
9
9
|
|
10
10
|
depends_on do
|
11
|
-
|
11
|
+
!NewRelic::Agent.config[:disable_middleware_instrumentation]
|
12
12
|
end
|
13
13
|
|
14
14
|
depends_on do
|
15
|
-
defined?(
|
15
|
+
defined?(Rails::VERSION::MAJOR) && Rails::VERSION::MAJOR.to_i >= 3
|
16
16
|
end
|
17
17
|
|
18
18
|
executes do
|
19
|
-
|
19
|
+
NewRelic::Agent.logger.info("Installing Rails 3+ middleware instrumentation")
|
20
20
|
module ActionDispatch
|
21
21
|
class MiddlewareStack
|
22
22
|
class Middleware
|
@@ -9,9 +9,9 @@ DependencyDetection.defer do
|
|
9
9
|
@name = :action_cable_notifications
|
10
10
|
|
11
11
|
depends_on do
|
12
|
-
defined?(
|
13
|
-
|
14
|
-
defined?(
|
12
|
+
defined?(Rails::VERSION::MAJOR) &&
|
13
|
+
Rails::VERSION::MAJOR.to_i >= 5 &&
|
14
|
+
defined?(ActionCable)
|
15
15
|
end
|
16
16
|
|
17
17
|
depends_on do
|
@@ -20,7 +20,7 @@ DependencyDetection.defer do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
executes do
|
23
|
-
|
23
|
+
NewRelic::Agent.logger.info('Installing notifications based Action Cable instrumentation')
|
24
24
|
end
|
25
25
|
|
26
26
|
executes do
|
@@ -29,8 +29,8 @@ DependencyDetection.defer do
|
|
29
29
|
NewRelic::Agent::Instrumentation::ActionCableSubscriber.new)
|
30
30
|
|
31
31
|
ActiveSupport.on_load(:action_cable) do
|
32
|
-
|
33
|
-
|
32
|
+
NewRelic::Agent::PrependSupportability.record_metrics_for(ActionCable::Engine) if defined?(ActionCable::Engine)
|
33
|
+
NewRelic::Agent::PrependSupportability.record_metrics_for(ActionCable::RemoteConnections) if defined?(ActionCable::RemoteConnections)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -9,7 +9,7 @@ DependencyDetection.defer do
|
|
9
9
|
@name = :action_controller_notifications
|
10
10
|
|
11
11
|
depends_on do
|
12
|
-
defined?(
|
12
|
+
defined?(Rails::VERSION::MAJOR) && Rails::VERSION::MAJOR.to_i >= 4
|
13
13
|
end
|
14
14
|
|
15
15
|
depends_on do
|
@@ -17,7 +17,7 @@ DependencyDetection.defer do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
executes do
|
20
|
-
|
20
|
+
NewRelic::Agent.logger.info('Installing notifications based Action Controller instrumentation')
|
21
21
|
end
|
22
22
|
|
23
23
|
executes do
|
@@ -9,7 +9,7 @@ DependencyDetection.defer do
|
|
9
9
|
@name = :action_view_notifications
|
10
10
|
|
11
11
|
depends_on do
|
12
|
-
defined?(
|
12
|
+
defined?(Rails::VERSION::MAJOR) && Rails::VERSION::MAJOR.to_i >= 4
|
13
13
|
end
|
14
14
|
|
15
15
|
depends_on do
|
@@ -22,7 +22,9 @@ DependencyDetection.defer do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
executes do
|
25
|
-
|
26
|
-
|
25
|
+
ActiveSupport.on_load(:action_view) do
|
26
|
+
NewRelic::Agent::Instrumentation::ActionViewSubscriber.subscribe(/render_.+\.action_view$/)
|
27
|
+
NewRelic::Agent::PrependSupportability.record_metrics_for(ActionView::Base, ActionView::Template, ActionView::Renderer)
|
28
|
+
end
|
27
29
|
end
|
28
30
|
end
|
@@ -0,0 +1,30 @@
|
|
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
|
+
require 'new_relic/agent/instrumentation/custom_events_subscriber'
|
6
|
+
require 'new_relic/agent/prepend_supportability'
|
7
|
+
|
8
|
+
DependencyDetection.defer do
|
9
|
+
@name = :custom_event_notifications
|
10
|
+
|
11
|
+
depends_on do
|
12
|
+
defined?(ActiveSupport::Notifications) &&
|
13
|
+
defined?(ActiveSupport::IsolatedExecutionState)
|
14
|
+
end
|
15
|
+
|
16
|
+
depends_on do
|
17
|
+
!NewRelic::Agent.config[:active_support_custom_events_names].empty? &&
|
18
|
+
!NewRelic::Agent::Instrumentation::CustomEventsSubscriber.subscribed?
|
19
|
+
end
|
20
|
+
|
21
|
+
executes do
|
22
|
+
NewRelic::Agent.logger.info('Installing notifications based ActiveSupport custom events instrumentation')
|
23
|
+
end
|
24
|
+
|
25
|
+
executes do
|
26
|
+
NewRelic::Agent.config[:active_support_custom_events_names].each do |name|
|
27
|
+
ActiveSupport::Notifications.subscribe(name, NewRelic::Agent::Instrumentation::CustomEventsSubscriber.new)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -6,18 +6,18 @@ DependencyDetection.defer do
|
|
6
6
|
@name = :rainbows
|
7
7
|
|
8
8
|
depends_on do
|
9
|
-
defined?(
|
9
|
+
defined?(Rainbows) && defined?(Rainbows::HttpServer)
|
10
10
|
end
|
11
11
|
|
12
12
|
executes do
|
13
|
-
|
14
|
-
|
13
|
+
NewRelic::Agent.logger.info('Installing Rainbows instrumentation')
|
14
|
+
NewRelic::Agent.logger.info('Detected Rainbows, please see additional documentation: https://newrelic.com/docs/troubleshooting/im-using-unicorn-and-i-dont-see-any-data')
|
15
15
|
|
16
16
|
deprecation_msg = 'The dispatcher rainbows is deprecated. It will be removed ' \
|
17
17
|
'in version 9.0.0. Please use a supported dispatcher instead. ' \
|
18
18
|
'Visit https://docs.newrelic.com/docs/apm/agents/ruby-agent/getting-started/ruby-agent-requirements-supported-frameworks for options.'
|
19
19
|
|
20
|
-
|
20
|
+
NewRelic::Agent.logger.log_once(
|
21
21
|
:warn,
|
22
22
|
:deprecated_rainbows_dispatcher,
|
23
23
|
deprecation_msg
|
@@ -11,19 +11,19 @@ DependencyDetection.defer do
|
|
11
11
|
named :rake_instrumentation
|
12
12
|
configure_with :rake
|
13
13
|
|
14
|
-
depends_on { defined?(
|
15
|
-
depends_on { Gem::Version.new(
|
16
|
-
depends_on {
|
17
|
-
depends_on {
|
14
|
+
depends_on { defined?(Rake) && defined?(Rake::VERSION) }
|
15
|
+
depends_on { Gem::Version.new(Rake::VERSION) >= Gem::Version.new("10.0.0") }
|
16
|
+
depends_on { NewRelic::Agent.config[:'rake.tasks'].any? }
|
17
|
+
depends_on { NewRelic::Agent::Instrumentation::Rake.safe_from_third_party_gem? }
|
18
18
|
|
19
19
|
executes do
|
20
|
-
|
21
|
-
|
20
|
+
NewRelic::Agent.logger.info("Installing Rake instrumentation")
|
21
|
+
NewRelic::Agent.logger.debug("Instrumenting Rake tasks: #{NewRelic::Agent.config[:'rake.tasks']}")
|
22
22
|
end
|
23
23
|
|
24
24
|
executes do
|
25
25
|
if use_prepend?
|
26
|
-
prepend_instrument
|
26
|
+
prepend_instrument Rake::Task, NewRelic::Agent::Instrumentation::Rake::Prepend
|
27
27
|
else
|
28
28
|
chain_instrument NewRelic::Agent::Instrumentation::Rake::Chain
|
29
29
|
end
|
@@ -27,10 +27,17 @@ module NewRelic::Agent::Instrumentation
|
|
27
27
|
|
28
28
|
# Used for Redis 5.x+
|
29
29
|
def call_pipelined_with_tracing(pipeline)
|
30
|
+
db = begin
|
31
|
+
_nr_redis_client_config.db
|
32
|
+
rescue StandardError => e
|
33
|
+
NewRelic::Agent.logger.error("Failed to determine configured Redis db value: #{e.class} - #{e.message}")
|
34
|
+
nil
|
35
|
+
end
|
36
|
+
|
30
37
|
operation = pipeline.flatten.include?('MULTI') ? Constants::MULTI_OPERATION : Constants::PIPELINE_OPERATION
|
31
38
|
statement = ::NewRelic::Agent::Datastores::Redis.format_pipeline_commands(pipeline)
|
32
39
|
|
33
|
-
with_tracing(operation, statement: statement, database:
|
40
|
+
with_tracing(operation, statement: statement, database: db) { yield }
|
34
41
|
end
|
35
42
|
|
36
43
|
private
|
@@ -47,26 +54,40 @@ module NewRelic::Agent::Instrumentation
|
|
47
54
|
segment.notice_nosql_statement(statement) if statement
|
48
55
|
NewRelic::Agent::Tracer.capture_segment_error(segment) { yield }
|
49
56
|
ensure
|
50
|
-
|
57
|
+
::NewRelic::Agent::Transaction::Segment.finish(segment)
|
51
58
|
end
|
52
59
|
end
|
53
60
|
|
54
61
|
def _nr_hostname
|
55
|
-
|
62
|
+
_nr_redis_client_config.path ? Constants::LOCALHOST : _nr_redis_client_config.host
|
56
63
|
rescue => e
|
57
|
-
NewRelic::Agent.logger.debug("Failed to retrieve Redis host: #{e}")
|
64
|
+
NewRelic::Agent.logger.debug("Failed to retrieve Redis host: #{e.class} - #{e.message}")
|
58
65
|
Constants::UNKNOWN
|
59
66
|
end
|
60
67
|
|
61
68
|
def _nr_port_path_or_id
|
62
|
-
|
69
|
+
_nr_redis_client_config.path || _nr_redis_client_config.port
|
63
70
|
rescue => e
|
64
|
-
NewRelic::Agent.logger.debug("Failed to retrieve Redis port_path_or_id: #{e}")
|
71
|
+
NewRelic::Agent.logger.debug("Failed to retrieve Redis port_path_or_id: #{e.class} - #{e.message}")
|
65
72
|
Constants::UNKNOWN
|
66
73
|
end
|
67
74
|
|
68
|
-
def
|
69
|
-
@
|
75
|
+
def _nr_redis_client_config
|
76
|
+
@nr_config ||= begin
|
77
|
+
# redis gem
|
78
|
+
config = if defined?(::Redis::Client) && self.is_a?(::Redis::Client)
|
79
|
+
self
|
80
|
+
# redis-client gem v0.11+ (self is a RedisClient::Middlewares)
|
81
|
+
elsif respond_to?(:client)
|
82
|
+
client && client.config
|
83
|
+
# redis-client gem <0.11 (self is a RedisClient::Middlewares)
|
84
|
+
elsif defined?(::RedisClient)
|
85
|
+
::RedisClient.config if ::RedisClient.respond_to?(:config)
|
86
|
+
end
|
87
|
+
raise 'Unable to locate the underlying Redis client configuration.' unless config
|
88
|
+
|
89
|
+
config
|
90
|
+
end
|
70
91
|
end
|
71
92
|
end
|
72
93
|
end
|
@@ -17,11 +17,11 @@ DependencyDetection.defer do
|
|
17
17
|
configure_with :redis
|
18
18
|
|
19
19
|
depends_on do
|
20
|
-
defined?(
|
20
|
+
defined?(Redis) && defined?(Redis::VERSION)
|
21
21
|
end
|
22
22
|
|
23
23
|
conflicts_with_prepend do
|
24
|
-
defined?(
|
24
|
+
defined?(PrometheusExporter)
|
25
25
|
end
|
26
26
|
|
27
27
|
depends_on do
|
@@ -32,11 +32,11 @@ DependencyDetection.defer do
|
|
32
32
|
executes do
|
33
33
|
NewRelic::Agent.logger.info('Installing Redis Instrumentation')
|
34
34
|
if NewRelic::Agent::Instrumentation::Redis::Constants::HAS_REDIS_CLIENT
|
35
|
-
|
35
|
+
RedisClient.register(NewRelic::Agent::Instrumentation::RedisClient::Middleware)
|
36
36
|
end
|
37
37
|
|
38
38
|
if use_prepend?
|
39
|
-
prepend_instrument
|
39
|
+
prepend_instrument Redis::Client, NewRelic::Agent::Instrumentation::Redis::Prepend
|
40
40
|
else
|
41
41
|
chain_instrument NewRelic::Agent::Instrumentation::Redis::Chain
|
42
42
|
end
|
@@ -10,21 +10,21 @@ DependencyDetection.defer do
|
|
10
10
|
@name = :resque
|
11
11
|
|
12
12
|
depends_on do
|
13
|
-
defined?(
|
13
|
+
defined?(Resque::Job) && !NewRelic::Agent.config[:disable_resque]
|
14
14
|
end
|
15
15
|
|
16
16
|
# Airbrake uses method chaining on Resque::Job on versions < 11.0.3
|
17
17
|
conflicts_with_prepend do
|
18
|
-
defined?(
|
18
|
+
defined?(Airbrake) && defined?(Airbrake::AIRBRAKE_VERSION) && Gem::Version.create(Airbrake::AIRBRAKE_VERSION) < Gem::Version.create('11.0.3')
|
19
19
|
end
|
20
20
|
|
21
21
|
executes do
|
22
|
-
|
22
|
+
NewRelic::Agent.logger.info('Installing Resque instrumentation')
|
23
23
|
end
|
24
24
|
|
25
25
|
executes do
|
26
26
|
if NewRelic::Agent.config[:'resque.use_ruby_dns'] && NewRelic::Agent.config[:dispatcher] == :resque
|
27
|
-
|
27
|
+
NewRelic::Agent.logger.info('Requiring resolv-replace')
|
28
28
|
require 'resolv'
|
29
29
|
require 'resolv-replace'
|
30
30
|
end
|
@@ -32,30 +32,30 @@ DependencyDetection.defer do
|
|
32
32
|
|
33
33
|
executes do
|
34
34
|
if use_prepend?
|
35
|
-
prepend_instrument
|
35
|
+
prepend_instrument Resque::Job, NewRelic::Agent::Instrumentation::Resque::Prepend
|
36
36
|
else
|
37
37
|
chain_instrument NewRelic::Agent::Instrumentation::Resque::Chain
|
38
38
|
end
|
39
39
|
|
40
40
|
if NewRelic::Agent::Instrumentation::Resque::Helper.resque_fork_per_job?
|
41
|
-
|
41
|
+
Resque.before_first_fork do
|
42
42
|
NewRelic::Agent.manual_start(:dispatcher => :resque,
|
43
43
|
:sync_startup => true,
|
44
44
|
:start_channel_listener => true)
|
45
45
|
end
|
46
46
|
|
47
|
-
|
47
|
+
Resque.before_fork do |job|
|
48
48
|
NewRelic::Agent.register_report_channel(job.object_id)
|
49
49
|
end
|
50
50
|
|
51
|
-
|
51
|
+
Resque.after_fork do |job|
|
52
52
|
# Only suppress reporting Instance/Busy for forked children
|
53
53
|
# Traced errors UI relies on having the parent process report that metric
|
54
54
|
NewRelic::Agent.after_fork(:report_to_channel => job.object_id,
|
55
55
|
:report_instance_busy => false)
|
56
56
|
end
|
57
57
|
else
|
58
|
-
|
58
|
+
Resque.before_first_fork do
|
59
59
|
NewRelic::Agent.manual_start(:dispatcher => :resque,
|
60
60
|
:sync_startup => true,
|
61
61
|
:start_channel_listener => false)
|
@@ -7,7 +7,7 @@ DependencyDetection.defer do
|
|
7
7
|
@name = :sequel
|
8
8
|
|
9
9
|
depends_on do
|
10
|
-
defined?(
|
10
|
+
defined?(Sequel)
|
11
11
|
end
|
12
12
|
|
13
13
|
depends_on do
|
@@ -24,7 +24,7 @@ DependencyDetection.defer do
|
|
24
24
|
executes do
|
25
25
|
if supported_sequel_version?
|
26
26
|
|
27
|
-
|
27
|
+
NewRelic::Agent.logger.info('Installing Sequel instrumentation')
|
28
28
|
|
29
29
|
if Sequel::Database.respond_to?(:extension)
|
30
30
|
Sequel::Database.extension(:newrelic_instrumentation)
|