newrelic_rpm 8.13.1 → 8.15.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 +130 -1
- data/.rubocop_todo.yml +3 -0
- data/CHANGELOG.md +3284 -3148
- data/CONTRIBUTING.md +1 -2
- data/README.md +2 -1
- 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 +47 -9
- data/lib/new_relic/agent/datastores.rb +2 -2
- data/lib/new_relic/agent/event_loop.rb +1 -1
- data/lib/new_relic/agent/guid_generator.rb +11 -2
- data/lib/new_relic/agent/heap.rb +1 -1
- 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/concurrent_ruby/chain.rb +36 -0
- data/lib/new_relic/agent/instrumentation/concurrent_ruby/instrumentation.rb +21 -0
- data/lib/new_relic/agent/instrumentation/concurrent_ruby/prepend.rb +27 -0
- data/lib/new_relic/agent/instrumentation/concurrent_ruby.rb +31 -0
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +1 -1
- 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/instrumentation.rb +5 -1
- 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/javascript_instrumentor.rb +2 -2
- data/lib/new_relic/agent/method_tracer_helpers.rb +6 -11
- data/lib/new_relic/agent/range_extensions.rb +2 -2
- data/lib/new_relic/agent/tracer.rb +8 -4
- data/lib/new_relic/agent/transaction/abstract_segment.rb +2 -2
- data/lib/new_relic/agent/transaction/segment.rb +6 -0
- data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -1
- data/lib/new_relic/agent/transaction.rb +3 -3
- data/lib/new_relic/agent.rb +7 -0
- data/lib/new_relic/control/instance_methods.rb +6 -2
- data/lib/new_relic/helper.rb +1 -1
- data/lib/new_relic/recipes/helpers/send_deployment.rb +2 -1
- data/lib/new_relic/traced_thread.rb +5 -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 +23 -5
- data/test/agent_helper.rb +7 -7
- metadata +16 -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
@@ -13,32 +13,32 @@ DependencyDetection.defer do
|
|
13
13
|
configure_with :grape
|
14
14
|
|
15
15
|
depends_on do
|
16
|
-
defined?(
|
17
|
-
Gem::Version.new(
|
16
|
+
defined?(Grape::VERSION) &&
|
17
|
+
Gem::Version.new(Grape::VERSION) >= NewRelic::Agent::Instrumentation::Grape::Instrumentation::MIN_VERSION
|
18
18
|
end
|
19
19
|
|
20
20
|
depends_on do
|
21
21
|
begin
|
22
22
|
if defined?(Bundler) && Bundler.rubygems.all_specs.map(&:name).include?("newrelic-grape")
|
23
|
-
|
23
|
+
NewRelic::Agent.logger.info("Not installing New Relic supported Grape instrumentation because the third party newrelic-grape gem is present")
|
24
24
|
false
|
25
25
|
else
|
26
26
|
true
|
27
27
|
end
|
28
28
|
rescue => e
|
29
|
-
|
29
|
+
NewRelic::Agent.logger.info("Could not determine if third party newrelic-grape gem is installed", e)
|
30
30
|
true
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
34
|
executes do
|
35
|
-
|
35
|
+
NewRelic::Agent::Instrumentation::Grape::Instrumentation.prepare!
|
36
36
|
|
37
37
|
if use_prepend?
|
38
|
-
instrumented_class =
|
39
|
-
prepend_instrument instrumented_class,
|
38
|
+
instrumented_class = NewRelic::Agent::Instrumentation::Grape::Instrumentation.instrumented_class
|
39
|
+
prepend_instrument instrumented_class, NewRelic::Agent::Instrumentation::Grape::Prepend
|
40
40
|
else
|
41
|
-
chain_instrument
|
41
|
+
chain_instrument NewRelic::Agent::Instrumentation::Grape::Chain
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -9,15 +9,15 @@ DependencyDetection.defer do
|
|
9
9
|
named :grpc_client
|
10
10
|
|
11
11
|
depends_on do
|
12
|
-
defined?(
|
12
|
+
defined?(GRPC) && defined?(GRPC::ClientStub)
|
13
13
|
end
|
14
14
|
|
15
15
|
executes do
|
16
16
|
supportability_name = 'gRPC_Client'
|
17
17
|
if use_prepend?
|
18
|
-
prepend_instrument
|
18
|
+
prepend_instrument GRPC::ClientStub, NewRelic::Agent::Instrumentation::GRPC::Client::Prepend, supportability_name
|
19
19
|
else
|
20
|
-
chain_instrument
|
20
|
+
chain_instrument NewRelic::Agent::Instrumentation::GRPC::Client::Chain, supportability_name
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -10,16 +10,16 @@ DependencyDetection.defer do
|
|
10
10
|
named :grpc_server
|
11
11
|
|
12
12
|
depends_on do
|
13
|
-
defined?(
|
13
|
+
defined?(GRPC) && defined?(GRPC::RpcServer) && defined?(GRPC::RpcDesc)
|
14
14
|
end
|
15
15
|
|
16
16
|
executes do
|
17
17
|
supportability_name = 'gRPC_Server'
|
18
18
|
if use_prepend?
|
19
|
-
prepend_instrument
|
20
|
-
prepend_instrument
|
19
|
+
prepend_instrument GRPC::RpcServer, NewRelic::Agent::Instrumentation::GRPC::Server::RpcServerPrepend, supportability_name
|
20
|
+
prepend_instrument GRPC::RpcDesc, NewRelic::Agent::Instrumentation::GRPC::Server::RpcDescPrepend, supportability_name
|
21
21
|
else
|
22
|
-
chain_instrument
|
22
|
+
chain_instrument NewRelic::Agent::Instrumentation::GRPC::Server::Chain, supportability_name
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -23,14 +23,14 @@ DependencyDetection.defer do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
executes do
|
26
|
-
|
26
|
+
NewRelic::Agent.logger.info('Installing HTTPClient instrumentation')
|
27
27
|
require 'new_relic/agent/distributed_tracing/cross_app_tracing'
|
28
28
|
require 'new_relic/agent/http_clients/httpclient_wrappers'
|
29
29
|
end
|
30
30
|
|
31
31
|
executes do
|
32
32
|
if use_prepend?
|
33
|
-
prepend_instrument
|
33
|
+
prepend_instrument HTTPClient, NewRelic::Agent::Instrumentation::HTTPClient::Prepend
|
34
34
|
else
|
35
35
|
chain_instrument NewRelic::Agent::Instrumentation::HTTPClient::Chain
|
36
36
|
end
|
@@ -14,16 +14,16 @@ DependencyDetection.defer do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
executes do
|
17
|
-
|
17
|
+
NewRelic::Agent.logger.info("Installing http.rb Wrappers")
|
18
18
|
require 'new_relic/agent/distributed_tracing/cross_app_tracing'
|
19
19
|
require 'new_relic/agent/http_clients/http_rb_wrappers'
|
20
20
|
end
|
21
21
|
|
22
22
|
executes do
|
23
23
|
if use_prepend?
|
24
|
-
prepend_instrument HTTP::Client,
|
24
|
+
prepend_instrument HTTP::Client, NewRelic::Agent::Instrumentation::HTTPrb::Prepend
|
25
25
|
else
|
26
|
-
chain_instrument
|
26
|
+
chain_instrument NewRelic::Agent::Instrumentation::HTTPrb::Chain
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -10,15 +10,15 @@ DependencyDetection.defer do
|
|
10
10
|
named :logger
|
11
11
|
|
12
12
|
depends_on do
|
13
|
-
defined?(
|
13
|
+
defined?(Logger) &&
|
14
14
|
NewRelic::Agent.config[:'application_logging.enabled']
|
15
15
|
end
|
16
16
|
|
17
17
|
executes do
|
18
|
-
|
18
|
+
NewRelic::Agent.logger.info("Installing Logger instrumentation")
|
19
19
|
|
20
20
|
if use_prepend?
|
21
|
-
prepend_instrument
|
21
|
+
prepend_instrument Logger, NewRelic::Agent::Instrumentation::Logger::Prepend
|
22
22
|
else
|
23
23
|
chain_instrument NewRelic::Agent::Instrumentation::Logger
|
24
24
|
end
|
@@ -23,7 +23,7 @@ module NewRelic::Agent::Instrumentation
|
|
23
23
|
if NewRelic::Agent.config[:capture_memcache_keys]
|
24
24
|
segment.notice_nosql_statement("#{operation} #{args.first.inspect}")
|
25
25
|
end
|
26
|
-
|
26
|
+
::NewRelic::Agent::Transaction::Segment.finish(segment)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -50,7 +50,7 @@ module NewRelic::Agent::Instrumentation
|
|
50
50
|
begin
|
51
51
|
NewRelic::Agent::Tracer.capture_segment_error(segment) { yield }
|
52
52
|
ensure
|
53
|
-
|
53
|
+
::NewRelic::Agent::Transaction::Segment.finish(segment)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -67,7 +67,7 @@ module NewRelic::Agent::Instrumentation
|
|
67
67
|
if ::NewRelic::Agent.config[:capture_memcache_keys]
|
68
68
|
segment.notice_nosql_statement("#{MULTIGET_METRIC_NAME} #{keys.inspect}")
|
69
69
|
end
|
70
|
-
|
70
|
+
::NewRelic::Agent::Transaction::Segment.finish(segment)
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -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
|