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
@@ -63,9 +63,11 @@ namespace :newrelic do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def lookup_changelog
|
66
|
-
debug "Retrieving changelog for New Relic Deployment details"
|
67
66
|
previous_revision = fetch(:previous_revision)
|
68
67
|
current_revision = fetch(:current_revision)
|
68
|
+
return unless current_revision && previous_revision
|
69
|
+
|
70
|
+
debug "Retrieving changelog for New Relic Deployment details"
|
69
71
|
|
70
72
|
if scm == :git
|
71
73
|
log_command = "git --no-pager log --no-color --pretty=format:' * %an: %s' " +
|
data/lib/new_relic/version.rb
CHANGED
data/lib/tasks/multiverse.rb
CHANGED
@@ -37,14 +37,34 @@
|
|
37
37
|
|
38
38
|
namespace :test do
|
39
39
|
desc "Run functional test suite for New Relic"
|
40
|
-
task :multiverse, [:suite, :param1, :param2, :param3, :param4] => [] do |
|
41
|
-
|
42
|
-
|
40
|
+
task :multiverse, [:suite, :param1, :param2, :param3, :param4] => ['multiverse:env'] do |_, args|
|
41
|
+
Multiverse::Runner.run(args.suite, Multiverse::Runner.parse_args(args))
|
42
|
+
end
|
43
|
+
|
44
|
+
namespace :multiverse do
|
45
|
+
|
46
|
+
task :env do
|
47
|
+
# ENV['SUITES_DIRECTORY'] = File.expand_path('../../test/multiverse/suites', __FILE__)
|
48
|
+
require File.expand_path('../../../test/multiverse/lib/multiverse', __FILE__)
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "Clean cached gemfiles from Bundler.bundle_path"
|
52
|
+
task :clean_gemfile_cache do
|
53
|
+
glob = File.expand_path 'multiverse-cache/Gemfile.*.lock', Bundler.bundle_path
|
54
|
+
File.delete(*Dir[glob])
|
55
|
+
end
|
56
|
+
|
57
|
+
desc "Test the multiverse testing framework by executing tests in test/multiverse/test. Get meta with it."
|
58
|
+
task :self, [:suite, :mode] do |_, args|
|
59
|
+
args.with_defaults(:suite => "", :mode => "")
|
60
|
+
puts ("Testing the multiverse testing framework...")
|
61
|
+
test_files = FileList['test/multiverse/test/*_test.rb']
|
62
|
+
ruby test_files.join(" ")
|
63
|
+
end
|
43
64
|
|
44
|
-
|
45
|
-
|
65
|
+
task :prime, [:suite] => [:env] do |_, args|
|
66
|
+
Multiverse::Runner.prime(args.suite, Multiverse::Runner.parse_args(args))
|
67
|
+
end
|
46
68
|
|
47
|
-
opts = Multiverse::Runner.parse_args(args)
|
48
|
-
Multiverse::Runner.run(args.suite, opts)
|
49
69
|
end
|
50
70
|
end
|
@@ -0,0 +1,32 @@
|
|
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
|
+
require 'fileutils'
|
6
|
+
|
7
|
+
module Multiverse
|
8
|
+
|
9
|
+
# <ruby_agent>/test/multiverse
|
10
|
+
#
|
11
|
+
ROOT = File.expand_path '../..', __FILE__
|
12
|
+
|
13
|
+
# append <ruby_agent>/test/multiverse/lib to the load path
|
14
|
+
#
|
15
|
+
$: << File.expand_path('lib', ROOT)
|
16
|
+
|
17
|
+
# append <ruby_agent>/test/new_relic to the load path
|
18
|
+
# ... to share fake_collector
|
19
|
+
#
|
20
|
+
$: << File.expand_path('../new_relic', ROOT)
|
21
|
+
|
22
|
+
# suites dir from env var, default to <ruby_agent>/test/multiverse/suites
|
23
|
+
#
|
24
|
+
SUITES_DIRECTORY = ENV['SUITES_DIRECTORY'] || File.expand_path('suites', ROOT)
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
require 'multiverse/color'
|
29
|
+
require 'multiverse/output_collector'
|
30
|
+
require 'multiverse/runner'
|
31
|
+
require 'multiverse/envfile'
|
32
|
+
require 'multiverse/suite'
|
@@ -85,13 +85,13 @@ module Multiverse
|
|
85
85
|
"agent" => ["agent_only", "bare", "config_file_loading",
|
86
86
|
"deferred_instrumentation", "high_security", "no_json"],
|
87
87
|
"api" => ["grape"],
|
88
|
-
"background" => ["delayed_job", "
|
88
|
+
"background" => ["delayed_job", "sidekiq"],
|
89
89
|
"database" => ["datamapper", "mongo", "redis", "sequel"],
|
90
90
|
"httpclients" => ["curb", "excon", "httpclient", "typhoeus", "net_http", "httprb"],
|
91
91
|
"rails" => ["active_record", "rails"],
|
92
92
|
"serialization" => ["json", "marshalling", "yajl"],
|
93
93
|
"sinatra" => ["sinatra", "padrino"],
|
94
|
-
"
|
94
|
+
"background_2" => ["rake", "resque"],
|
95
95
|
|
96
96
|
"rest" => [] # Specially handled below
|
97
97
|
}
|
@@ -11,8 +11,8 @@ require 'base64'
|
|
11
11
|
require 'fileutils'
|
12
12
|
require 'digest'
|
13
13
|
|
14
|
-
require File.expand_path
|
15
|
-
require File.expand_path
|
14
|
+
require File.expand_path '../../multiverse', __FILE__
|
15
|
+
require File.expand_path '../shell_utils', __FILE__
|
16
16
|
|
17
17
|
module Multiverse
|
18
18
|
class Suite
|
@@ -20,7 +20,7 @@ module Multiverse
|
|
20
20
|
attr_accessor :directory, :opts
|
21
21
|
|
22
22
|
def initialize(directory, opts={})
|
23
|
-
self.directory = directory
|
23
|
+
self.directory = File.expand_path directory
|
24
24
|
self.opts = opts
|
25
25
|
ENV["VERBOSE"] = '1' if opts[:verbose]
|
26
26
|
end
|
@@ -63,12 +63,17 @@ module Multiverse
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def clean_gemfiles(env_index)
|
66
|
-
|
67
|
-
|
66
|
+
gemfiles = ["Gemfile.#{env_index}", "Gemfile.#{env_index}.lock"]
|
67
|
+
gemfiles.each {|f| File.delete(f) if File.exist?(f)}
|
68
68
|
end
|
69
69
|
|
70
70
|
def envfile_path
|
71
|
-
File.
|
71
|
+
ep = File.expand_path 'Envfile'
|
72
|
+
if !File.exist?(ep)
|
73
|
+
ep = File.expand_path 'Envfile', directory
|
74
|
+
raise "#{ep} not found" unless File.exist?(ep)
|
75
|
+
end
|
76
|
+
ep
|
72
77
|
end
|
73
78
|
|
74
79
|
def environments
|
@@ -136,14 +141,6 @@ module Multiverse
|
|
136
141
|
"Gemfile.#{suite}.#{env_index}.#{envfile_hash}.lock"
|
137
142
|
end
|
138
143
|
|
139
|
-
def cache_gemfile_lock(env_index)
|
140
|
-
filename = cached_gemfile_lock_filename(env_index)
|
141
|
-
dst_path = File.join(bundler_cache_dir, filename)
|
142
|
-
src_path = File.join(directory, "Gemfile.#{env_index}.lock")
|
143
|
-
puts "Caching Gemfile.lock from #{src_path} to #{dst_path}" if verbose?
|
144
|
-
FileUtils.cp(src_path, dst_path)
|
145
|
-
end
|
146
|
-
|
147
144
|
def ensure_bundle_cached(env_index)
|
148
145
|
cache_dir = bundler_cache_dir
|
149
146
|
FileUtils.mkdir_p(cache_dir)
|
@@ -164,7 +161,6 @@ module Multiverse
|
|
164
161
|
bundler_out = exclusive_bundle
|
165
162
|
puts bundler_out if verbose? || $? != 0
|
166
163
|
raise "bundle command failed with (#{$?})" unless $? == 0
|
167
|
-
cache_gemfile_lock(env_index) if use_cache?
|
168
164
|
end
|
169
165
|
|
170
166
|
def generate_gemfile(gemfile_text, env_index, local = true)
|
@@ -236,7 +232,22 @@ module Multiverse
|
|
236
232
|
end
|
237
233
|
|
238
234
|
def minitest_line
|
239
|
-
"gem 'minitest', '~>
|
235
|
+
"gem 'minitest', '~> #{minitest_version}', :require => false"
|
236
|
+
end
|
237
|
+
|
238
|
+
def minitest_version
|
239
|
+
case
|
240
|
+
when RUBY_VERSION >= '2.4'
|
241
|
+
'5.10.1'
|
242
|
+
else
|
243
|
+
'4.7.5'
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
def require_minitest
|
248
|
+
require 'minitest'
|
249
|
+
rescue LoadError
|
250
|
+
require 'minitest/unit'
|
240
251
|
end
|
241
252
|
|
242
253
|
# rake 11 dropped support for ruby < 1.9.3
|
@@ -266,18 +277,28 @@ module Multiverse
|
|
266
277
|
# https://github.com/bundler/bundler/pull/4650 or with a better solution
|
267
278
|
# in mutiverse.
|
268
279
|
def pin_json_version_if_needed gemfile_text
|
269
|
-
return if suite == "json" || suite == "no_json" ||
|
270
|
-
RUBY_VERSION >= "2.0.0" &&
|
280
|
+
return if suite == "json" || suite == "no_json" || suite == "datamapper" ||
|
281
|
+
RUBY_VERSION >= "2.0.0" && RUBY_VERSION < "2.4.0" &&
|
282
|
+
!pin_json_for_jruby?
|
271
283
|
|
272
|
-
match = gemfile_text.match(/^\s*?(gem\s*?
|
284
|
+
match = gemfile_text.match(/^\s*?(gem\s*?['"]json['"]).*?$/)
|
285
|
+
version = json_version
|
273
286
|
if match
|
274
|
-
version = '< 2.0.0'
|
275
287
|
return if match[0].include? version
|
276
288
|
|
277
289
|
replacement = match[0].gsub(match[1], "#{match[1]}, '#{version}'")
|
278
290
|
gemfile_text.gsub! match[0], replacement
|
279
291
|
else
|
280
|
-
gemfile_text.concat "\ngem 'json', '
|
292
|
+
gemfile_text.concat "\ngem 'json', '#{version}'\n"
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
def json_version
|
297
|
+
case
|
298
|
+
when RUBY_VERSION >= '2.4'
|
299
|
+
'~> 2.0.2'
|
300
|
+
else
|
301
|
+
'< 2.0.0'
|
281
302
|
end
|
282
303
|
end
|
283
304
|
|
@@ -488,7 +509,7 @@ module Multiverse
|
|
488
509
|
end
|
489
510
|
|
490
511
|
def configure_child_environment
|
491
|
-
|
512
|
+
require_minitest
|
492
513
|
patch_minitest_base_for_old_versions
|
493
514
|
prevent_minitest_auto_run
|
494
515
|
require_mocha
|
@@ -19,7 +19,7 @@ if RUBY_VERSION >= '2.2.2' && RUBY_PLATFORM != 'java'
|
|
19
19
|
RB
|
20
20
|
end
|
21
21
|
|
22
|
-
if RUBY_VERSION >= '1.9.3'
|
22
|
+
if RUBY_VERSION >= '1.9.3' && RUBY_VERSION < '2.4.0'
|
23
23
|
gemfile <<-RB
|
24
24
|
gem 'activerecord', '~> 4.2.0'
|
25
25
|
gem 'minitest', '~> 5.2.3'
|
@@ -83,3 +83,5 @@ gemfile <<-RB
|
|
83
83
|
#{boilerplate_gems}
|
84
84
|
RB
|
85
85
|
end
|
86
|
+
|
87
|
+
# vim: ft=ruby
|
@@ -1,3 +1,5 @@
|
|
1
|
+
suite_condition("only test on < 2.4"){ RUBY_VERSION < '2.4.0' }
|
2
|
+
|
1
3
|
gemfile <<-RB
|
2
4
|
gem 'activemerchant', '~>1.43.1'
|
3
5
|
gem 'rack'
|
@@ -33,4 +35,6 @@ gemfile <<-RB
|
|
33
35
|
|
34
36
|
# Need to load newrelic_rpm after ActiveMerchant Gateways are required
|
35
37
|
gem 'newrelic_rpm', :require => false, :path => File.expand_path('../../../../')
|
36
|
-
RB
|
38
|
+
RB
|
39
|
+
|
40
|
+
# vim: ft=ruby
|
@@ -7,9 +7,9 @@ require 'new_relic/cli/command'
|
|
7
7
|
|
8
8
|
class DeploymentTest < Minitest::Test
|
9
9
|
def setup
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
@rpm_site ||= NewRelic::FakeRpmSite.new
|
11
|
+
@rpm_site.reset
|
12
|
+
@rpm_site.run
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_deploys_to_configured_application
|
@@ -35,17 +35,14 @@ class DeploymentTest < Minitest::Test
|
|
35
35
|
assert_deployment_value("changelog", "The greatest weakness of most humans is their hesitancy to tell others they love them while they're alive.")
|
36
36
|
end
|
37
37
|
|
38
|
-
def test_newrelic_revision_override
|
39
|
-
end
|
40
|
-
|
41
38
|
def assert_deployment_value(key, value)
|
42
|
-
assert_equal(1,
|
43
|
-
assert_equal(value,
|
39
|
+
assert_equal(1, @rpm_site.requests.count)
|
40
|
+
assert_equal(value, @rpm_site.requests.first["deployment"][key])
|
44
41
|
end
|
45
42
|
|
46
43
|
def cap_it(custom_env={})
|
47
44
|
cmd = "cap production newrelic:notice_deployment"
|
48
|
-
default_env = { 'FAKE_RPM_SITE_PORT' =>
|
45
|
+
default_env = { 'FAKE_RPM_SITE_PORT' => @rpm_site.port.to_s }
|
49
46
|
output = with_environment(default_env.merge(custom_env)) do
|
50
47
|
`#{cmd}`
|
51
48
|
end
|
@@ -6,9 +6,9 @@ require 'fake_rpm_site'
|
|
6
6
|
|
7
7
|
class DeploymentTest < Minitest::Test
|
8
8
|
def setup
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
@rpm_site ||= NewRelic::FakeRpmSite.new
|
10
|
+
@rpm_site.reset
|
11
|
+
@rpm_site.run
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_deploys_to_configured_application
|
@@ -23,13 +23,13 @@ class DeploymentTest < Minitest::Test
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def assert_deployment_value(key, value)
|
26
|
-
assert_equal(1,
|
27
|
-
assert_equal(value,
|
26
|
+
assert_equal(1, @rpm_site.requests.count)
|
27
|
+
assert_equal(value, @rpm_site.requests.first["deployment"][key])
|
28
28
|
end
|
29
29
|
|
30
30
|
def cap_it(options="")
|
31
31
|
cmd = "cap newrelic:notice_deployment #{options}"
|
32
|
-
output = with_environment('FAKE_RPM_SITE_PORT' =>
|
32
|
+
output = with_environment('FAKE_RPM_SITE_PORT' => @rpm_site.port.to_s) do
|
33
33
|
`#{cmd}`
|
34
34
|
end
|
35
35
|
assert $?.success?, "cap command '#{cmd}' failed with output: #{output}"
|
@@ -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 'curb'
|
@@ -107,8 +107,7 @@ class CurbTest < Minitest::Test
|
|
107
107
|
# end
|
108
108
|
|
109
109
|
def test_doesnt_propagate_errors_in_instrumentation
|
110
|
-
NewRelic::Agent::CrossAppTracing.stubs(
|
111
|
-
raises( StandardError, "something bad happened" )
|
110
|
+
NewRelic::Agent::CrossAppTracing.stubs(:cross_app_enabled?).raises("Booom")
|
112
111
|
|
113
112
|
res = Curl::Easy.http_get( default_url )
|
114
113
|
|
@@ -32,121 +32,161 @@ class DataMapperTest < Minitest::Test
|
|
32
32
|
# calls the instance #save method, so that's all we see on that version.
|
33
33
|
expected_metric = DataMapper::VERSION < "1.1" ? :save : :create
|
34
34
|
assert_basic_metrics(expected_metric) do
|
35
|
-
|
35
|
+
in_transaction do
|
36
|
+
Post.create(:title => "Dummy post", :body => "whatever, man")
|
37
|
+
end
|
36
38
|
end
|
37
39
|
end
|
38
40
|
|
39
41
|
def test_create!
|
40
42
|
assert_basic_metrics(:create) do
|
41
|
-
|
43
|
+
in_transaction do
|
44
|
+
Post.create!(:title => "Dummy post", :body => "whatever, man")
|
45
|
+
end
|
42
46
|
end
|
43
47
|
end
|
44
48
|
|
45
49
|
def test_get
|
46
50
|
assert_against_record(:get) do |post|
|
47
|
-
|
51
|
+
in_transaction do
|
52
|
+
Post.get(post.id)
|
53
|
+
end
|
48
54
|
end
|
49
55
|
end
|
50
56
|
|
51
57
|
def test_get!
|
52
58
|
assert_against_record(:get) do |post|
|
53
|
-
|
59
|
+
in_transaction do
|
60
|
+
Post.get!(post.id)
|
61
|
+
end
|
54
62
|
end
|
55
63
|
end
|
56
64
|
|
57
65
|
def test_first
|
58
66
|
assert_against_record(:first) do
|
59
|
-
|
67
|
+
in_transaction do
|
68
|
+
Post.first
|
69
|
+
end
|
60
70
|
end
|
61
71
|
end
|
62
72
|
|
63
73
|
def test_all
|
64
74
|
assert_against_record(:all) do
|
65
|
-
|
75
|
+
in_transaction do
|
76
|
+
Post.all
|
77
|
+
end
|
66
78
|
end
|
67
79
|
end
|
68
80
|
|
69
81
|
def test_last
|
70
82
|
assert_against_record(:last) do
|
71
|
-
|
83
|
+
in_transaction do
|
84
|
+
Post.last
|
85
|
+
end
|
72
86
|
end
|
73
87
|
end
|
74
88
|
|
75
89
|
def test_bulk_update
|
76
90
|
assert_against_record(:update) do
|
77
|
-
|
91
|
+
in_transaction do
|
92
|
+
Post.update(:title => 'other title')
|
93
|
+
end
|
78
94
|
end
|
79
95
|
end
|
80
96
|
|
81
97
|
def test_bulk_update!
|
82
98
|
assert_against_record(:update) do
|
83
|
-
|
99
|
+
in_transaction do
|
100
|
+
Post.update!(:title => 'other title')
|
101
|
+
end
|
84
102
|
end
|
85
103
|
end
|
86
104
|
|
87
105
|
def test_instance_update
|
88
106
|
assert_against_record(:update) do |post|
|
89
|
-
|
107
|
+
in_transaction do
|
108
|
+
post.update(:title => 'other title')
|
109
|
+
end
|
90
110
|
end
|
91
111
|
end
|
92
112
|
|
93
113
|
def test_bulk_update!
|
94
114
|
assert_against_record(:update) do |post|
|
95
|
-
|
115
|
+
in_transaction do
|
116
|
+
post.update!(:title => 'other title')
|
117
|
+
end
|
96
118
|
end
|
97
119
|
end
|
98
120
|
|
99
121
|
def test_bulk_destroy
|
100
122
|
assert_against_record(:destroy) do
|
101
|
-
|
123
|
+
in_transaction do
|
124
|
+
Post.destroy
|
125
|
+
end
|
102
126
|
end
|
103
127
|
end
|
104
128
|
|
105
129
|
def test_bulk_destroy!
|
106
130
|
assert_against_record(:destroy) do
|
107
|
-
|
131
|
+
in_transaction do
|
132
|
+
Post.destroy!
|
133
|
+
end
|
108
134
|
end
|
109
135
|
end
|
110
136
|
|
111
137
|
def test_instance_destroy
|
112
138
|
assert_against_record(:destroy) do |post|
|
113
|
-
|
139
|
+
in_transaction do
|
140
|
+
post.destroy
|
141
|
+
end
|
114
142
|
end
|
115
143
|
end
|
116
144
|
|
117
145
|
def test_instance_destroy!
|
118
146
|
assert_against_record(:destroy) do |post|
|
119
|
-
|
147
|
+
in_transaction do
|
148
|
+
post.destroy!
|
149
|
+
end
|
120
150
|
end
|
121
151
|
end
|
122
152
|
|
123
153
|
def test_save
|
124
154
|
assert_against_record(:save) do |post|
|
125
|
-
|
155
|
+
in_transaction do
|
156
|
+
post.save
|
157
|
+
end
|
126
158
|
end
|
127
159
|
end
|
128
160
|
|
129
161
|
def test_save!
|
130
162
|
assert_against_record(:save) do |post|
|
131
|
-
|
163
|
+
in_transaction do
|
164
|
+
post.save!
|
165
|
+
end
|
132
166
|
end
|
133
167
|
end
|
134
168
|
|
135
169
|
def test_aggregate
|
136
170
|
assert_against_record(:aggregate) do
|
137
|
-
|
171
|
+
in_transaction do
|
172
|
+
Post.aggregate(:title, :all.count)
|
173
|
+
end
|
138
174
|
end
|
139
175
|
end
|
140
176
|
|
141
177
|
def test_find
|
142
178
|
assert_against_record(:find) do
|
143
|
-
|
179
|
+
in_transaction do
|
180
|
+
Post.find(1)
|
181
|
+
end
|
144
182
|
end
|
145
183
|
end
|
146
184
|
|
147
185
|
def test_find_by_sql
|
148
186
|
assert_against_record(:find_by_sql) do
|
149
|
-
|
187
|
+
in_transaction do
|
188
|
+
Post.find_by_sql('select * from posts')
|
189
|
+
end
|
150
190
|
end
|
151
191
|
end
|
152
192
|
|
@@ -168,25 +208,33 @@ class DataMapperTest < Minitest::Test
|
|
168
208
|
|
169
209
|
def test_collection_get
|
170
210
|
assert_against_record(:get) do
|
171
|
-
|
211
|
+
in_transaction do
|
212
|
+
Post.all.get(1)
|
213
|
+
end
|
172
214
|
end
|
173
215
|
end
|
174
216
|
|
175
217
|
def test_collection_first
|
176
218
|
assert_against_record(:first) do
|
177
|
-
|
219
|
+
in_transaction do
|
220
|
+
Post.all.first
|
221
|
+
end
|
178
222
|
end
|
179
223
|
end
|
180
224
|
|
181
225
|
def test_collection_last
|
182
226
|
assert_against_record(:last) do
|
183
|
-
|
227
|
+
in_transaction do
|
228
|
+
Post.all.last
|
229
|
+
end
|
184
230
|
end
|
185
231
|
end
|
186
232
|
|
187
233
|
def test_collection_all
|
188
234
|
assert_against_record(:all) do
|
189
|
-
|
235
|
+
in_transaction do
|
236
|
+
Post.all.all # sic
|
237
|
+
end
|
190
238
|
end
|
191
239
|
|
192
240
|
assert_metrics_recorded(
|
@@ -196,49 +244,65 @@ class DataMapperTest < Minitest::Test
|
|
196
244
|
|
197
245
|
def test_collection_lazy_load
|
198
246
|
assert_against_record(:lazy_load) do
|
199
|
-
|
247
|
+
in_transaction do
|
248
|
+
Post.all.send(:lazy_load)
|
249
|
+
end
|
200
250
|
end
|
201
251
|
end
|
202
252
|
|
203
253
|
def test_collection_create
|
204
254
|
assert_against_record(:create) do
|
205
|
-
|
255
|
+
in_transaction do
|
256
|
+
Post.all.create(:title => "The Title", :body => "Body")
|
257
|
+
end
|
206
258
|
end
|
207
259
|
end
|
208
260
|
|
209
261
|
def test_collection_create!
|
210
262
|
assert_against_record(:create) do
|
211
|
-
|
263
|
+
in_transaction do
|
264
|
+
Post.all.create!(:title => "The Title", :body => "Body")
|
265
|
+
end
|
212
266
|
end
|
213
267
|
end
|
214
268
|
|
215
269
|
def test_collection_update
|
216
270
|
assert_against_record(:update) do
|
217
|
-
|
271
|
+
in_transaction do
|
272
|
+
Post.all.update(:title => "Another")
|
273
|
+
end
|
218
274
|
end
|
219
275
|
end
|
220
276
|
|
221
277
|
def test_collection_update!
|
222
278
|
assert_against_record(:update) do
|
223
|
-
|
279
|
+
in_transaction do
|
280
|
+
Post.all.update!(:title => "Another")
|
281
|
+
end
|
224
282
|
end
|
225
283
|
end
|
226
284
|
|
227
285
|
def test_collection_destroy
|
228
286
|
assert_against_record(:destroy) do
|
229
|
-
|
287
|
+
in_transaction do
|
288
|
+
Post.all.destroy
|
289
|
+
end
|
230
290
|
end
|
231
291
|
end
|
232
292
|
|
233
293
|
def test_collection_destroy!
|
234
294
|
assert_against_record(:destroy) do
|
235
|
-
|
295
|
+
in_transaction do
|
296
|
+
Post.all.destroy!
|
297
|
+
end
|
236
298
|
end
|
237
299
|
end
|
238
300
|
|
239
301
|
def test_collection_aggregate
|
240
302
|
assert_against_record(:aggregate) do
|
241
|
-
|
303
|
+
in_transaction do
|
304
|
+
Post.all.aggregate(:title, :all.count)
|
305
|
+
end
|
242
306
|
end
|
243
307
|
end
|
244
308
|
|
@@ -282,8 +346,10 @@ class DataMapperTest < Minitest::Test
|
|
282
346
|
end
|
283
347
|
|
284
348
|
def test_datamapper_transaction_commit
|
285
|
-
|
286
|
-
Post.
|
349
|
+
in_transaction do
|
350
|
+
Post.transaction do |t|
|
351
|
+
Post.destroy!
|
352
|
+
end
|
287
353
|
end
|
288
354
|
|
289
355
|
assert_metrics_recorded([
|
@@ -315,7 +381,9 @@ class DataMapperTest < Minitest::Test
|
|
315
381
|
invalid_query = "select * from users where password='Slurms McKenzie' limit 1"
|
316
382
|
with_config(:'slow_sql.record_sql' => 'obfuscated') do
|
317
383
|
begin
|
318
|
-
|
384
|
+
in_transaction do
|
385
|
+
DataMapper.repository.adapter.select(invalid_query)
|
386
|
+
end
|
319
387
|
rescue => e
|
320
388
|
NewRelic::Agent.notice_error(e)
|
321
389
|
end
|
@@ -326,7 +394,9 @@ class DataMapperTest < Minitest::Test
|
|
326
394
|
|
327
395
|
def test_splice_user_password_from_sqlerror
|
328
396
|
begin
|
329
|
-
|
397
|
+
in_transaction do
|
398
|
+
DataMapper.repository.adapter.select("select * from users")
|
399
|
+
end
|
330
400
|
rescue => e
|
331
401
|
NewRelic::Agent.notice_error(e)
|
332
402
|
end
|