newrelic_rpm 3.17.2.327 → 3.18.0.329
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +32 -10
- data/CHANGELOG.md +43 -3
- data/Rakefile +0 -21
- data/lib/new_relic/agent/cross_app_tracing.rb +34 -269
- data/lib/new_relic/agent/http_clients/curb_wrappers.rb +10 -2
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +18 -9
- data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +12 -6
- data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +13 -6
- data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +13 -6
- data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +14 -3
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +10 -15
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +4 -7
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +4 -19
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +0 -1
- data/lib/new_relic/agent/instrumentation/curb.rb +9 -7
- data/lib/new_relic/agent/instrumentation/evented_subscriber.rb +4 -0
- data/lib/new_relic/agent/instrumentation/excon/connection.rb +15 -5
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +17 -12
- data/lib/new_relic/agent/instrumentation/http.rb +12 -5
- data/lib/new_relic/agent/instrumentation/httpclient.rb +13 -4
- data/lib/new_relic/agent/instrumentation/net.rb +13 -2
- data/lib/new_relic/agent/instrumentation/rails5/action_controller.rb +2 -10
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +8 -3
- data/lib/new_relic/agent/method_tracer_helpers.rb +3 -1
- data/lib/new_relic/agent/parameter_filtering.rb +1 -1
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +0 -18
- data/lib/new_relic/agent/supported_versions.rb +1 -0
- data/lib/new_relic/agent/transaction/abstract_segment.rb +7 -9
- data/lib/new_relic/agent/transaction/external_request_segment.rb +139 -0
- data/lib/new_relic/agent/transaction/segment.rb +1 -1
- data/lib/new_relic/agent/transaction/tracing.rb +10 -1
- data/lib/new_relic/recipes/capistrano3.rb +3 -1
- data/lib/new_relic/version.rb +2 -2
- data/lib/tasks/multiverse.rb +27 -7
- data/test/environments/rails42/Gemfile +1 -0
- data/test/multiverse/lib/multiverse.rb +32 -0
- data/test/multiverse/lib/multiverse/runner.rb +2 -2
- data/test/multiverse/lib/multiverse/suite.rb +43 -22
- data/test/multiverse/suites/active_record/Envfile +3 -1
- data/test/multiverse/suites/activemerchant/Envfile +5 -1
- data/test/multiverse/suites/agent_only/Envfile +1 -0
- data/test/multiverse/suites/capistrano/deployment_test.rb +6 -9
- data/test/multiverse/suites/capistrano2/deployment_test.rb +6 -6
- data/test/multiverse/suites/curb/curb_test.rb +2 -3
- data/test/multiverse/suites/datamapper/Envfile +4 -0
- data/test/multiverse/suites/datamapper/datamapper_test.rb +106 -36
- data/test/multiverse/suites/delayed_job/Envfile +3 -3
- data/test/multiverse/suites/excon/excon_test.rb +1 -1
- data/test/multiverse/suites/grape/grape_test.rb +1 -1
- data/test/multiverse/suites/grape/grape_test_api.rb +1 -1
- data/test/multiverse/suites/grape/grape_versioning_test.rb +1 -1
- data/test/multiverse/suites/grape/grape_versioning_test_api.rb +1 -1
- data/test/multiverse/suites/grape/unsupported_version_test.rb +1 -1
- data/test/multiverse/suites/httpclient/Envfile +2 -0
- data/test/multiverse/suites/httpclient/httpclient_test.rb +1 -1
- data/test/multiverse/suites/httprb/Envfile +2 -0
- data/test/multiverse/suites/httprb/httprb_test.rb +1 -1
- data/test/multiverse/suites/json/Envfile +7 -2
- data/test/multiverse/suites/memcached/Envfile +2 -0
- data/test/multiverse/suites/mongo/Envfile +2 -0
- data/test/multiverse/suites/mongo/helpers/mongo_operation_tests.rb +95 -33
- data/test/multiverse/suites/mongo/mongo2_instrumentation_test.rb +62 -23
- data/test/multiverse/suites/net_http/Envfile +2 -0
- data/test/multiverse/suites/net_http/net_http_test.rb +7 -3
- data/test/multiverse/suites/padrino/Envfile +2 -0
- data/test/multiverse/suites/rack/Envfile +2 -0
- data/test/multiverse/suites/rack/url_map_test.rb +4 -0
- data/test/multiverse/suites/rails/Envfile +34 -29
- data/test/multiverse/suites/rake/Envfile +11 -6
- data/test/multiverse/suites/redis/Envfile +2 -0
- data/test/multiverse/suites/redis/redis_instrumentation_test.rb +31 -12
- data/test/multiverse/suites/sidekiq/Envfile +6 -2
- data/test/multiverse/suites/sinatra/Envfile +2 -0
- data/test/multiverse/suites/typhoeus/Envfile +31 -27
- data/test/multiverse/suites/typhoeus/typhoeus_test.rb +4 -3
- data/test/multiverse/suites/yajl/Envfile +4 -2
- data/test/new_relic/agent/datastores_test.rb +0 -10
- data/test/new_relic/agent/instrumentation/action_cable_subscriber_test.rb +2 -2
- data/test/new_relic/agent/instrumentation/action_view_subscriber_test.rb +64 -65
- data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +11 -9
- data/test/new_relic/agent/instrumentation/instance_identification_test.rb +9 -8
- data/test/new_relic/agent/instrumentation/mongodb_command_subscriber_test.rb +7 -11
- data/test/new_relic/agent/instrumentation/net_instrumentation_test.rb +4 -0
- data/test/new_relic/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb +0 -9
- data/test/new_relic/agent/method_tracer_test.rb +24 -8
- data/test/new_relic/agent/parameter_filtering_test.rb +2 -2
- data/test/new_relic/agent/stats_engine/metric_stats_test.rb +1 -0
- data/test/new_relic/agent/transaction/abstract_segment_test.rb +25 -16
- data/test/new_relic/agent/transaction/datastore_segment_test.rb +55 -38
- data/test/new_relic/agent/transaction/external_request_segment_test.rb +330 -0
- data/test/new_relic/agent/transaction/segment_test.rb +28 -4
- data/test/new_relic/agent/transaction/tracing_test.rb +60 -22
- data/test/new_relic/agent_test.rb +2 -1
- data/test/new_relic/collection_helper_test.rb +1 -0
- data/test/new_relic/dispatcher_test.rb +1 -0
- data/test/new_relic/fake_external_server.rb +1 -1
- data/test/new_relic/filtering_test_app.rb +1 -1
- data/test/new_relic/http_client_test_cases.rb +38 -20
- data/test/new_relic/rack/error_collector_test.rb +1 -0
- data/test/performance/suites/external_segment.rb +82 -0
- data/test/script/before_install/update_bundler.sh +12 -0
- data/test/script/external_server.rb +31 -0
- metadata +8 -5
- data/test/multiverse/lib/multiverse/environment.rb +0 -19
- data/test/new_relic/agent/cross_app_tracing_test.rb +0 -71
- data/test/script/before_install/jruby_bundler.sh +0 -22
@@ -36,7 +36,9 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_records_metrics_for_insert_one
|
39
|
-
|
39
|
+
in_transaction do
|
40
|
+
@collection.insert_one(@tribbles.first)
|
41
|
+
end
|
40
42
|
|
41
43
|
metrics = build_test_metrics(:insert, true)
|
42
44
|
expected = metrics_with_attributes(metrics)
|
@@ -45,7 +47,9 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
45
47
|
end
|
46
48
|
|
47
49
|
def test_records_metrics_for_insert_many
|
48
|
-
|
50
|
+
in_transaction do
|
51
|
+
@collection.insert_many(@tribbles)
|
52
|
+
end
|
49
53
|
|
50
54
|
metrics = build_test_metrics(:insert, true)
|
51
55
|
expected = metrics_with_attributes(metrics)
|
@@ -57,7 +61,9 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
57
61
|
@collection.insert_one(@tribbles.first)
|
58
62
|
NewRelic::Agent.drop_buffered_data
|
59
63
|
|
60
|
-
|
64
|
+
in_transaction do
|
65
|
+
@collection.delete_one(@tribbles.first)
|
66
|
+
end
|
61
67
|
|
62
68
|
metrics = build_test_metrics(:delete, true)
|
63
69
|
expected = metrics_with_attributes(metrics)
|
@@ -69,7 +75,9 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
69
75
|
@collection.insert_one(@tribbles.first)
|
70
76
|
NewRelic::Agent.drop_buffered_data
|
71
77
|
|
72
|
-
|
78
|
+
in_transaction do
|
79
|
+
@collection.delete_many(@tribbles.first)
|
80
|
+
end
|
73
81
|
|
74
82
|
metrics = build_test_metrics(:delete, true)
|
75
83
|
expected = metrics_with_attributes(metrics)
|
@@ -81,7 +89,9 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
81
89
|
@collection.insert_one(@tribbles.first)
|
82
90
|
NewRelic::Agent.drop_buffered_data
|
83
91
|
|
84
|
-
|
92
|
+
in_transaction do
|
93
|
+
@collection.replace_one(@tribbles[0], @tribbles[1])
|
94
|
+
end
|
85
95
|
|
86
96
|
metrics = build_test_metrics(:update, true)
|
87
97
|
expected = metrics_with_attributes(metrics)
|
@@ -93,7 +103,9 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
93
103
|
@collection.insert_one(@tribbles.first)
|
94
104
|
NewRelic::Agent.drop_buffered_data
|
95
105
|
|
96
|
-
|
106
|
+
in_transaction do
|
107
|
+
@collection.update_one(@tribbles[0], "$set" => @tribbles[1])
|
108
|
+
end
|
97
109
|
|
98
110
|
metrics = build_test_metrics(:update, true)
|
99
111
|
expected = metrics_with_attributes(metrics)
|
@@ -105,7 +117,9 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
105
117
|
@collection.insert_one(@tribbles.first)
|
106
118
|
NewRelic::Agent.drop_buffered_data
|
107
119
|
|
108
|
-
|
120
|
+
in_transaction do
|
121
|
+
@collection.update_many(@tribbles[0], "$set" => @tribbles[1])
|
122
|
+
end
|
109
123
|
|
110
124
|
metrics = build_test_metrics(:update, true)
|
111
125
|
expected = metrics_with_attributes(metrics)
|
@@ -117,7 +131,9 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
117
131
|
@collection.insert_one(@tribbles.first)
|
118
132
|
NewRelic::Agent.drop_buffered_data
|
119
133
|
|
120
|
-
|
134
|
+
in_transaction do
|
135
|
+
@collection.find(@tribbles.first).to_a
|
136
|
+
end
|
121
137
|
|
122
138
|
metrics = build_test_metrics(:find, true)
|
123
139
|
expected = metrics_with_attributes(metrics)
|
@@ -129,7 +145,9 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
129
145
|
@collection.insert_one(@tribbles.first)
|
130
146
|
NewRelic::Agent.drop_buffered_data
|
131
147
|
|
132
|
-
|
148
|
+
in_transaction do
|
149
|
+
@collection.find_one_and_delete(@tribbles.first)
|
150
|
+
end
|
133
151
|
|
134
152
|
metrics = build_test_metrics(:findandmodify, true)
|
135
153
|
expected = metrics_with_attributes(metrics)
|
@@ -141,7 +159,9 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
141
159
|
@collection.insert_one(@tribbles.first)
|
142
160
|
NewRelic::Agent.drop_buffered_data
|
143
161
|
|
144
|
-
|
162
|
+
in_transaction do
|
163
|
+
@collection.find_one_and_replace(@tribbles[0], @tribbles[1])
|
164
|
+
end
|
145
165
|
|
146
166
|
metrics = build_test_metrics(:findandmodify, true)
|
147
167
|
expected = metrics_with_attributes(metrics)
|
@@ -153,7 +173,9 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
153
173
|
@collection.insert_one(@tribbles.first)
|
154
174
|
NewRelic::Agent.drop_buffered_data
|
155
175
|
|
156
|
-
|
176
|
+
in_transaction do
|
177
|
+
@collection.find_one_and_update(@tribbles[0], "$set" => @tribbles[1])
|
178
|
+
end
|
157
179
|
|
158
180
|
metrics = build_test_metrics(:findandmodify, true)
|
159
181
|
expected = metrics_with_attributes(metrics)
|
@@ -162,7 +184,9 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
162
184
|
end
|
163
185
|
|
164
186
|
def test_records_metrics_for_distinct
|
165
|
-
|
187
|
+
in_transaction do
|
188
|
+
@collection.distinct('name')
|
189
|
+
end
|
166
190
|
|
167
191
|
metrics = build_test_metrics(:distinct, true)
|
168
192
|
expected = metrics_with_attributes(metrics)
|
@@ -171,7 +195,9 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
171
195
|
end
|
172
196
|
|
173
197
|
def test_records_metrics_for_count
|
174
|
-
|
198
|
+
in_transaction do
|
199
|
+
@collection.count
|
200
|
+
end
|
175
201
|
|
176
202
|
metrics = build_test_metrics(:count, true)
|
177
203
|
expected = metrics_with_attributes(metrics)
|
@@ -185,10 +211,15 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
185
211
|
end
|
186
212
|
NewRelic::Agent.drop_buffered_data
|
187
213
|
|
188
|
-
|
214
|
+
in_transaction("test_txn") do
|
215
|
+
@collection.find(:active => true).batch_size(10).to_a
|
216
|
+
end
|
189
217
|
|
190
218
|
expected = {
|
219
|
+
"test_txn" => {:call_count=>1},
|
220
|
+
["Datastore/statement/MongoDB/#{@collection_name}/find", "test_txn"] => {:call_count=>1},
|
191
221
|
"Datastore/statement/MongoDB/#{@collection_name}/find" => {:call_count=>1},
|
222
|
+
["Datastore/statement/MongoDB/#{@collection_name}/getMore", "test_txn"] => {:call_count=>2},
|
192
223
|
"Datastore/statement/MongoDB/#{@collection_name}/getMore" => {:call_count=>2},
|
193
224
|
"Datastore/operation/MongoDB/find" => {:call_count=>1},
|
194
225
|
"Datastore/operation/MongoDB/getMore" => {:call_count=>2},
|
@@ -241,7 +272,9 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
241
272
|
end
|
242
273
|
|
243
274
|
def test_drop_collection
|
244
|
-
|
275
|
+
in_transaction do
|
276
|
+
@collection.drop
|
277
|
+
end
|
245
278
|
|
246
279
|
metrics = build_test_metrics(:drop, true)
|
247
280
|
expected = metrics_with_attributes(metrics)
|
@@ -258,11 +291,6 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
258
291
|
assert_metrics_recorded([[metric, "webby"]])
|
259
292
|
end
|
260
293
|
|
261
|
-
def statement_metric(action)
|
262
|
-
metrics = build_test_metrics(action, true)
|
263
|
-
metrics.select { |m| m.start_with?("Datastore/statement") }.first
|
264
|
-
end
|
265
|
-
|
266
294
|
def test_background_scoped_metrics
|
267
295
|
in_background_transaction("backed-up") do
|
268
296
|
@collection.insert_one(@tribbles.first)
|
@@ -368,7 +396,9 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
368
396
|
|
369
397
|
def test_web_requests_record_all_web_metric
|
370
398
|
NewRelic::Agent::Transaction.stubs(:recording_web_transaction?).returns(true)
|
371
|
-
|
399
|
+
in_web_transaction do
|
400
|
+
@collection.insert_one(@tribbles.first)
|
401
|
+
end
|
372
402
|
|
373
403
|
metrics = build_test_metrics(:insert, true)
|
374
404
|
expected = metrics_with_attributes(metrics)
|
@@ -378,14 +408,18 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
378
408
|
|
379
409
|
def test_web_requests_do_not_record_all_other_metric
|
380
410
|
NewRelic::Agent::Transaction.stubs(:recording_web_transaction?).returns(true)
|
381
|
-
|
411
|
+
in_background_transaction do
|
412
|
+
@collection.insert_one(@tribbles.first)
|
413
|
+
end
|
382
414
|
|
383
415
|
assert_metrics_not_recorded(['Datastore/allOther'])
|
384
416
|
end
|
385
417
|
|
386
418
|
def test_other_requests_record_all_other_metric
|
387
419
|
NewRelic::Agent::Transaction.stubs(:recording_web_transaction?).returns(false)
|
388
|
-
|
420
|
+
in_transaction do
|
421
|
+
@collection.insert_one(@tribbles.first)
|
422
|
+
end
|
389
423
|
|
390
424
|
metrics = build_test_metrics(:insert, true)
|
391
425
|
expected = metrics_with_attributes(metrics)
|
@@ -399,6 +433,11 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
399
433
|
|
400
434
|
assert_metrics_not_recorded(['Datastore/allWeb'])
|
401
435
|
end
|
436
|
+
|
437
|
+
def statement_metric(action)
|
438
|
+
metrics = build_test_metrics(action, true)
|
439
|
+
metrics.select { |m| m.start_with?("Datastore/statement") }.first
|
440
|
+
end
|
402
441
|
end
|
403
442
|
end
|
404
443
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
# This file is distributed under New Relic
|
2
|
+
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
4
|
|
5
5
|
require "net/http"
|
@@ -90,7 +90,9 @@ class NetHttpTest < Minitest::Test
|
|
90
90
|
# Don't check this specific condition against SSL, since API doesn't support it
|
91
91
|
return if use_ssl?
|
92
92
|
|
93
|
-
|
93
|
+
in_transaction do
|
94
|
+
Net::HTTP.get default_uri
|
95
|
+
end
|
94
96
|
|
95
97
|
assert_metrics_recorded([
|
96
98
|
'External/all',
|
@@ -103,7 +105,9 @@ class NetHttpTest < Minitest::Test
|
|
103
105
|
# https://newrelic.atlassian.net/browse/RUBY-835
|
104
106
|
def test_direct_get_request_doesnt_double_count
|
105
107
|
http = create_http(default_uri)
|
106
|
-
|
108
|
+
in_transaction do
|
109
|
+
http.request(Net::HTTP::Get.new(default_uri.request_uri))
|
110
|
+
end
|
107
111
|
|
108
112
|
assert_metrics_recorded(
|
109
113
|
'External/localhost/Net::HTTP/GET' => { :call_count => 1 })
|
@@ -11,6 +11,10 @@ if NewRelic::Agent::Instrumentation::RackHelpers.version_supported?
|
|
11
11
|
class UrlMapTest < Minitest::Test
|
12
12
|
include MultiverseHelpers
|
13
13
|
|
14
|
+
def setup
|
15
|
+
NewRelic::Agent.drop_buffered_data
|
16
|
+
end
|
17
|
+
|
14
18
|
def teardown
|
15
19
|
NewRelic::Agent.drop_buffered_data
|
16
20
|
end
|
@@ -6,11 +6,12 @@ if RUBY_VERSION >= '2.2.2' && RUBY_PLATFORM != 'java'
|
|
6
6
|
RB
|
7
7
|
end
|
8
8
|
|
9
|
-
if RUBY_VERSION >= '1.9.3'
|
9
|
+
if RUBY_VERSION >= '1.9.3' && RUBY_VERSION < '2.4.0'
|
10
10
|
gemfile <<-RB
|
11
11
|
gem 'rails', '~>4.2.1'
|
12
12
|
gem 'haml', :require => false
|
13
13
|
gem 'minitest', '5.2.3'
|
14
|
+
gem 'nokogiri', '< 1.7' if RUBY_VERSION < '2.1.0' # nokogiri 1.7.0 only supports >= 2.1.0
|
14
15
|
RB
|
15
16
|
|
16
17
|
gemfile <<-RB
|
@@ -29,37 +30,39 @@ if RUBY_VERSION >= '1.9.3'
|
|
29
30
|
RB
|
30
31
|
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
if RUBY_VERSION < '2.4.0'
|
34
|
+
gemfile <<-RB
|
35
|
+
gem 'rails', '~>3.2.22.2'
|
36
|
+
gem 'i18n', '~>0.6.11'
|
37
|
+
gem 'haml', '4.0.2' # Getting load issues with haml 4.0.3
|
38
|
+
gem 'minitest_tu_shim', :require => false
|
39
|
+
gem 'rack-cache', '< 1.3' if RUBY_VERSION < '1.9.3' # rack-cache 1.3.0 only supports >= 1.9.3
|
40
|
+
RB
|
39
41
|
|
40
|
-
gemfile <<-RB
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
RB
|
42
|
+
gemfile <<-RB
|
43
|
+
gem 'rails', '~>3.2.22.2'
|
44
|
+
gem 'i18n', '~>0.6.11'
|
45
|
+
gem 'sinatra', '~> 1.4.5'
|
46
|
+
gem 'haml', '4.0.2' # Getting load issues with haml 4.0.3
|
47
|
+
gem 'minitest_tu_shim', :require => false
|
48
|
+
gem 'rack-cache', '< 1.3' if RUBY_VERSION < '1.9.3' # rack-cache 1.3.0 only supports >= 1.9.3
|
49
|
+
RB
|
48
50
|
|
49
|
-
gemfile <<-RB
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
RB
|
51
|
+
gemfile <<-RB
|
52
|
+
gem 'rails', '~>3.1.12'
|
53
|
+
gem 'i18n', '~>0.6.11'
|
54
|
+
gem 'haml', '4.0.2' # Getting load issues with haml 4.0.3
|
55
|
+
gem 'minitest_tu_shim', :require => false
|
56
|
+
gem 'rack-cache', '< 1.3' if RUBY_VERSION < '1.9.3' # rack-cache 1.3.0 only supports >= 1.9.3
|
57
|
+
RB
|
56
58
|
|
57
|
-
gemfile <<-RB
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
RB
|
59
|
+
gemfile <<-RB
|
60
|
+
gem 'rails', '~>3.0.20'
|
61
|
+
gem 'haml', '4.0.2' # Getting load issues with haml 4.0.3
|
62
|
+
gem 'minitest_tu_shim', :require => false
|
63
|
+
gem 'rack-cache', '< 1.3' if RUBY_VERSION < '1.9.3' # rack-cache 1.3.0 only supports >= 1.9.3
|
64
|
+
RB
|
65
|
+
end
|
63
66
|
|
64
67
|
if RUBY_VERSION <= '1.9.3' && (!defined?(RUBY_ENGINE) || RUBY_ENGINE != 'jruby')
|
65
68
|
gemfile <<-RB
|
@@ -72,3 +75,5 @@ if RUBY_VERSION <= '1.9.3' && (!defined?(RUBY_ENGINE) || RUBY_ENGINE != 'jruby')
|
|
72
75
|
gem 'rack-cache', '< 1.3' if RUBY_VERSION < '1.9.3' # rack-cache 1.3.0 only supports >= 1.9.3
|
73
76
|
RB
|
74
77
|
end
|
78
|
+
|
79
|
+
# vim: ft=ruby
|
@@ -12,12 +12,15 @@ RB
|
|
12
12
|
|
13
13
|
# No single Rails version works everywhere, so split it up
|
14
14
|
if RUBY_VERSION >= "1.9.3"
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
if RUBY_VERSION < '2.4.0'
|
16
|
+
gemfile <<-RB
|
17
|
+
gem 'rack'
|
18
|
+
gem 'rake', '~> 10.4'
|
19
|
+
gem 'rails', '~> 4.2.1'
|
20
|
+
gem 'minitest', '5.2.3'
|
21
|
+
gem 'nokogiri', '< 1.7' if RUBY_VERSION < '2.1.0' # nokogiri 1.7.0 only supports >= 2.1.0
|
22
|
+
RB
|
23
|
+
end
|
21
24
|
else
|
22
25
|
gemfile <<-RB
|
23
26
|
gem 'rack'
|
@@ -43,3 +46,5 @@ gemfile <<-RB
|
|
43
46
|
gem 'rake', '~> 10.4'
|
44
47
|
gem 'newrelic-rake', :require => false # Can't coexist with third-party instrumentation
|
45
48
|
RB
|
49
|
+
|
50
|
+
# vim: ft=ruby
|
@@ -26,10 +26,16 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
26
26
|
|
27
27
|
def test_records_metrics_for_connect
|
28
28
|
redis = Redis.new
|
29
|
-
|
29
|
+
|
30
|
+
in_transaction "test_txn" do
|
31
|
+
redis.get("foo")
|
32
|
+
end
|
30
33
|
|
31
34
|
expected = {
|
35
|
+
"test_txn" => { :call_count => 1 },
|
36
|
+
["Datastore/operation/Redis/connect", "test_txn"] => { :call_count => 1 },
|
32
37
|
"Datastore/operation/Redis/connect" => { :call_count => 1 },
|
38
|
+
["Datastore/operation/Redis/get", "test_txn"] => { :call_count => 1 },
|
33
39
|
"Datastore/operation/Redis/get" => { :call_count => 1 },
|
34
40
|
"Datastore/Redis/allOther" => { :call_count => 2 },
|
35
41
|
"Datastore/Redis/all" => { :call_count => 2 },
|
@@ -57,7 +63,9 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
57
63
|
end
|
58
64
|
|
59
65
|
def test_records_metrics_for_set
|
60
|
-
|
66
|
+
in_transaction do
|
67
|
+
@redis.set 'time', 'walk'
|
68
|
+
end
|
61
69
|
|
62
70
|
expected = {
|
63
71
|
"Datastore/operation/Redis/set" => { :call_count => 1 },
|
@@ -86,8 +94,10 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
86
94
|
assert_metrics_recorded(expected)
|
87
95
|
end
|
88
96
|
|
89
|
-
def
|
90
|
-
|
97
|
+
def test_records_metrics_for_get_in_background_txn
|
98
|
+
in_background_transaction do
|
99
|
+
@redis.get 'mox sapphire'
|
100
|
+
end
|
91
101
|
|
92
102
|
expected = {
|
93
103
|
"Datastore/operation/Redis/get" => { :call_count => 1 },
|
@@ -139,12 +149,16 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
139
149
|
end
|
140
150
|
|
141
151
|
def test_records_metrics_for_pipelined_commands
|
142
|
-
|
143
|
-
@redis.
|
144
|
-
|
152
|
+
in_transaction 'test_txn' do
|
153
|
+
@redis.pipelined do
|
154
|
+
@redis.get 'great log'
|
155
|
+
@redis.get 'late log'
|
156
|
+
end
|
145
157
|
end
|
146
158
|
|
147
159
|
expected = {
|
160
|
+
"test_txn" => { :call_count => 1 },
|
161
|
+
["Datastore/operation/Redis/pipeline", "test_txn"] => { :call_count => 1 },
|
148
162
|
"Datastore/operation/Redis/pipeline" => { :call_count => 1 },
|
149
163
|
"Datastore/Redis/allOther" => { :call_count => 1 },
|
150
164
|
"Datastore/Redis/all" => { :call_count => 1 },
|
@@ -170,12 +184,16 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
170
184
|
end
|
171
185
|
|
172
186
|
def test_records_metrics_for_multi_blocks
|
173
|
-
|
174
|
-
@redis.
|
175
|
-
|
187
|
+
in_transaction 'test_txn' do
|
188
|
+
@redis.multi do
|
189
|
+
@redis.get 'darkpact'
|
190
|
+
@redis.get 'chaos orb'
|
191
|
+
end
|
176
192
|
end
|
177
193
|
|
178
194
|
expected = {
|
195
|
+
"test_txn" => { :call_count => 1 },
|
196
|
+
["Datastore/operation/Redis/multi", "test_txn"] => { :call_count => 1 },
|
179
197
|
"Datastore/operation/Redis/multi" => { :call_count => 1 },
|
180
198
|
"Datastore/Redis/allOther" => { :call_count => 1 },
|
181
199
|
"Datastore/Redis/all" => { :call_count => 1 },
|
@@ -279,8 +297,9 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
279
297
|
def test_records_unknown_unknown_metric_when_error_gathering_instance_data
|
280
298
|
redis = Redis.new
|
281
299
|
redis.client.stubs(:path).raises StandardError.new
|
282
|
-
|
283
|
-
|
300
|
+
in_transaction do
|
301
|
+
redis.get("foo")
|
302
|
+
end
|
284
303
|
|
285
304
|
assert_metrics_recorded('Datastore/instance/Redis/unknown/unknown')
|
286
305
|
end
|