newrelic_rpm 3.14.0.305 → 3.14.1.311
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +55 -3
- data/lib/new_relic/agent/agent.rb +1 -0
- data/lib/new_relic/agent/configuration/default_source.rb +25 -2
- data/lib/new_relic/agent/error_collector.rb +2 -1
- data/lib/new_relic/agent/error_event_aggregator.rb +10 -7
- data/lib/new_relic/agent/hostname.rb +1 -1
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +82 -4
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +5 -4
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +24 -4
- data/lib/new_relic/agent/instrumentation/rack.rb +80 -29
- data/lib/new_relic/agent/pipe_service.rb +4 -0
- data/lib/new_relic/agent/transaction.rb +5 -0
- data/lib/new_relic/version.rb +1 -1
- data/test/multiverse/suites/agent_only/agent_attributes_test.rb +15 -0
- data/test/multiverse/suites/agent_only/error_events_test.rb +15 -1
- data/test/multiverse/suites/delayed_job/Envfile +10 -0
- data/test/multiverse/suites/delayed_job/before_suite.rb +10 -0
- data/test/multiverse/suites/delayed_job/delayed_job_instrumentation_test.rb +106 -0
- data/test/multiverse/suites/mongo/mongo2_instrumentation_test.rb +45 -0
- data/test/multiverse/suites/rack/Envfile +10 -0
- data/test/multiverse/suites/rack/before_suite.rb +12 -0
- data/test/multiverse/suites/rack/http_response_code_test.rb +2 -2
- data/test/multiverse/suites/rack/puma_rack_builder_test.rb +81 -0
- data/test/multiverse/suites/rack/rack_auto_instrumentation_test.rb +12 -3
- data/test/multiverse/suites/rack/rack_cascade_test.rb +31 -31
- data/test/multiverse/suites/rack/rack_env_mutation_test.rb +2 -2
- data/test/multiverse/suites/rack/rack_unsupported_version_test.rb +1 -1
- data/test/multiverse/suites/rack/response_content_type_test.rb +2 -2
- data/test/multiverse/suites/rack/url_map_test.rb +45 -11
- data/test/new_relic/agent/agent/connect_test.rb +1 -1
- data/test/new_relic/agent/agent_logger_test.rb +2 -0
- data/test/new_relic/agent/agent_test.rb +1 -0
- data/test/new_relic/agent/audit_logger_test.rb +4 -0
- data/test/new_relic/agent/error_collector_test.rb +34 -10
- data/test/new_relic/agent/error_event_aggregator_test.rb +12 -1
- data/test/new_relic/agent/hostname_test.rb +5 -0
- data/test/new_relic/agent/instrumentation/delayed_job_instrumentation_test.rb +23 -0
- data/test/new_relic/agent/pipe_service_test.rb +7 -0
- data/test/new_relic/marshalling_test_cases.rb +42 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 912e19ec1b6cf6be2d2350e8cb666ac20bb05eb8
|
4
|
+
data.tar.gz: 4e355681d0aa06679be8c4d6ff1dba58be0790c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 790329aea53676882b79e216d726467a683ada7baad5e41a7a6e5a5dabcaba04e74007747a10f38f8be5020716708af0c7b0202c5c6cd41b4f834c269717c7ed
|
7
|
+
data.tar.gz: 1ce543e65d1868ce3f8f349f5d906bf37474ae4a94d3f265a324903a460af8975b11492acae472b2f7b66efe5513beb896efc74610a4525e448ce3786c4d3631
|
data/CHANGELOG
CHANGED
@@ -1,5 +1,45 @@
|
|
1
1
|
# New Relic Ruby Agent Release Notes #
|
2
2
|
|
3
|
+
## v3.14.1 ##
|
4
|
+
|
5
|
+
* Add support for setting a display name on hosts
|
6
|
+
|
7
|
+
You can now configure a display name for your hosts using process_host.display_name,
|
8
|
+
to more easily distinguish dynamically assigned hosts. For more info, see
|
9
|
+
https://docs.newrelic.com/docs/apm/new-relic-apm/maintenance/add-rename-remove-hosts#display_name
|
10
|
+
|
11
|
+
* Fixes automatic middleware instrumentation for Puma 2.12.x
|
12
|
+
|
13
|
+
Starting with version 2.12.x the Puma project inlines versions of Rack::Builder
|
14
|
+
and Rack::URLMap under the Puma namespace. This had the unfortunate side effect of
|
15
|
+
breaking automatic Rack middleware instrumentation. We now instrument Puma::Rack::Builder
|
16
|
+
and Puma::Rack::URLMap and once again have automatic Rack middleware instrumentation for
|
17
|
+
applications running on Puma.
|
18
|
+
|
19
|
+
* Do not use a DelayedJob's display_name for naming the transaction
|
20
|
+
|
21
|
+
A DelayedJob's name may be superceded by a display_name, which can
|
22
|
+
lead to a metric grouping issue if the display_name contains unique
|
23
|
+
identifiers. We no longer use job name methods that may lead to an
|
24
|
+
arbitrary display_name. Instead, we use the appropriate class and/or
|
25
|
+
method names, depending what makes sense for the job and how it's called.
|
26
|
+
|
27
|
+
* Improvements to Mongo 2.1.x instrumentation
|
28
|
+
|
29
|
+
Fixes issue where getMore operations in batched queries could create metric grouping issues.
|
30
|
+
Previously when multiple Mongo queries executed in the same scope only a single query was recorded
|
31
|
+
as part of a transaction trace. Now transaction trace nodes will be created for every query
|
32
|
+
executed during a transaction.
|
33
|
+
|
34
|
+
* Bugfix for NewRelic::Agent.notice_error
|
35
|
+
|
36
|
+
Fixes issue introduced in v3.14.0 where calling NewRelic::Agent.notice_error outside of an active
|
37
|
+
transaction results in a NoMethodError.
|
38
|
+
|
39
|
+
* Bugfix for Resque TransactionError events
|
40
|
+
|
41
|
+
Fixes error preventing Transaction Error events generated in Resque tasks from being sent to New Relic.
|
42
|
+
|
3
43
|
## v3.14.0 ##
|
4
44
|
|
5
45
|
* pruby marshaller removed
|
@@ -16,9 +56,21 @@
|
|
16
56
|
|
17
57
|
* Additional attributes collected
|
18
58
|
|
19
|
-
The agent now collects the following information in web transactions
|
20
|
-
|
21
|
-
|
59
|
+
The agent now collects the following information in web transactions:
|
60
|
+
Accept, Host, User-Agent, Content-Length HTTP request headers, HTTP request
|
61
|
+
method, and Content-Type HTTP response header.
|
62
|
+
|
63
|
+
* TransactionErrors reported for Advanced Analytics for APM Errors
|
64
|
+
|
65
|
+
With this release, the agent reports TransactionError events. These new events
|
66
|
+
power the beta feature Advanced Analytics for APM Errors. The error events are
|
67
|
+
also available today through New Relic Insights.
|
68
|
+
|
69
|
+
Advanced Analytics for APM Errors lets you see all of your errors, with
|
70
|
+
granular detail. Filter and group by any attribute to analyze them. Take
|
71
|
+
action to resolve issues through collaboration.
|
72
|
+
|
73
|
+
For more information, see https://docs.newrelic.com/docs/apm/applications-menu/events/view-apm-errors-error-traces
|
22
74
|
|
23
75
|
## v3.13.2 ##
|
24
76
|
|
@@ -1246,7 +1246,7 @@ module NewRelic
|
|
1246
1246
|
:type => Boolean,
|
1247
1247
|
:dynamic_name => true,
|
1248
1248
|
:allowed_from_server => false,
|
1249
|
-
:description => '
|
1249
|
+
:description => 'If true, prevents the agent from hooking into Rack::Builder\'s <code>to_app</code> method to find gems to instrument during application startup.'
|
1250
1250
|
},
|
1251
1251
|
:disable_rack_urlmap => {
|
1252
1252
|
:default => false,
|
@@ -1254,7 +1254,23 @@ module NewRelic
|
|
1254
1254
|
:type => Boolean,
|
1255
1255
|
:dynamic_name => true,
|
1256
1256
|
:allowed_from_server => false,
|
1257
|
-
:description => '
|
1257
|
+
:description => 'If true, prevents the agent from hooking into Rack::URLMap to install middleware tracing.'
|
1258
|
+
},
|
1259
|
+
:disable_puma_rack => {
|
1260
|
+
:default => value_of(:disable_rack),
|
1261
|
+
:public => true,
|
1262
|
+
:type => Boolean,
|
1263
|
+
:dynamic_name => true,
|
1264
|
+
:allowed_from_server => false,
|
1265
|
+
:description => 'If true, prevents the agent from hooking into Puma::Rack::Builder\'s <code>to_app</code> method to find gems to instrument during application startup.'
|
1266
|
+
},
|
1267
|
+
:disable_puma_rack_urlmap => {
|
1268
|
+
:default => value_of(:disable_rack_urlmap),
|
1269
|
+
:public => true,
|
1270
|
+
:type => Boolean,
|
1271
|
+
:dynamic_name => true,
|
1272
|
+
:allowed_from_server => false,
|
1273
|
+
:description => 'If true, prevents the agent from hooking into Puma::Rack::URLMap to install middleware tracing.'
|
1258
1274
|
},
|
1259
1275
|
:disable_rubyprof => {
|
1260
1276
|
:default => false,
|
@@ -1301,6 +1317,13 @@ module NewRelic
|
|
1301
1317
|
:transform => DefaultSource.method(:convert_to_list),
|
1302
1318
|
:description => 'List of prefixes for heroku dyno names (such as "scheduler") to report as hostname without trailing dot and process ID.'
|
1303
1319
|
},
|
1320
|
+
:'process_host.display_name' => {
|
1321
|
+
:default => Proc.new{ NewRelic::Agent::Hostname.get },
|
1322
|
+
:public => true,
|
1323
|
+
:type => String,
|
1324
|
+
:allowed_from_server => false,
|
1325
|
+
:description => 'Custom host name used for display purposes only.'
|
1326
|
+
},
|
1304
1327
|
:labels => {
|
1305
1328
|
:default => '',
|
1306
1329
|
:public => true,
|
@@ -199,7 +199,8 @@ module NewRelic
|
|
199
199
|
increment_error_count!(state, exception, options)
|
200
200
|
noticed_error = create_noticed_error(exception, options)
|
201
201
|
error_trace_aggregator.add_to_error_queue(noticed_error)
|
202
|
-
|
202
|
+
payload = state.current_transaction ? state.current_transaction.payload : nil
|
203
|
+
error_event_aggregator.append_event(noticed_error, payload)
|
203
204
|
exception
|
204
205
|
rescue => e
|
205
206
|
::NewRelic::Agent.logger.warn("Failure when capturing error '#{exception}':", e)
|
@@ -21,7 +21,7 @@ module NewRelic
|
|
21
21
|
Agent.config[:'error_collector.capture_events']
|
22
22
|
end
|
23
23
|
|
24
|
-
def append_event noticed_error, transaction_payload
|
24
|
+
def append_event noticed_error, transaction_payload = nil
|
25
25
|
return unless enabled?
|
26
26
|
|
27
27
|
@lock.synchronize do
|
@@ -96,15 +96,18 @@ module NewRelic
|
|
96
96
|
:type => EVENT_TYPE,
|
97
97
|
:'error.class' => noticed_error.exception_class_name,
|
98
98
|
:'error.message' => noticed_error.message,
|
99
|
-
:timestamp => noticed_error.timestamp.to_f
|
100
|
-
:transactionName => transaction_payload[:name],
|
101
|
-
:duration => transaction_payload[:duration]
|
99
|
+
:timestamp => noticed_error.timestamp.to_f
|
102
100
|
}
|
101
|
+
|
103
102
|
attrs[:port] = noticed_error.request_port if noticed_error.request_port
|
104
103
|
|
105
|
-
|
106
|
-
|
107
|
-
|
104
|
+
if transaction_payload
|
105
|
+
attrs[:transactionName] = transaction_payload[:name]
|
106
|
+
attrs[:duration] = transaction_payload[:duration]
|
107
|
+
append_synthetics transaction_payload, attrs
|
108
|
+
append_cat transaction_payload, attrs
|
109
|
+
PayloadMetricMapping.append_mapped_metrics transaction_payload[:metrics], attrs
|
110
|
+
end
|
108
111
|
|
109
112
|
attrs
|
110
113
|
end
|
@@ -7,7 +7,7 @@ module NewRelic
|
|
7
7
|
module Hostname
|
8
8
|
def self.get
|
9
9
|
dyno_name = ENV['DYNO']
|
10
|
-
if dyno_name && ::NewRelic::Agent.config[:'heroku.use_dyno_names']
|
10
|
+
@hostname ||= if dyno_name && ::NewRelic::Agent.config[:'heroku.use_dyno_names']
|
11
11
|
matching_prefix = heroku_dyno_name_prefix(dyno_name)
|
12
12
|
dyno_name = "#{matching_prefix}.*" if matching_prefix
|
13
13
|
dyno_name
|
@@ -4,6 +4,74 @@
|
|
4
4
|
|
5
5
|
require 'new_relic/agent/instrumentation/controller_instrumentation'
|
6
6
|
|
7
|
+
module NewRelic
|
8
|
+
module Agent
|
9
|
+
module Instrumentation
|
10
|
+
module DelayedJob
|
11
|
+
module Naming
|
12
|
+
module_function
|
13
|
+
|
14
|
+
CLASS_METHOD_DELIMITER = '.'.freeze
|
15
|
+
INSTANCE_METHOD_DELIMITER = '#'.freeze
|
16
|
+
LEGACY_DJ_FORMAT_DELIMITER = ';'.freeze
|
17
|
+
LEGACY_DJ_FORMAT_PREFIX = 'LOAD'.freeze
|
18
|
+
LEGACY_DJ_DEFAULT_CLASS = '(unknown class)'.freeze
|
19
|
+
|
20
|
+
def name_from_payload(payload_object)
|
21
|
+
if payload_object.is_a? ::Delayed::PerformableMethod
|
22
|
+
# payload_object contains a reference to an object
|
23
|
+
# that received an asynchronous method call via .delay or .handle_asynchronously
|
24
|
+
"#{object_name(payload_object)}#{delimiter(payload_object)}#{method_name(payload_object)}"
|
25
|
+
else
|
26
|
+
# payload_object is a user-defined job enqueued via Delayed::Job.enqueue
|
27
|
+
payload_object.class.name
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Older versions of Delayed Job use a semicolon-delimited string to stash the class name.
|
32
|
+
# The format of this string is "LOAD;<class name>;<ORM ID>"
|
33
|
+
def legacy_performable_method?(payload_object)
|
34
|
+
payload_object.object.is_a?(String) && payload_object.object.start_with?(LEGACY_DJ_FORMAT_PREFIX)
|
35
|
+
end
|
36
|
+
|
37
|
+
# If parsing for the class name fails, return a sensible default
|
38
|
+
def class_name_from_legacy_performable_method(payload_object)
|
39
|
+
payload_object.object.split(LEGACY_DJ_FORMAT_DELIMITER)[1] || LEGACY_DJ_DEFAULT_CLASS
|
40
|
+
end
|
41
|
+
|
42
|
+
def object_name(payload_object)
|
43
|
+
if payload_object.object.is_a?(Class)
|
44
|
+
payload_object.object.to_s
|
45
|
+
elsif legacy_performable_method?(payload_object)
|
46
|
+
class_name_from_legacy_performable_method(payload_object)
|
47
|
+
else
|
48
|
+
payload_object.object.class.name
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def delimiter(payload_object)
|
53
|
+
if payload_object.object.is_a?(Class)
|
54
|
+
CLASS_METHOD_DELIMITER
|
55
|
+
else
|
56
|
+
INSTANCE_METHOD_DELIMITER
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# DelayedJob's interface for the async method's name varies across the gem's versions
|
61
|
+
def method_name(payload_object)
|
62
|
+
if payload_object.respond_to?(:method_name)
|
63
|
+
payload_object.method_name
|
64
|
+
else
|
65
|
+
# early versions of Delayed Job override Object#method with the method name
|
66
|
+
payload_object.method
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
7
75
|
DependencyDetection.defer do
|
8
76
|
@name = :delayed_job
|
9
77
|
|
@@ -41,13 +109,23 @@ DependencyDetection.defer do
|
|
41
109
|
alias initialize_without_new_relic initialize
|
42
110
|
alias initialize initialize_with_new_relic
|
43
111
|
|
112
|
+
NR_TRANSACTION_CATEGORY = 'OtherTransaction/DelayedJob'.freeze
|
113
|
+
|
44
114
|
def install_newrelic_job_tracer
|
45
115
|
Delayed::Job.class_eval do
|
46
116
|
include NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
117
|
+
|
118
|
+
alias_method :invoke_job_without_new_relic, :invoke_job
|
119
|
+
|
120
|
+
def invoke_job(*args, &block)
|
121
|
+
options = {
|
122
|
+
:category => NR_TRANSACTION_CATEGORY,
|
123
|
+
:path => ::NewRelic::Agent::Instrumentation::DelayedJob::Naming.name_from_payload(payload_object)
|
124
|
+
}
|
125
|
+
|
126
|
+
perform_action_with_newrelic_trace(options) do
|
127
|
+
invoke_job_without_new_relic(*args, &block)
|
128
|
+
end
|
51
129
|
end
|
52
130
|
end
|
53
131
|
end
|
@@ -39,10 +39,11 @@ module NewRelic
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def merge_first_middleware_options(opts, env)
|
42
|
-
opts.
|
43
|
-
|
44
|
-
|
45
|
-
)
|
42
|
+
opts[:apdex_start_time] = QueueTime.parse_frontend_timestamp(env)
|
43
|
+
# this case is for the rare occasion that an app is using Puma::Rack
|
44
|
+
# without having ::Rack as a dependency
|
45
|
+
opts[:request] = ::Rack::Request.new(env) if defined? ::Rack
|
46
|
+
opts
|
46
47
|
end
|
47
48
|
|
48
49
|
def note_transaction_started(env)
|
@@ -9,6 +9,8 @@ module NewRelic
|
|
9
9
|
class MongodbCommandSubscriber
|
10
10
|
|
11
11
|
MONGODB = 'MongoDB'.freeze
|
12
|
+
GET_MORE = "getMore".freeze
|
13
|
+
COLLECTION = "collection".freeze
|
12
14
|
|
13
15
|
def started(event)
|
14
16
|
begin
|
@@ -31,9 +33,7 @@ module NewRelic
|
|
31
33
|
base, other_metrics, event.duration
|
32
34
|
)
|
33
35
|
|
34
|
-
|
35
|
-
generate_statement(started_event), event.duration
|
36
|
-
)
|
36
|
+
notice_nosql_statement(state, started_event, base, event.duration)
|
37
37
|
rescue Exception => e
|
38
38
|
log_notification_error('completed', e)
|
39
39
|
end
|
@@ -45,7 +45,11 @@ module NewRelic
|
|
45
45
|
private
|
46
46
|
|
47
47
|
def collection(event)
|
48
|
-
event.
|
48
|
+
if event.command_name == GET_MORE
|
49
|
+
event.command[COLLECTION]
|
50
|
+
else
|
51
|
+
event.command.values.first
|
52
|
+
end
|
49
53
|
end
|
50
54
|
|
51
55
|
def metrics(event)
|
@@ -68,6 +72,22 @@ module NewRelic
|
|
68
72
|
event.command
|
69
73
|
)
|
70
74
|
end
|
75
|
+
|
76
|
+
def notice_nosql_statement(state, event, metric, duration)
|
77
|
+
end_time = Time.now.to_f
|
78
|
+
|
79
|
+
stack = state.traced_method_stack
|
80
|
+
|
81
|
+
# enter transaction trace node
|
82
|
+
frame = stack.push_frame(state, :mongo_db, end_time - duration)
|
83
|
+
|
84
|
+
NewRelic::Agent.instance.transaction_sampler.notice_nosql_statement(
|
85
|
+
generate_statement(event), duration
|
86
|
+
)
|
87
|
+
|
88
|
+
# exit transaction trace node
|
89
|
+
stack.pop_frame(state, frame, metric, end_time)
|
90
|
+
end
|
71
91
|
end
|
72
92
|
end
|
73
93
|
end
|
@@ -54,14 +54,28 @@ module NewRelic
|
|
54
54
|
end
|
55
55
|
|
56
56
|
module RackHelpers
|
57
|
+
def self.version_supported?
|
58
|
+
rack_version_supported? || puma_rack_version_supported?
|
59
|
+
end
|
60
|
+
|
57
61
|
def self.rack_version_supported?
|
62
|
+
return false unless defined? ::Rack
|
63
|
+
|
58
64
|
version = ::NewRelic::VersionNumber.new(::Rack.release)
|
59
65
|
min_version = ::NewRelic::VersionNumber.new('1.1.0')
|
60
66
|
version >= min_version
|
61
67
|
end
|
62
68
|
|
69
|
+
def self.puma_rack_version_supported?
|
70
|
+
return false unless defined? ::Puma::Const::PUMA_VERSION
|
71
|
+
|
72
|
+
version = ::NewRelic::VersionNumber.new(::Puma::Const::PUMA_VERSION)
|
73
|
+
min_version = ::NewRelic::VersionNumber.new('2.12.0')
|
74
|
+
version >= min_version
|
75
|
+
end
|
76
|
+
|
63
77
|
def self.middleware_instrumentation_enabled?
|
64
|
-
|
78
|
+
version_supported? && !::NewRelic::Agent.config[:disable_middleware_instrumentation]
|
65
79
|
end
|
66
80
|
|
67
81
|
def self.check_for_late_instrumentation(app)
|
@@ -74,6 +88,42 @@ module NewRelic
|
|
74
88
|
end
|
75
89
|
end
|
76
90
|
end
|
91
|
+
|
92
|
+
def self.instrument_builder builder_class
|
93
|
+
::NewRelic::Agent.logger.info "Installing deferred #{builder_class} instrumentation"
|
94
|
+
|
95
|
+
builder_class.class_eval do
|
96
|
+
class << self
|
97
|
+
attr_accessor :_nr_deferred_detection_ran
|
98
|
+
end
|
99
|
+
self._nr_deferred_detection_ran = false
|
100
|
+
|
101
|
+
include ::NewRelic::Agent::Instrumentation::RackBuilder
|
102
|
+
|
103
|
+
alias_method :to_app_without_newrelic, :to_app
|
104
|
+
alias_method :to_app, :to_app_with_newrelic_deferred_dependency_detection
|
105
|
+
|
106
|
+
if ::NewRelic::Agent::Instrumentation::RackHelpers.middleware_instrumentation_enabled?
|
107
|
+
::NewRelic::Agent.logger.info "Installing #{builder_class} middleware instrumentation"
|
108
|
+
alias_method :run_without_newrelic, :run
|
109
|
+
alias_method :run, :run_with_newrelic
|
110
|
+
|
111
|
+
alias_method :use_without_newrelic, :use
|
112
|
+
alias_method :use, :use_with_newrelic
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def self.instrument_url_map url_map_class
|
117
|
+
url_map_class.class_eval do
|
118
|
+
alias_method :initialize_without_newrelic, :initialize
|
119
|
+
|
120
|
+
def initialize(map = {})
|
121
|
+
traced_map = ::NewRelic::Agent::Instrumentation::RackURLMap.generate_traced_map(map)
|
122
|
+
initialize_without_newrelic(traced_map)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
77
127
|
end
|
78
128
|
|
79
129
|
module RackBuilder
|
@@ -102,10 +152,10 @@ module NewRelic
|
|
102
152
|
# DependencyDetection.detect!, since all libraries are likely loaded at
|
103
153
|
# this point.
|
104
154
|
def to_app_with_newrelic_deferred_dependency_detection
|
105
|
-
unless
|
155
|
+
unless self.class._nr_deferred_detection_ran
|
106
156
|
NewRelic::Agent.logger.info "Doing deferred dependency-detection before Rack startup"
|
107
157
|
DependencyDetection.detect!
|
108
|
-
|
158
|
+
self.class._nr_deferred_detection_ran = true
|
109
159
|
end
|
110
160
|
|
111
161
|
result = to_app_without_newrelic
|
@@ -135,29 +185,20 @@ DependencyDetection.defer do
|
|
135
185
|
end
|
136
186
|
|
137
187
|
executes do
|
138
|
-
::NewRelic::Agent.
|
139
|
-
|
140
|
-
|
141
|
-
class << self
|
142
|
-
attr_accessor :_nr_deferred_detection_ran
|
143
|
-
end
|
144
|
-
self._nr_deferred_detection_ran = false
|
145
|
-
|
146
|
-
include ::NewRelic::Agent::Instrumentation::RackBuilder
|
188
|
+
::NewRelic::Agent::Instrumentation::RackHelpers.instrument_builder ::Rack::Builder
|
189
|
+
end
|
190
|
+
end
|
147
191
|
|
148
|
-
alias_method :to_app_without_newrelic, :to_app
|
149
|
-
alias_method :to_app, :to_app_with_newrelic_deferred_dependency_detection
|
150
192
|
|
151
|
-
|
152
|
-
|
153
|
-
alias_method :run_without_newrelic, :run
|
154
|
-
alias_method :run, :run_with_newrelic
|
193
|
+
DependencyDetection.defer do
|
194
|
+
named :puma_rack
|
155
195
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
end
|
196
|
+
depends_on do
|
197
|
+
defined?(::Puma::Rack::Builder) && !NewRelic::Agent.config[:disable_puma_rack]
|
198
|
+
end
|
160
199
|
|
200
|
+
executes do
|
201
|
+
::NewRelic::Agent::Instrumentation::RackHelpers.instrument_builder ::Puma::Rack::Builder
|
161
202
|
end
|
162
203
|
end
|
163
204
|
|
@@ -174,13 +215,23 @@ DependencyDetection.defer do
|
|
174
215
|
end
|
175
216
|
|
176
217
|
executes do
|
177
|
-
|
178
|
-
|
218
|
+
::NewRelic::Agent::Instrumentation::RackHelpers.instrument_url_map ::Rack::URLMap
|
219
|
+
end
|
220
|
+
end
|
179
221
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
222
|
+
DependencyDetection.defer do
|
223
|
+
named :puma_rack_urlmap
|
224
|
+
|
225
|
+
depends_on do
|
226
|
+
defined? Puma::Rack::URLMap
|
227
|
+
end
|
228
|
+
|
229
|
+
depends_on do
|
230
|
+
::NewRelic::Agent::Instrumentation::RackHelpers.middleware_instrumentation_enabled? &&
|
231
|
+
!::NewRelic::Agent.config[:disable_puma_rack]
|
232
|
+
end
|
233
|
+
|
234
|
+
executes do
|
235
|
+
::NewRelic::Agent::Instrumentation::RackHelpers.instrument_url_map ::Puma::Rack::URLMap
|
185
236
|
end
|
186
237
|
end
|