newrelic_rpm 6.13.1 → 6.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 +1 -0
- data/CHANGELOG.md +55 -0
- data/lib/new_relic/agent/audit_logger.rb +10 -0
- data/lib/new_relic/agent/configuration/default_source.rb +15 -1
- data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +2 -2
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +4 -5
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +16 -37
- data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +3 -11
- data/lib/new_relic/agent/instrumentation/net.rb +66 -59
- data/lib/new_relic/agent/instrumentation/net_prepend.rb +72 -0
- data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rack.rb +8 -18
- data/lib/new_relic/agent/instrumentation/redis.rb +1 -1
- data/lib/new_relic/agent/method_tracer.rb +6 -16
- data/lib/new_relic/agent/new_relic_service.rb +1 -0
- data/lib/new_relic/agent/samplers/memory_sampler.rb +1 -1
- data/lib/new_relic/agent/stats_engine/gc_profiler.rb +1 -1
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +12 -6
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +1 -0
- data/lib/new_relic/constants.rb +4 -0
- data/lib/new_relic/environment_report.rb +7 -1
- data/lib/new_relic/supportability_helper.rb +1 -0
- data/lib/new_relic/version.rb +2 -2
- data/newrelic_rpm.gemspec +1 -1
- metadata +3 -27
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -31
- data/.github/ISSUE_TEMPLATE/config.yml +0 -5
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -24
- data/.github/actions/annotate/README.md +0 -79
- data/.github/actions/annotate/action.yml +0 -6
- data/.github/actions/annotate/dist/index.js +0 -433
- data/.github/actions/annotate/index.js +0 -25
- data/.github/actions/annotate/package-lock.json +0 -172
- data/.github/actions/annotate/package.json +0 -30
- data/.github/actions/annotate/pre-commit +0 -5
- data/.github/actions/build-ruby/README.md +0 -79
- data/.github/actions/build-ruby/action.yml +0 -15
- data/.github/actions/build-ruby/dist/index.js +0 -52683
- data/.github/actions/build-ruby/index.js +0 -514
- data/.github/actions/build-ruby/package-lock.json +0 -581
- data/.github/actions/build-ruby/package.json +0 -32
- data/.github/actions/build-ruby/pre-commit +0 -5
- data/.github/pull_request_template.md +0 -16
- data/.github/workflows/ci.yml +0 -212
- data/.github/workflows/pr_review_checklist.yml +0 -22
- data/.github/workflows/release.yml +0 -78
- data/.github/workflows/scripts/rubygems-authenticate.py +0 -13
- data/.github/workflows/scripts/rubygems-publish.rb +0 -32
- data/.github/workflows/snyk.yml +0 -27
- data/.github/workflows/stale.yml +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39bec77198864a8dbc979a6a3591345b367f8b6294a239ec09b489935cabc518
|
4
|
+
data.tar.gz: 79a25011a511ba59df1967493bfc832245c9221f130cb607dd1af798173f7317
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18e3a2321e17851bef4b4baa84358a81ff5f0b4870f9bbc35bd5e2d5daea4a02366649e3cbcc1735cfe0aaeb337caecb87c2e189c0703dda2325b55945108421
|
7
|
+
data.tar.gz: 6de78ac450e087b4a7b10ffbf181be79e9451d8ac9c7bfd0d5af5bad6ef98a004aff6fe987d4231fe02874d253a8d45c847419bfbe21c2103dcb86e97070f1b5
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,60 @@
|
|
1
1
|
# New Relic Ruby Agent Release Notes #
|
2
2
|
|
3
|
+
## v6.14.0
|
4
|
+
|
5
|
+
* **Bugfix: Method tracers no longer cloning arguments**
|
6
|
+
|
7
|
+
Previously, when calling add_method_tracer with certain combination of arguments, it would lead to the wrapped method's arguments
|
8
|
+
being cloned rather than passed to the original method for manipulation as intended. This has been fixed.
|
9
|
+
|
10
|
+
* **Bugfix: Delayed Job instrumentation fixed for Ruby 2.7+**
|
11
|
+
|
12
|
+
Previously, the agent was erroneousy separating positional and keyword arguments on the instrumented method calls into
|
13
|
+
Delayed Job's library. The led to Delayed job not auto-instrumenting correctly and has been fixed.
|
14
|
+
|
15
|
+
* **Bugfix: Ruby 2.7+ methods sometimes erroneously attributed compiler warnings to the Agent's `add_method_tracer`**
|
16
|
+
|
17
|
+
The specific edge cases presented are now fixed by this release of the agent. There are still some known corner-cases
|
18
|
+
that will be resolved with upcoming changes in next major release of the Agent. If you encounter a problem with adding
|
19
|
+
method tracers and compiler warnings raised, please continue to submit small repoducible examples.
|
20
|
+
|
21
|
+
* **Bugfix: Ruby 2.7+ fix for keyword arguments on Rack apps is unnecessary and removed**
|
22
|
+
|
23
|
+
A common fix for positional and keyword arguments for method parameters was implemented where it was not needed and
|
24
|
+
led to RackApps getting extra arguments converted to keyword arguments rather than Hash when it expected one. This
|
25
|
+
Ruby 2.7+ change was reverted so that Rack apps behave correctly for Ruby >= 2.7.
|
26
|
+
|
27
|
+
* **Feature: captures incoming and outgoing request headers for distributed tracing**
|
28
|
+
|
29
|
+
HTTP request headers will be logged when log level is at least debug level. Similarly, request headers
|
30
|
+
for exchanges with New Relic servers are now audit logged when audit logging is enabled.
|
31
|
+
|
32
|
+
* **Bugfix: `newrelic.yml.erb` added to the configuration search path**
|
33
|
+
|
34
|
+
Previously, when a user specifies a `newrelic.yml.erb` and no `newrelic.yml` file, the agent fails to find
|
35
|
+
the `.erb` file because it was not in the list of files searched at startup. The Ruby agent has long supported this as a
|
36
|
+
means of configuring the agent programatically. The `newrelic.yml.erb` filename is restored to the search
|
37
|
+
path and will be utilized if present. NOTE: `newrelic.yml` still takes precedence over `newrelic.yml.erb` If found,
|
38
|
+
the `.yml` file is used instead of the `.erb` file. Search directories and order of traversal remain unchanged.
|
39
|
+
|
40
|
+
* **Bugfix: dependency detection of Redis now works without raising an exception**
|
41
|
+
|
42
|
+
Previously, when detecting if Redis was available to instrument, the dependency detection would fail with an Exception raised
|
43
|
+
(with side effect of not attempting to instrument Redis). This is now fixed with a better dependency check that resolves falsly without raising an `Exception`.
|
44
|
+
|
45
|
+
* **Bugfix: Gracefully handles NilClass as a Middleware Class when instrumenting**
|
46
|
+
|
47
|
+
Previously, if a NilClass is passed as the Middleware Class to instrument when processing the middleware stack,
|
48
|
+
the agent would fail to fully load and instrument the middleware stack. This fix gracefully skips over nil classes.
|
49
|
+
|
50
|
+
* **Memory Sampler updated to recognize macOS Big Sur**
|
51
|
+
|
52
|
+
Previously, the agent was unable to recognize the platform macOS Big Sur in the memory sampler, resulting in an error being logged. The memory sampler is now able to recognize Big Sur.
|
53
|
+
|
54
|
+
* **Prepend implementation of Net::HTTP instrumentation available**
|
55
|
+
|
56
|
+
There is now a config option (`prepend_net_instrumentation`) that will enable the agent to use prepend while instrumenting Net::HTTP. This option is set to true by default.
|
57
|
+
|
3
58
|
## v6.13.1
|
4
59
|
|
5
60
|
* **Bugfix: obfuscating URLs to external services no longer modifying original URI**
|
@@ -26,6 +26,16 @@ module NewRelic
|
|
26
26
|
!@log.nil?
|
27
27
|
end
|
28
28
|
|
29
|
+
def log_request_headers(uri, headers)
|
30
|
+
return unless enabled? && allowed_endpoint?(uri)
|
31
|
+
@log.info("REQUEST HEADERS: #{headers}")
|
32
|
+
rescue StandardError, SystemStackError, SystemCallError => e
|
33
|
+
::NewRelic::Agent.logger.warn("Failed writing request headers to audit log", e)
|
34
|
+
rescue Exception => e
|
35
|
+
::NewRelic::Agent.logger.warn("Failed writing request headers to audit log with exception. Re-raising in case of interrupt.", e)
|
36
|
+
raise
|
37
|
+
end
|
38
|
+
|
29
39
|
def log_request(uri, data, marshaller)
|
30
40
|
return unless enabled? && allowed_endpoint?(uri)
|
31
41
|
|
@@ -48,23 +48,30 @@ module NewRelic
|
|
48
48
|
Proc.new {
|
49
49
|
paths = [
|
50
50
|
File.join("config","newrelic.yml"),
|
51
|
-
File.join("newrelic.yml")
|
51
|
+
File.join("newrelic.yml"),
|
52
|
+
File.join("config","newrelic.yml.erb"),
|
53
|
+
File.join("newrelic.yml.erb")
|
52
54
|
]
|
53
55
|
|
54
56
|
if NewRelic::Control.instance.root
|
55
57
|
paths << File.join(NewRelic::Control.instance.root, "config", "newrelic.yml")
|
56
58
|
paths << File.join(NewRelic::Control.instance.root, "newrelic.yml")
|
59
|
+
paths << File.join(NewRelic::Control.instance.root, "config", "newrelic.yml.erb")
|
60
|
+
paths << File.join(NewRelic::Control.instance.root, "newrelic.yml.erb")
|
57
61
|
end
|
58
62
|
|
59
63
|
if ENV["HOME"]
|
60
64
|
paths << File.join(ENV["HOME"], ".newrelic", "newrelic.yml")
|
61
65
|
paths << File.join(ENV["HOME"], "newrelic.yml")
|
66
|
+
paths << File.join(ENV["HOME"], ".newrelic", "newrelic.yml.erb")
|
67
|
+
paths << File.join(ENV["HOME"], "newrelic.yml.erb")
|
62
68
|
end
|
63
69
|
|
64
70
|
# If we're packaged for warbler, we can tell from GEM_HOME
|
65
71
|
if ENV["GEM_HOME"] && ENV["GEM_HOME"].end_with?(".jar!")
|
66
72
|
app_name = File.basename(ENV["GEM_HOME"], ".jar!")
|
67
73
|
paths << File.join(ENV["GEM_HOME"], app_name, "config", "newrelic.yml")
|
74
|
+
paths << File.join(ENV["GEM_HOME"], app_name, "config", "newrelic.yml.erb")
|
68
75
|
end
|
69
76
|
|
70
77
|
paths
|
@@ -823,6 +830,13 @@ module NewRelic
|
|
823
830
|
:allowed_from_server => false,
|
824
831
|
:description => 'If <code>true</code>, uses Module.prepend rather than alias_method for ActiveRecord instrumentation.'
|
825
832
|
},
|
833
|
+
:prepend_net_instrumentation => {
|
834
|
+
:default => true,
|
835
|
+
:public => true,
|
836
|
+
:type => Boolean,
|
837
|
+
:allowed_from_server => false,
|
838
|
+
:description => 'If <code>true</code>, uses Module.prepend rather than alias_method for Net::HTTP instrumentation.'
|
839
|
+
},
|
826
840
|
:disable_data_mapper => {
|
827
841
|
:default => false,
|
828
842
|
:public => true,
|
@@ -52,14 +52,14 @@ module NewRelic
|
|
52
52
|
result
|
53
53
|
end
|
54
54
|
|
55
|
-
def insert_cross_app_header
|
55
|
+
def insert_cross_app_header headers
|
56
56
|
return unless CrossAppTracing.cross_app_enabled?
|
57
57
|
@is_cross_app_caller = true
|
58
58
|
txn_guid = transaction.guid
|
59
59
|
trip_id = cat_trip_id
|
60
60
|
path_hash = cat_path_hash
|
61
61
|
|
62
|
-
insert_request_headers
|
62
|
+
insert_request_headers headers, txn_guid, trip_id, path_hash
|
63
63
|
end
|
64
64
|
|
65
65
|
def add_message_cat_headers headers
|
@@ -23,12 +23,11 @@ module NewRelic
|
|
23
23
|
log_notification_error(e, name, 'start')
|
24
24
|
end
|
25
25
|
|
26
|
-
def finish(name, id, payload)
|
26
|
+
def finish(name, id, payload)
|
27
27
|
if segment = pop_segment(id)
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
28
|
+
if exception = exception_object(payload)
|
29
|
+
segment.notice_error exception
|
30
|
+
end
|
32
31
|
segment.finish
|
33
32
|
end
|
34
33
|
rescue => e
|
@@ -90,43 +90,22 @@ DependencyDetection.defer do
|
|
90
90
|
executes do
|
91
91
|
Delayed::Worker.class_eval do
|
92
92
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
NewRelic::Agent.logger.warn("Did not find a Delayed::Job class responding to invoke_job, aborting DJ instrumentation")
|
110
|
-
end
|
111
|
-
end
|
112
|
-
else
|
113
|
-
def initialize_with_new_relic(*args, **kwargs)
|
114
|
-
initialize_without_new_relic(*args, **kwargs)
|
115
|
-
worker_name = case
|
116
|
-
when self.respond_to?(:name) then self.name
|
117
|
-
when self.class.respond_to?(:default_name) then self.class.default_name
|
118
|
-
end
|
119
|
-
NewRelic::DelayedJobInjection.worker_name = worker_name
|
120
|
-
|
121
|
-
if defined?(::Delayed::Job) && ::Delayed::Job.method_defined?(:invoke_job) &&
|
122
|
-
!(::Delayed::Job.method_defined?(:invoke_job_without_new_relic) )
|
123
|
-
|
124
|
-
::NewRelic::Agent.logger.info 'Installing DelayedJob instrumentation [part 2/2]'
|
125
|
-
install_newrelic_job_tracer
|
126
|
-
NewRelic::Control.instance.init_plugin :dispatcher => :delayed_job
|
127
|
-
else
|
128
|
-
NewRelic::Agent.logger.warn("Did not find a Delayed::Job class responding to invoke_job, aborting DJ instrumentation")
|
129
|
-
end
|
93
|
+
def initialize_with_new_relic(*args)
|
94
|
+
initialize_without_new_relic(*args)
|
95
|
+
worker_name = case
|
96
|
+
when self.respond_to?(:name) then self.name
|
97
|
+
when self.class.respond_to?(:default_name) then self.class.default_name
|
98
|
+
end
|
99
|
+
NewRelic::DelayedJobInjection.worker_name = worker_name
|
100
|
+
|
101
|
+
if defined?(::Delayed::Job) && ::Delayed::Job.method_defined?(:invoke_job) &&
|
102
|
+
!(::Delayed::Job.method_defined?(:invoke_job_without_new_relic) )
|
103
|
+
|
104
|
+
::NewRelic::Agent.logger.info 'Installing DelayedJob instrumentation [part 2/2]'
|
105
|
+
install_newrelic_job_tracer
|
106
|
+
NewRelic::Control.instance.init_plugin :dispatcher => :delayed_job
|
107
|
+
else
|
108
|
+
NewRelic::Agent.logger.warn("Did not find a Delayed::Job class responding to invoke_job, aborting DJ instrumentation")
|
130
109
|
end
|
131
110
|
end
|
132
111
|
|
@@ -27,18 +27,10 @@ module NewRelic
|
|
27
27
|
@middleware_class = middleware_class
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
MiddlewareProxy.wrap(middleware_instance)
|
34
|
-
end
|
35
|
-
else
|
36
|
-
def new(*args, **kwargs, &blk)
|
37
|
-
middleware_instance = @middleware_class.new(*args, **kwargs, &blk)
|
38
|
-
MiddlewareProxy.wrap(middleware_instance)
|
39
|
-
end
|
30
|
+
def new(*args, &blk)
|
31
|
+
middleware_instance = @middleware_class.new(*args, &blk)
|
32
|
+
MiddlewareProxy.wrap(middleware_instance)
|
40
33
|
end
|
41
|
-
|
42
34
|
end
|
43
35
|
|
44
36
|
def self.is_sinatra_app?(target)
|
@@ -16,72 +16,79 @@ DependencyDetection.defer do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
executes do
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
19
|
+
if ::NewRelic::Agent.config[:prepend_net_instrumentation]
|
20
|
+
if RUBY_VERSION < "2.1.0"
|
21
|
+
::Net::HTTP.send(:prepend, ::NewRelic::Agent::Instrumentation::NetPrepend)
|
22
|
+
else
|
23
|
+
::Net::HTTP.prepend ::NewRelic::Agent::Instrumentation::NetPrepend
|
24
|
+
end
|
25
|
+
else
|
26
|
+
NewRelic::Agent.record_metric("Supportability/Instrumentation/NetHTTP/MethodChaining", 0.0)
|
27
|
+
class Net::HTTP
|
28
|
+
if RUBY_VERSION < "2.7.0"
|
29
|
+
def request_with_newrelic_trace(request, *args, &block)
|
30
|
+
wrapped_request = NewRelic::Agent::HTTPClients::NetHTTPRequest.new(self, request)
|
31
|
+
|
32
|
+
segment = NewRelic::Agent::Tracer.start_external_request_segment(
|
33
|
+
library: wrapped_request.type,
|
34
|
+
uri: wrapped_request.uri,
|
35
|
+
procedure: wrapped_request.method
|
36
|
+
)
|
37
|
+
|
38
|
+
begin
|
39
|
+
response = nil
|
40
|
+
segment.add_request_headers wrapped_request
|
41
|
+
|
42
|
+
# RUBY-1244 Disable further tracing in request to avoid double
|
43
|
+
# counting if connection wasn't started (which calls request again).
|
44
|
+
NewRelic::Agent.disable_all_tracing do
|
45
|
+
response = NewRelic::Agent::Tracer.capture_segment_error segment do
|
46
|
+
request_without_newrelic_trace(request, *args, &block)
|
47
|
+
end
|
40
48
|
end
|
49
|
+
|
50
|
+
wrapped_response = NewRelic::Agent::HTTPClients::NetHTTPResponse.new response
|
51
|
+
segment.process_response_headers wrapped_response
|
52
|
+
response
|
53
|
+
ensure
|
54
|
+
segment.finish
|
41
55
|
end
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
segment.
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
# RUBY-1244 Disable further tracing in request to avoid double
|
65
|
-
# counting if connection wasn't started (which calls request again).
|
66
|
-
NewRelic::Agent.disable_all_tracing do
|
67
|
-
response = NewRelic::Agent::Tracer.capture_segment_error segment do
|
68
|
-
request_without_newrelic_trace(request, *args, **kwargs, &block)
|
56
|
+
end
|
57
|
+
else
|
58
|
+
def request_with_newrelic_trace(request, *args, **kwargs, &block)
|
59
|
+
wrapped_request = NewRelic::Agent::HTTPClients::NetHTTPRequest.new(self, request)
|
60
|
+
|
61
|
+
segment = NewRelic::Agent::Tracer.start_external_request_segment(
|
62
|
+
library: wrapped_request.type,
|
63
|
+
uri: wrapped_request.uri,
|
64
|
+
procedure: wrapped_request.method
|
65
|
+
)
|
66
|
+
|
67
|
+
begin
|
68
|
+
response = nil
|
69
|
+
segment.add_request_headers wrapped_request
|
70
|
+
|
71
|
+
# RUBY-1244 Disable further tracing in request to avoid double
|
72
|
+
# counting if connection wasn't started (which calls request again).
|
73
|
+
NewRelic::Agent.disable_all_tracing do
|
74
|
+
response = NewRelic::Agent::Tracer.capture_segment_error segment do
|
75
|
+
request_without_newrelic_trace(request, *args, **kwargs, &block)
|
76
|
+
end
|
69
77
|
end
|
78
|
+
|
79
|
+
wrapped_response = NewRelic::Agent::HTTPClients::NetHTTPResponse.new response
|
80
|
+
segment.process_response_headers wrapped_response
|
81
|
+
response
|
82
|
+
ensure
|
83
|
+
segment.finish
|
70
84
|
end
|
71
|
-
|
72
|
-
wrapped_response = NewRelic::Agent::HTTPClients::NetHTTPResponse.new response
|
73
|
-
segment.process_response_headers wrapped_response
|
74
|
-
response
|
75
|
-
ensure
|
76
|
-
segment.finish
|
77
85
|
end
|
78
86
|
end
|
79
|
-
|
87
|
+
|
88
|
+
alias request_without_newrelic_trace request
|
89
|
+
alias request request_with_newrelic_trace
|
80
90
|
end
|
81
|
-
|
82
|
-
|
83
|
-
alias request_without_newrelic_trace request
|
84
|
-
alias request request_with_newrelic_trace
|
85
91
|
end
|
92
|
+
|
86
93
|
end
|
87
94
|
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# This file is distributed under New Relic's license terms.
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
|
5
|
+
module NewRelic
|
6
|
+
module Agent
|
7
|
+
module Instrumentation
|
8
|
+
module NetPrepend
|
9
|
+
|
10
|
+
if RUBY_VERSION < "2.7.0"
|
11
|
+
def request(request, *args, &block)
|
12
|
+
wrapped_request = NewRelic::Agent::HTTPClients::NetHTTPRequest.new(self, request)
|
13
|
+
|
14
|
+
segment = NewRelic::Agent::Tracer.start_external_request_segment(
|
15
|
+
library: wrapped_request.type,
|
16
|
+
uri: wrapped_request.uri,
|
17
|
+
procedure: wrapped_request.method
|
18
|
+
)
|
19
|
+
|
20
|
+
begin
|
21
|
+
response = nil
|
22
|
+
segment.add_request_headers wrapped_request
|
23
|
+
|
24
|
+
# RUBY-1244 Disable further tracing in request to avoid double
|
25
|
+
# counting if connection wasn't started (which calls request again).
|
26
|
+
NewRelic::Agent.disable_all_tracing do
|
27
|
+
response = NewRelic::Agent::Tracer.capture_segment_error segment do
|
28
|
+
super
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
wrapped_response = NewRelic::Agent::HTTPClients::NetHTTPResponse.new response
|
33
|
+
segment.process_response_headers wrapped_response
|
34
|
+
response
|
35
|
+
ensure
|
36
|
+
segment.finish
|
37
|
+
end
|
38
|
+
end
|
39
|
+
else
|
40
|
+
def request(request, *args, **kwargs, &block)
|
41
|
+
wrapped_request = NewRelic::Agent::HTTPClients::NetHTTPRequest.new(self, request)
|
42
|
+
|
43
|
+
segment = NewRelic::Agent::Tracer.start_external_request_segment(
|
44
|
+
library: wrapped_request.type,
|
45
|
+
uri: wrapped_request.uri,
|
46
|
+
procedure: wrapped_request.method
|
47
|
+
)
|
48
|
+
|
49
|
+
begin
|
50
|
+
response = nil
|
51
|
+
segment.add_request_headers wrapped_request
|
52
|
+
|
53
|
+
# RUBY-1244 Disable further tracing in request to avoid double
|
54
|
+
# counting if connection wasn't started (which calls request again).
|
55
|
+
NewRelic::Agent.disable_all_tracing do
|
56
|
+
response = NewRelic::Agent::Tracer.capture_segment_error segment do
|
57
|
+
super
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
wrapped_response = NewRelic::Agent::HTTPClients::NetHTTPResponse.new response
|
62
|
+
segment.process_response_headers wrapped_response
|
63
|
+
response
|
64
|
+
ensure
|
65
|
+
segment.finish
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|