newrelic_rpm 3.16.0.318 → 3.16.1.320
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +13 -4
- data/CHANGELOG +41 -2
- data/lib/new_relic/agent/database.rb +15 -4
- data/lib/new_relic/agent/database/explain_plan_helpers.rb +2 -1
- data/lib/new_relic/agent/datastores.rb +13 -13
- data/lib/new_relic/agent/datastores/metric_helper.rb +33 -2
- data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +3 -9
- data/lib/new_relic/agent/error_collector.rb +2 -2
- data/lib/new_relic/agent/instrumentation/active_record.rb +9 -19
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +2 -6
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +49 -40
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +29 -23
- data/lib/new_relic/agent/instrumentation/grape.rb +20 -11
- data/lib/new_relic/agent/instrumentation/memcache.rb +8 -10
- data/lib/new_relic/agent/instrumentation/mongo.rb +25 -16
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +14 -19
- data/lib/new_relic/agent/method_tracer_helpers.rb +4 -8
- data/lib/new_relic/agent/sql_sampler.rb +14 -1
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +18 -0
- data/lib/new_relic/agent/supported_versions.rb +2 -3
- data/lib/new_relic/agent/traced_method_stack.rb +7 -1
- data/lib/new_relic/agent/transaction.rb +6 -0
- data/lib/new_relic/agent/transaction/abstract_segment.rb +73 -0
- data/lib/new_relic/agent/transaction/datastore_segment.rb +49 -0
- data/lib/new_relic/agent/transaction/segment.rb +30 -0
- data/lib/new_relic/agent/transaction/tracing.rb +53 -0
- data/lib/new_relic/agent/transaction_sampler.rb +8 -1
- data/lib/new_relic/noticed_error.rb +3 -1
- data/lib/new_relic/version.rb +1 -1
- data/lib/sequel/extensions/newrelic_instrumentation.rb +22 -15
- data/lib/sequel/plugins/newrelic_instrumentation.rb +4 -3
- data/newrelic_rpm.gemspec +1 -9
- data/test/environments/lib/environments/runner.rb +6 -4
- data/test/environments/norails/Gemfile +9 -3
- data/test/environments/rails21/Gemfile +6 -3
- data/test/environments/rails22/Gemfile +5 -2
- data/test/environments/rails23/Gemfile +1 -1
- data/test/environments/rails30/Gemfile +1 -1
- data/test/environments/rails31/Gemfile +1 -1
- data/test/environments/rails32/Gemfile +1 -1
- data/test/environments/rails40/Gemfile +2 -2
- data/test/environments/rails41/Gemfile +2 -2
- data/test/environments/rails42/Gemfile +2 -2
- data/test/environments/rails50/Gemfile +2 -2
- data/test/helpers/mongo_metric_builder.rb +3 -4
- data/test/multiverse/lib/multiverse/shell_utils.rb +27 -0
- data/test/multiverse/lib/multiverse/suite.rb +47 -2
- data/test/multiverse/suites/active_record/Envfile +1 -1
- data/test/multiverse/suites/delayed_job/Envfile +2 -0
- data/test/multiverse/suites/grape/grape_versioning_test.rb +55 -1
- data/test/multiverse/suites/grape/grape_versioning_test_api.rb +61 -3
- data/test/multiverse/suites/mongo/mongo_instrumentation_test.rb +18 -0
- data/test/multiverse/suites/rails/Envfile +3 -3
- data/test/multiverse/suites/rails/error_tracing_test.rb +2 -2
- data/test/multiverse/suites/sequel/Envfile +7 -0
- data/test/multiverse/suites/sequel/sequel_extension_test.rb +1 -1
- data/test/new_relic/agent/database_test.rb +9 -0
- data/test/new_relic/agent/datastores/metric_helper_test.rb +76 -43
- data/test/new_relic/agent/datastores/mongo/metric_translator_test.rb +67 -117
- data/test/new_relic/agent/datastores_test.rb +17 -0
- data/test/new_relic/agent/error_collector_test.rb +21 -5
- data/test/new_relic/agent/instrumentation/active_record_helper_test.rb +40 -45
- data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +2 -3
- data/test/new_relic/agent/instrumentation/mongodb_command_subscriber_test.rb +2 -0
- data/test/new_relic/agent/method_tracer_test.rb +54 -52
- data/test/new_relic/agent/mock_scope_listener.rb +4 -1
- data/test/new_relic/agent/sql_sampler_test.rb +15 -0
- data/test/new_relic/agent/transaction/abstract_segment_test.rb +94 -0
- data/test/new_relic/agent/transaction/datastore_segment_test.rb +99 -0
- data/test/new_relic/agent/transaction/segment_test.rb +53 -0
- data/test/new_relic/agent/transaction/tracing_test.rb +121 -0
- data/test/new_relic/agent/transaction_sampler_test.rb +13 -0
- data/test/new_relic/noticed_error_test.rb +7 -0
- data/test/performance/suites/datastores.rb +59 -0
- data/test/performance/suites/trace_execution_scoped.rb +8 -9
- metadata +13 -46
@@ -23,7 +23,7 @@ end
|
|
23
23
|
# minitest/unit instead via a different path).
|
24
24
|
gem 'minitest', '~>4.7.5', :require => false
|
25
25
|
gem 'mocha', :require => false
|
26
|
-
gem 'rack'
|
26
|
+
gem 'rack', '< 2.0.0'
|
27
27
|
gem 'rack-test'
|
28
28
|
|
29
29
|
platforms :jruby do
|
@@ -39,7 +39,7 @@ end
|
|
39
39
|
|
40
40
|
platforms :rbx do
|
41
41
|
gem "rubysl"
|
42
|
-
gem "json"
|
42
|
+
gem "json", '< 2.0.0'
|
43
43
|
# If we don't skip the require here, test-unit tries to install its at_exit
|
44
44
|
# hook and run when we run our rake task to create the test DB.
|
45
45
|
gem "rubysl-test-unit", :require => false
|
@@ -15,7 +15,7 @@ end
|
|
15
15
|
|
16
16
|
gem 'minitest', '5.2.3'
|
17
17
|
gem 'mocha', :require => false
|
18
|
-
gem 'rack'
|
18
|
+
gem 'rack', '< 2.0.0'
|
19
19
|
gem 'rack-test'
|
20
20
|
|
21
21
|
platforms :jruby do
|
@@ -31,7 +31,7 @@ end
|
|
31
31
|
|
32
32
|
platforms :rbx do
|
33
33
|
gem "rubysl"
|
34
|
-
gem "json"
|
34
|
+
gem "json", '< 2.0.0'
|
35
35
|
# If we don't skip the require here, test-unit tries to install its at_exit
|
36
36
|
# hook and run when we run our rake task to create the test DB.
|
37
37
|
gem "rubysl-test-unit", :require => false
|
@@ -15,7 +15,7 @@ end
|
|
15
15
|
|
16
16
|
gem 'minitest', '5.2.3'
|
17
17
|
gem 'mocha', :require => false
|
18
|
-
gem 'rack'
|
18
|
+
gem 'rack', '< 2.0.0'
|
19
19
|
gem 'rack-test'
|
20
20
|
|
21
21
|
platforms :jruby do
|
@@ -31,7 +31,7 @@ end
|
|
31
31
|
|
32
32
|
platforms :rbx do
|
33
33
|
gem "rubysl"
|
34
|
-
gem "json"
|
34
|
+
gem "json", '< 2.0.0'
|
35
35
|
# If we don't skip the require here, test-unit tries to install its at_exit
|
36
36
|
# hook and run when we run our rake task to create the test DB.
|
37
37
|
gem "rubysl-test-unit", :require => false
|
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
gem 'rake', '< 11'
|
4
4
|
|
5
|
-
gem 'rails', '5.0.
|
5
|
+
gem 'rails', '5.0.0'
|
6
6
|
|
7
7
|
gem 'minitest', '5.2.3'
|
8
8
|
gem 'mocha', :require => false
|
@@ -19,7 +19,7 @@ end
|
|
19
19
|
|
20
20
|
platforms :rbx do
|
21
21
|
gem "rubysl"
|
22
|
-
gem "json"
|
22
|
+
gem "json", '< 2.0.0'
|
23
23
|
# If we don't skip the require here, test-unit tries to install its at_exit
|
24
24
|
# hook and run when we run our rake task to create the test DB.
|
25
25
|
gem "rubysl-test-unit", :require => false
|
@@ -8,10 +8,9 @@ module NewRelic
|
|
8
8
|
module TestHelpers
|
9
9
|
module MongoMetricBuilder
|
10
10
|
def build_test_metrics(name)
|
11
|
-
NewRelic::Agent::Datastores::
|
12
|
-
|
13
|
-
|
14
|
-
)
|
11
|
+
NewRelic::Agent::Datastores::MetricHelper.metrics_for("MongoDB",
|
12
|
+
name,
|
13
|
+
@collection_name)
|
15
14
|
end
|
16
15
|
|
17
16
|
def metrics_with_attributes(metrics, attributes = { :call_count => 1 })
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# This file is distributed under New Relic's license terms.
|
3
|
+
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
|
+
|
5
|
+
module Multiverse
|
6
|
+
module ShellUtils
|
7
|
+
module_function
|
8
|
+
|
9
|
+
def try_command_n_times(cmd, n, wait_time=1)
|
10
|
+
count = 0
|
11
|
+
loop do
|
12
|
+
count += 1
|
13
|
+
result = `#{cmd}`
|
14
|
+
if $?.success?
|
15
|
+
return result
|
16
|
+
elsif count < n
|
17
|
+
sleep wait_time
|
18
|
+
redo
|
19
|
+
else
|
20
|
+
puts "System command: #{cmd} failed #{n} times. Giving up..."
|
21
|
+
return result
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -12,6 +12,7 @@ require 'fileutils'
|
|
12
12
|
require 'digest'
|
13
13
|
|
14
14
|
require File.expand_path(File.join(File.dirname(__FILE__), 'environment'))
|
15
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'shell_utils'))
|
15
16
|
|
16
17
|
module Multiverse
|
17
18
|
class Suite
|
@@ -111,7 +112,7 @@ module Multiverse
|
|
111
112
|
puts "Waiting on '#{bundling_lock_file}' for our chance to bundle" if verbose?
|
112
113
|
f.flock(File::LOCK_EX)
|
113
114
|
puts "Let's get ready to BUNDLE!" if verbose?
|
114
|
-
bundler_out =
|
115
|
+
bundler_out = ShellUtils.try_command_n_times 'bundle install --retry 3', 3
|
115
116
|
end
|
116
117
|
bundler_out
|
117
118
|
end
|
@@ -167,6 +168,9 @@ module Multiverse
|
|
167
168
|
end
|
168
169
|
|
169
170
|
def generate_gemfile(gemfile_text, env_index, local = true)
|
171
|
+
pin_rack_version_if_needed(gemfile_text)
|
172
|
+
pin_json_version_if_needed(gemfile_text)
|
173
|
+
|
170
174
|
gemfile = File.join(Dir.pwd, "Gemfile.#{env_index}")
|
171
175
|
File.open(gemfile,'w') do |f|
|
172
176
|
f.puts ' source "https://rubygems.org"' unless local
|
@@ -177,7 +181,7 @@ module Multiverse
|
|
177
181
|
f.puts minitest_line unless gemfile_text =~ /^\s*gem .minitest[^_]./
|
178
182
|
f.puts rake_line unless gemfile_text =~ /^\s*gem .rake[^_]./ || suite == 'rake'
|
179
183
|
if RUBY_VERSION == "1.8.7"
|
180
|
-
f.puts "gem 'json'" unless gemfile_text =~ /^\s.*gem .json./
|
184
|
+
f.puts "gem 'json', '< 2.0.0'" unless gemfile_text =~ /^\s.*gem .json./
|
181
185
|
end
|
182
186
|
|
183
187
|
rbx_gemfile_lines(f, gemfile_text)
|
@@ -244,6 +248,47 @@ module Multiverse
|
|
244
248
|
end
|
245
249
|
end
|
246
250
|
|
251
|
+
# Rack 2.0 works with Ruby > 2.2.2. Earlier rubies need to pin
|
252
|
+
# their Rack version prior to 2.0
|
253
|
+
def pin_rack_version_if_needed gemfile_text
|
254
|
+
return if suite == "rack"
|
255
|
+
rx = /^\s*?gem\s*?('|")rack('|")\s*?$/
|
256
|
+
if gemfile_text =~ rx && RUBY_VERSION < "2.2.2"
|
257
|
+
gemfile_text.gsub! rx, 'gem "rack", "< 2.0.0"'
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
# JSON gem version 2.0.0 requires Ruby ~> 2.0. We need to pin
|
262
|
+
# the json version for older rubies. In some cases json is pulled
|
263
|
+
# in by other libraries without pinning the version. For older rubies
|
264
|
+
# we will preemptively require json with an appropriate version. None of
|
265
|
+
# this is ideal and should be fixed, either by this PR to bundler:
|
266
|
+
# https://github.com/bundler/bundler/pull/4650 or with a better solution
|
267
|
+
# in mutiverse.
|
268
|
+
def pin_json_version_if_needed gemfile_text
|
269
|
+
return if suite == "json" || suite == "no_json" ||
|
270
|
+
RUBY_VERSION >= "2.0.0" && !pin_json_for_jruby?
|
271
|
+
|
272
|
+
match = gemfile_text.match(/^\s*?(gem\s*?('|")json('|")).*?$/)
|
273
|
+
if match
|
274
|
+
version = '< 2.0.0'
|
275
|
+
return if match[0].include? version
|
276
|
+
|
277
|
+
replacement = match[0].gsub(match[1], "#{match[1]}, '#{version}'")
|
278
|
+
gemfile_text.gsub! match[0], replacement
|
279
|
+
else
|
280
|
+
gemfile_text.concat "\ngem 'json', '< 2.0.0'\n"
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
# Bundler does not seem to be able to find version 2.0.1 of the json
|
285
|
+
# gem for jruby 9000. This is likely a temporary situation and we
|
286
|
+
# can probably remove this check in the near future. For now we need
|
287
|
+
# this for CI to pass.
|
288
|
+
def pin_json_for_jruby?
|
289
|
+
defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby' && RUBY_VERSION >= "2.0.0"
|
290
|
+
end
|
291
|
+
|
247
292
|
def print_environment
|
248
293
|
puts yellow("Environment loaded with:") if verbose?
|
249
294
|
gems = Bundler.definition.specs.inject([]) do |m, s|
|
@@ -82,6 +82,7 @@ if RUBY_VERSION >= '1.9.3'
|
|
82
82
|
RB
|
83
83
|
end
|
84
84
|
|
85
|
+
if RUBY_VERSION < '2.3.0'
|
85
86
|
[dj4_with_active_record, dj3_with_active_record, dj2_with_active_record3].each do |dj|
|
86
87
|
gemfile <<-RB
|
87
88
|
gem 'activerecord', '~> 3.2.19'
|
@@ -101,6 +102,7 @@ end
|
|
101
102
|
#{dj}
|
102
103
|
RB
|
103
104
|
end
|
105
|
+
end
|
104
106
|
|
105
107
|
if RUBY_VERSION <= '1.9.3'
|
106
108
|
gemfile <<-RB
|
@@ -47,12 +47,24 @@ unless ::Grape::VERSION == '0.1.5'
|
|
47
47
|
end
|
48
48
|
|
49
49
|
#version from http accept header is not supported in older versions of grape
|
50
|
-
if NewRelic::VersionNumber.new(Grape::VERSION) >= NewRelic::VersionNumber.new('
|
50
|
+
if NewRelic::VersionNumber.new(Grape::VERSION) >= NewRelic::VersionNumber.new('0.16.0')
|
51
51
|
def test_version_from_accept_version_header_is_recorded_in_transaction_name
|
52
52
|
@app_class = GrapeVersioning::ApiV4
|
53
53
|
get '/fish', {}, 'HTTP_ACCEPT_VERSION' => 'v4'
|
54
54
|
assert_metrics_recorded('Controller/Grape/GrapeVersioning::ApiV4-v4/fish (GET)')
|
55
55
|
end
|
56
|
+
|
57
|
+
def test_version_from_accept_version_header_is_recorded_in_transaction_name_cascading_versions_penultimate
|
58
|
+
@app_class = GrapeVersioning::CascadingAPI
|
59
|
+
get '/fish', {}, 'HTTP_ACCEPT_VERSION' => 'v4'
|
60
|
+
assert_metrics_recorded('Controller/Grape/GrapeVersioning::CascadingAPI-v4/fish (GET)')
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_version_from_accept_version_header_is_recorded_in_transaction_name_cascading_versions_latest
|
64
|
+
@app_class = GrapeVersioning::CascadingAPI
|
65
|
+
get '/fish', {}, 'HTTP_ACCEPT_VERSION' => 'v5'
|
66
|
+
assert_metrics_recorded('Controller/Grape/GrapeVersioning::CascadingAPI-v5/fish (GET)')
|
67
|
+
end
|
56
68
|
end
|
57
69
|
|
58
70
|
def test_app_not_using_versioning_does_not_record_version_in_transaction_name
|
@@ -60,5 +72,47 @@ unless ::Grape::VERSION == '0.1.5'
|
|
60
72
|
get '/fish'
|
61
73
|
assert_metrics_recorded('Controller/Grape/GrapeVersioning::Unversioned/fish (GET)')
|
62
74
|
end
|
75
|
+
|
76
|
+
def test_shared_version_declaration_in_tranasaction_names
|
77
|
+
@app_class = GrapeVersioning::SharedApi
|
78
|
+
%w[ v1 v2 v3 v4 ].each do |v|
|
79
|
+
get "/#{v}/fish"
|
80
|
+
assert_metrics_recorded("Controller/Grape/GrapeVersioning::SharedApi-#{v}/fish (GET)")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_shared_version_block_in_tranasaction_names
|
85
|
+
@app_class = GrapeVersioning::SharedBlockApi
|
86
|
+
%w[ v1 v2 v3 v4 ].each do |v|
|
87
|
+
get "/#{v}/fish"
|
88
|
+
assert_metrics_recorded("Controller/Grape/GrapeVersioning::SharedBlockApi-#{v}/fish (GET)")
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# see instrumentation/grape.rb:41
|
93
|
+
#
|
94
|
+
# <= 0.15 - route.route_version #=> String
|
95
|
+
# >= 0.16 - route.version #=> Array
|
96
|
+
#
|
97
|
+
# defaulting without version/vendor in Accept value does not set rack.env['api.version']
|
98
|
+
#
|
99
|
+
def test_default_header_version_in_tranasaction_names
|
100
|
+
@app_class = GrapeVersioning::DefaultHeaderApi
|
101
|
+
get "/fish", nil, 'HTTP_ACCEPT' => 'application/json'
|
102
|
+
assert_metrics_recorded("Controller/Grape/GrapeVersioning::DefaultHeaderApi-v2|v3/fish (GET)")
|
103
|
+
end
|
104
|
+
|
105
|
+
# :accept_version_header introduced in 0.5
|
106
|
+
#
|
107
|
+
# defaulting with header key/empty value does not set rack.env['api.version']
|
108
|
+
#
|
109
|
+
if NewRelic::VersionNumber.new(Grape::VERSION) >= NewRelic::VersionNumber.new('0.5.0')
|
110
|
+
def test_default_accept_version_header_version_in_tranasaction_names
|
111
|
+
@app_class = GrapeVersioning::DefaultAcceptVersionHeaderApi
|
112
|
+
get "/fish", nil, 'HTTP_ACCEPT_VERSION' => ''
|
113
|
+
assert_metrics_recorded("Controller/Grape/GrapeVersioning::DefaultAcceptVersionHeaderApi-v2|v3/fish (GET)")
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
63
117
|
end
|
64
118
|
end
|
@@ -46,8 +46,8 @@ unless ::Grape::VERSION == '0.1.5'
|
|
46
46
|
|
47
47
|
class ApiV4 < Grape::API
|
48
48
|
#version from http accept header is not supported in older versions of grape
|
49
|
-
if NewRelic::VersionNumber.new(Grape::VERSION) >= NewRelic::VersionNumber.new('
|
50
|
-
version 'v4', :using => :accept_version_header
|
49
|
+
if NewRelic::VersionNumber.new(Grape::VERSION) >= NewRelic::VersionNumber.new('0.16.0')
|
50
|
+
version ['v4', 'v5'], :using => :accept_version_header
|
51
51
|
end
|
52
52
|
|
53
53
|
format :json
|
@@ -59,6 +59,23 @@ unless ::Grape::VERSION == '0.1.5'
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
+
class CascadingAPI < Grape::API
|
63
|
+
#version from http accept header is not supported in older versions of grape
|
64
|
+
if NewRelic::VersionNumber.new(Grape::VERSION) >= NewRelic::VersionNumber.new('0.16.0')
|
65
|
+
version 'v5', :using => :accept_version_header
|
66
|
+
end
|
67
|
+
|
68
|
+
format :json
|
69
|
+
|
70
|
+
resource :fish do
|
71
|
+
get do
|
72
|
+
"api v5"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
mount ApiV4
|
77
|
+
end
|
78
|
+
|
62
79
|
class Unversioned < Grape::API
|
63
80
|
format :json
|
64
81
|
|
@@ -68,5 +85,46 @@ unless ::Grape::VERSION == '0.1.5'
|
|
68
85
|
end
|
69
86
|
end
|
70
87
|
end
|
88
|
+
|
89
|
+
class SharedApi < Grape::API
|
90
|
+
format :json
|
91
|
+
version 'v1', 'v2', 'v3', 'v4'
|
92
|
+
resource :fish do
|
93
|
+
get do
|
94
|
+
"api v1-4"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
class SharedBlockApi < Grape::API
|
100
|
+
format :json
|
101
|
+
version 'v1', 'v2', 'v3', 'v4' do
|
102
|
+
resource :fish do
|
103
|
+
get do
|
104
|
+
"api v1-4"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
class DefaultHeaderApi < Grape::API
|
111
|
+
format :json
|
112
|
+
version 'v2', 'v3', :using => :header, :vendor => "newrelic"
|
113
|
+
resource :fish do
|
114
|
+
get do
|
115
|
+
"api v1-4"
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
class DefaultAcceptVersionHeaderApi < Grape::API
|
121
|
+
format :json
|
122
|
+
version 'v2', 'v3', :using => :accept_version_header
|
123
|
+
resource :fish do
|
124
|
+
get do
|
125
|
+
"api v1-4"
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
71
129
|
end
|
72
|
-
end
|
130
|
+
end
|
@@ -32,6 +32,24 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
32
32
|
NewRelic::Agent.drop_buffered_data
|
33
33
|
end
|
34
34
|
|
35
|
+
def test_mongo_query_succeeds_if_metric_generation_fails
|
36
|
+
NewRelic::Agent::Datastores::Mongo::MetricTranslator.stubs(:operation_and_collection_for).returns(nil)
|
37
|
+
result = @collection.insert(@tribble)
|
38
|
+
refute_nil result
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_ensure_index_succeeds_if_metric_generation_fails
|
42
|
+
NewRelic::Agent::Datastores::Mongo::MetricTranslator.stubs(:operation_and_collection_for).returns(nil)
|
43
|
+
result = @collection.ensure_index(:"field#{SecureRandom.hex(10)}")
|
44
|
+
refute_nil result
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_records_metrics_for_save
|
48
|
+
NewRelic::Agent::Datastores::Mongo::MetricTranslator.stubs(:operation_and_collection_for).returns(nil)
|
49
|
+
result = @collection.save(@tribble)
|
50
|
+
refute_nil result
|
51
|
+
end
|
52
|
+
|
35
53
|
def teardown
|
36
54
|
NewRelic::Agent.drop_buffered_data
|
37
55
|
@database.drop_collection(@collection_name)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
if RUBY_VERSION >= '2.2.2' && RUBY_PLATFORM != 'java'
|
2
2
|
gemfile <<-RB
|
3
|
-
gem 'rails', '5.0.0
|
3
|
+
gem 'rails', '5.0.0'
|
4
4
|
gem 'haml', :require => false
|
5
5
|
gem 'minitest', '5.2.3'
|
6
6
|
RB
|
@@ -30,7 +30,7 @@ if RUBY_VERSION >= '1.9.3'
|
|
30
30
|
end
|
31
31
|
|
32
32
|
gemfile <<-RB
|
33
|
-
gem 'rails', '~>3.2.
|
33
|
+
gem 'rails', '~>3.2.22.2'
|
34
34
|
gem 'i18n', '~>0.6.11'
|
35
35
|
gem 'haml', '4.0.2' # Getting load issues with haml 4.0.3
|
36
36
|
gem 'minitest_tu_shim', :require => false
|
@@ -38,7 +38,7 @@ gemfile <<-RB
|
|
38
38
|
RB
|
39
39
|
|
40
40
|
gemfile <<-RB
|
41
|
-
gem 'rails', '~>3.2.
|
41
|
+
gem 'rails', '~>3.2.22.2'
|
42
42
|
gem 'i18n', '~>0.6.11'
|
43
43
|
gem 'sinatra', '~> 1.4.5'
|
44
44
|
gem 'haml', '4.0.2' # Getting load issues with haml 4.0.3
|