newrelic_rpm 8.12.0 → 8.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/.rubocop_todo.yml +14 -7
- data/CHANGELOG.md +42 -0
- data/README.md +2 -3
- data/lib/new_relic/agent/agent_logger.rb +1 -1
- data/lib/new_relic/agent/audit_logger.rb +1 -1
- data/lib/new_relic/agent/configuration/default_source.rb +1403 -1369
- data/lib/new_relic/agent/configuration/environment_source.rb +2 -2
- data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +1 -1
- data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +0 -2
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +0 -2
- data/lib/new_relic/agent/instrumentation/authlogic.rb +0 -2
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +0 -1
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +0 -2
- data/lib/new_relic/agent/instrumentation/excon.rb +17 -0
- data/lib/new_relic/agent/instrumentation/rack/chain.rb +10 -2
- data/lib/new_relic/agent/instrumentation/rack/prepend.rb +9 -2
- data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/redis/chain.rb +18 -6
- data/lib/new_relic/agent/instrumentation/redis/constants.rb +17 -0
- data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +26 -18
- data/lib/new_relic/agent/instrumentation/redis/middleware.rb +16 -0
- data/lib/new_relic/agent/instrumentation/redis/prepend.rb +6 -0
- data/lib/new_relic/agent/instrumentation/redis.rb +6 -0
- data/lib/new_relic/agent/instrumentation/sidekiq/client.rb +20 -0
- data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb +30 -0
- data/lib/new_relic/agent/instrumentation/sidekiq/server.rb +37 -0
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +6 -70
- data/lib/new_relic/agent/instrumentation/sinatra.rb +0 -2
- data/lib/new_relic/agent/instrumentation/sunspot.rb +0 -2
- data/lib/new_relic/agent/method_tracer_helpers.rb +1 -1
- data/lib/new_relic/agent/parameter_filtering.rb +7 -1
- data/lib/new_relic/agent/tracer.rb +1 -1
- data/lib/new_relic/constants.rb +2 -0
- data/lib/new_relic/control/instrumentation.rb +4 -8
- data/lib/new_relic/local_environment.rb +1 -1
- data/lib/new_relic/rack/browser_monitoring.rb +1 -0
- data/lib/new_relic/version.rb +2 -2
- data/lib/tasks/helpers/prompt.rb +1 -1
- data/lib/tasks/instrumentation_generator/README.md +2 -2
- data/lib/tasks/instrumentation_generator/TODO.md +5 -5
- data/newrelic_rpm.gemspec +1 -1
- data/test/agent_helper.rb +18 -0
- metadata +9 -4
@@ -104,6 +104,7 @@ module NewRelic
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def streaming?(env, headers)
|
107
|
+
# Chunked transfer encoding is a streaming data transfer mechanism available only in HTTP/1.1
|
107
108
|
return true if headers && headers['Transfer-Encoding'] == 'chunked'
|
108
109
|
|
109
110
|
defined?(ActionController::Live) &&
|
data/lib/new_relic/version.rb
CHANGED
data/lib/tasks/helpers/prompt.rb
CHANGED
@@ -58,6 +58,6 @@ Furthermore, we also create very similar snippets inside the default source conf
|
|
58
58
|
|
59
59
|
## Outcome
|
60
60
|
|
61
|
-
A prototype outside the agent
|
61
|
+
A prototype outside the agent was first created. This prototype generated the required files to add instrumentation. The prototype accepted three arguments: name (name of the library), method (method to instrument), args (arguments for the method). This prototype has evolved into the current directory.
|
62
62
|
|
63
|
-
|
63
|
+
This project leverages the Ruby gem Thor, a toolkit for building powerful command-line interfaces used in Bundler, Vagrant, Rails and others powers this CLI.
|
@@ -22,12 +22,12 @@
|
|
22
22
|
|
23
23
|
# - [ ] Append a new method to instrument to an existing instrumentation class (with tests?)
|
24
24
|
|
25
|
-
# - [ ] Documentation: examples of what to add in each gap
|
26
|
-
|
27
|
-
# - [ ] Good examples of tests, instrumentation, etc. as comments
|
25
|
+
# - [ ] Documentation: examples of what to add in each gap (Good examples of tests, instrumentation, etc. as comments to guide users)
|
28
26
|
|
29
27
|
# - [ ] Handle multi-word gem names (camel case for classes, handle hyphens, concurrent-ruby as example)
|
30
28
|
|
31
|
-
# - [ ]
|
29
|
+
# - [ ] Allow multiple method arguments to be passed to the command line
|
30
|
+
|
31
|
+
# - [ ] Add tests for the instrumentation_generator code
|
32
32
|
|
33
|
-
# - [ ]
|
33
|
+
# - [ ] See if instrumentation PRs can get automatically generated when an already instrumented library adds methods to its codebase
|
data/newrelic_rpm.gemspec
CHANGED
@@ -51,7 +51,7 @@ https://github.com/newrelic/newrelic-ruby-agent/
|
|
51
51
|
s.add_development_dependency 'httparty' unless ENV['CI'] # for perf tests and Gabby
|
52
52
|
s.add_development_dependency 'minitest', "#{RUBY_VERSION >= '2.7.0' ? '5.3.3' : '4.7.5'}"
|
53
53
|
s.add_development_dependency 'minitest-stub-const', '0.6'
|
54
|
-
s.add_development_dependency 'mocha', '~> 1.
|
54
|
+
s.add_development_dependency 'mocha', '~> 1.16'
|
55
55
|
s.add_development_dependency 'pry' unless ENV['CI']
|
56
56
|
s.add_development_dependency 'rake', '12.3.3'
|
57
57
|
s.add_development_dependency 'rubocop' unless ENV['CI'] && RUBY_VERSION < '3.0.0'
|
data/test/agent_helper.rb
CHANGED
@@ -48,6 +48,7 @@ end
|
|
48
48
|
|
49
49
|
def assert_has_traced_error(error_class)
|
50
50
|
errors = harvest_error_traces!
|
51
|
+
|
51
52
|
refute_nil errors.find { |e| e.exception_class_name == error_class.name }, \
|
52
53
|
"Didn't find error of class #{error_class}"
|
53
54
|
end
|
@@ -83,6 +84,7 @@ end
|
|
83
84
|
unless defined? assert_includes
|
84
85
|
def assert_includes(collection, member, msg = nil)
|
85
86
|
msg = "Expected #{collection.inspect} to include #{member.inspect}"
|
87
|
+
|
86
88
|
assert_includes collection, member, msg
|
87
89
|
end
|
88
90
|
end
|
@@ -90,6 +92,7 @@ end
|
|
90
92
|
unless defined? assert_not_includes
|
91
93
|
def assert_not_includes(collection, member, msg = nil)
|
92
94
|
msg = "Expected #{collection.inspect} not to include #{member.inspect}"
|
95
|
+
|
93
96
|
refute_includes collection, member, msg
|
94
97
|
end
|
95
98
|
end
|
@@ -107,6 +110,7 @@ end
|
|
107
110
|
|
108
111
|
def assert_log_contains(log, message)
|
109
112
|
lines = log.array
|
113
|
+
|
110
114
|
assert (lines.any? { |line| line.match(message) })
|
111
115
|
end
|
112
116
|
|
@@ -117,6 +121,7 @@ def assert_audit_log_contains(audit_log_contents, needle)
|
|
117
121
|
regex = /[:"]/
|
118
122
|
needle = needle.gsub(regex, '')
|
119
123
|
haystack = audit_log_contents.gsub(regex, '')
|
124
|
+
|
120
125
|
assert_includes(haystack, needle, "Expected log to contain '#{needle}'")
|
121
126
|
end
|
122
127
|
|
@@ -136,10 +141,12 @@ def assert_audit_log_contains_object(audit_log_contents, o, format = :json)
|
|
136
141
|
assert_audit_log_contains_object(audit_log_contents, k, format)
|
137
142
|
end
|
138
143
|
when Array
|
144
|
+
|
139
145
|
o.each do |el|
|
140
146
|
assert_audit_log_contains_object(audit_log_contents, el, format)
|
141
147
|
end
|
142
148
|
when NilClass
|
149
|
+
|
143
150
|
assert_audit_log_contains(audit_log_contents, format == :json ? "null" : "nil")
|
144
151
|
else
|
145
152
|
assert_audit_log_contains(audit_log_contents, o.inspect)
|
@@ -148,6 +155,7 @@ end
|
|
148
155
|
|
149
156
|
def compare_metrics(expected, actual)
|
150
157
|
actual.delete_if { |a| a.include?('GC/Transaction/') }
|
158
|
+
|
151
159
|
assert_equal(expected.to_a.sort, actual.to_a.sort, "extra: #{(actual - expected).to_a.inspect}; missing: #{(expected - actual).to_a.inspect}")
|
152
160
|
end
|
153
161
|
|
@@ -206,6 +214,7 @@ def assert_stats_has_values_with_call_count(expected_value, actual_value, msg)
|
|
206
214
|
if expected_value.to_s =~ /([<>]=?)\s*(\d+)/
|
207
215
|
operator = Regexp.last_match(1).to_sym
|
208
216
|
count = Regexp.last_match(2).to_i
|
217
|
+
|
209
218
|
assert_operator(actual_value, operator, count, msg)
|
210
219
|
# == comparison
|
211
220
|
else
|
@@ -229,6 +238,7 @@ def assert_metrics_recorded(expected)
|
|
229
238
|
|
230
239
|
assert(actual_stats, msg) # rubocop:disable Minitest/AssertWithExpectedArgument
|
231
240
|
end
|
241
|
+
|
232
242
|
assert_stats_has_values(actual_stats, expected_spec, expected_attrs)
|
233
243
|
end
|
234
244
|
end
|
@@ -246,6 +256,7 @@ end
|
|
246
256
|
#
|
247
257
|
def assert_metrics_recorded_exclusive(expected, options = {})
|
248
258
|
expected = _normalize_metric_expectations(expected)
|
259
|
+
|
249
260
|
assert_metrics_recorded(expected)
|
250
261
|
|
251
262
|
recorded_metrics = NewRelic::Agent.instance.stats_engine.to_h.keys
|
@@ -300,6 +311,7 @@ def assert_metrics_not_recorded(not_expected)
|
|
300
311
|
found_but_not_expected << spec
|
301
312
|
end
|
302
313
|
end
|
314
|
+
|
303
315
|
assert_empty(found_but_not_expected, "Found unexpected metrics: #{format_metric_spec_list(found_but_not_expected)}")
|
304
316
|
end
|
305
317
|
|
@@ -328,11 +340,13 @@ end
|
|
328
340
|
|
329
341
|
def assert_truthy(expected, msg = nil)
|
330
342
|
msg ||= "Expected #{expected.inspect} to be truthy"
|
343
|
+
|
331
344
|
refute !expected, msg
|
332
345
|
end
|
333
346
|
|
334
347
|
def assert_falsy(expected, msg = nil)
|
335
348
|
msg ||= "Expected #{expected.inspect} to be falsy"
|
349
|
+
|
336
350
|
refute expected, msg
|
337
351
|
end
|
338
352
|
|
@@ -888,6 +902,7 @@ def assert_event_attributes(event, test_name, expected_attributes, non_expected_
|
|
888
902
|
event_attrs.each do |name, actual_value|
|
889
903
|
msg << " #{name}: #{actual_value.inspect}\n"
|
890
904
|
end
|
905
|
+
|
891
906
|
assert_empty(incorrect_attributes, msg)
|
892
907
|
|
893
908
|
non_expected_attributes.each do |name|
|
@@ -950,6 +965,7 @@ end
|
|
950
965
|
# the expectations against it.
|
951
966
|
def assert_segment_noticed_error(txn, segment_name, error_classes, error_message)
|
952
967
|
error_segment = txn.segments.reverse.detect { |s| s.noticed_error }
|
968
|
+
|
953
969
|
assert error_segment, "Expected at least one segment with a noticed_error"
|
954
970
|
|
955
971
|
assert_match_or_equal segment_name, error_segment.name
|
@@ -967,6 +983,7 @@ end
|
|
967
983
|
|
968
984
|
def refute_transaction_noticed_error(txn, error_class)
|
969
985
|
error_segment = txn.segments.reverse.detect { |s| s.noticed_error }
|
986
|
+
|
970
987
|
assert error_segment, "Expected at least one segment with a noticed_error"
|
971
988
|
assert_empty txn.exceptions, "Expected transaction to NOT notice any segment errors"
|
972
989
|
end
|
@@ -984,6 +1001,7 @@ def refute_raises(*exp)
|
|
984
1001
|
rescue Exception => e
|
985
1002
|
puts "EXCEPTION RAISED: #{e.inspect}\n#{e.backtrace}"
|
986
1003
|
exp = exp.first if exp.size == 1
|
1004
|
+
|
987
1005
|
flunk(msg || "unexpected exception raised: #{e}")
|
988
1006
|
end
|
989
1007
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.
|
4
|
+
version: 8.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tanna McClure
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2022-
|
14
|
+
date: 2022-11-21 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -61,14 +61,14 @@ dependencies:
|
|
61
61
|
requirements:
|
62
62
|
- - "~>"
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: 1.
|
64
|
+
version: '1.16'
|
65
65
|
type: :development
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
69
|
- - "~>"
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version: 1.
|
71
|
+
version: '1.16'
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
73
|
name: rake
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
@@ -341,7 +341,9 @@ files:
|
|
341
341
|
- lib/new_relic/agent/instrumentation/rake/prepend.rb
|
342
342
|
- lib/new_relic/agent/instrumentation/redis.rb
|
343
343
|
- lib/new_relic/agent/instrumentation/redis/chain.rb
|
344
|
+
- lib/new_relic/agent/instrumentation/redis/constants.rb
|
344
345
|
- lib/new_relic/agent/instrumentation/redis/instrumentation.rb
|
346
|
+
- lib/new_relic/agent/instrumentation/redis/middleware.rb
|
345
347
|
- lib/new_relic/agent/instrumentation/redis/prepend.rb
|
346
348
|
- lib/new_relic/agent/instrumentation/resque.rb
|
347
349
|
- lib/new_relic/agent/instrumentation/resque/chain.rb
|
@@ -351,6 +353,9 @@ files:
|
|
351
353
|
- lib/new_relic/agent/instrumentation/sequel.rb
|
352
354
|
- lib/new_relic/agent/instrumentation/sequel_helper.rb
|
353
355
|
- lib/new_relic/agent/instrumentation/sidekiq.rb
|
356
|
+
- lib/new_relic/agent/instrumentation/sidekiq/client.rb
|
357
|
+
- lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
|
358
|
+
- lib/new_relic/agent/instrumentation/sidekiq/server.rb
|
354
359
|
- lib/new_relic/agent/instrumentation/sinatra.rb
|
355
360
|
- lib/new_relic/agent/instrumentation/sinatra/chain.rb
|
356
361
|
- lib/new_relic/agent/instrumentation/sinatra/ignorer.rb
|