newrelic_rpm 3.14.3.313 → 3.15.0.314

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +20 -6
  3. data/CHANGELOG +31 -0
  4. data/README.md +1 -1
  5. data/lib/new_relic/agent/configuration/default_source.rb +31 -29
  6. data/lib/new_relic/agent/database/obfuscation_helpers.rb +1 -1
  7. data/lib/new_relic/agent/instrumentation/active_job.rb +7 -1
  8. data/lib/new_relic/agent/instrumentation/active_record_4.rb +1 -1
  9. data/lib/new_relic/agent/instrumentation/data_mapper.rb +1 -1
  10. data/lib/new_relic/agent/instrumentation/grape.rb +1 -1
  11. data/lib/new_relic/agent/instrumentation/memcache.rb +1 -1
  12. data/lib/new_relic/agent/instrumentation/rails5/action_controller.rb +29 -0
  13. data/lib/new_relic/agent/instrumentation/rails5/action_view.rb +25 -0
  14. data/lib/new_relic/agent/instrumentation/rails_middleware.rb +2 -2
  15. data/lib/new_relic/agent/supported_versions.rb +1 -0
  16. data/lib/new_relic/agent/system_info.rb +1 -1
  17. data/lib/new_relic/control/frameworks/rails5.rb +14 -0
  18. data/lib/new_relic/version.rb +2 -2
  19. data/lib/tasks/config.rake +15 -23
  20. data/lib/tasks/tests.rake +1 -1
  21. data/newrelic.yml +1 -1
  22. data/newrelic_rpm.gemspec +2 -2
  23. data/test/environments/lib/environments/runner.rb +10 -6
  24. data/test/environments/rails40/Gemfile +1 -1
  25. data/test/environments/rails40/config/database.yml +1 -1
  26. data/test/environments/rails41/Gemfile +1 -1
  27. data/test/environments/rails41/config/database.yml +1 -1
  28. data/test/environments/rails42/Gemfile +1 -1
  29. data/test/environments/rails42/config/database.yml +1 -1
  30. data/test/environments/rails50/Gemfile +36 -0
  31. data/test/environments/rails50/Rakefile +11 -0
  32. data/test/environments/rails50/config/application.rb +18 -0
  33. data/test/environments/rails50/config/boot.rb +10 -0
  34. data/test/environments/rails50/config/database.yml +26 -0
  35. data/test/environments/rails50/config/environment.rb +6 -0
  36. data/test/environments/rails50/db/schema.rb +5 -0
  37. data/test/fixtures/cross_agent_tests/sql_obfuscation/sql_obfuscation.json +55 -27
  38. data/test/multiverse/suites/active_record/Envfile +14 -2
  39. data/test/multiverse/suites/active_record/active_record_test.rb +1 -1
  40. data/test/multiverse/suites/active_record/config/database.yml +8 -5
  41. data/test/multiverse/suites/datamapper/datamapper_test.rb +2 -1
  42. data/test/multiverse/suites/grape/Envfile +1 -1
  43. data/test/multiverse/suites/rails/Envfile +8 -0
  44. data/test/multiverse/suites/rails/error_tracing_test.rb +13 -0
  45. data/test/new_relic/agent/system_info_test.rb +6 -0
  46. data/test/new_relic/agent/transaction_test.rb +14 -14
  47. data/test/new_relic/agent/utilization_data_test.rb +9 -0
  48. metadata +14 -4
@@ -1,14 +1,25 @@
1
1
  boilerplate_gems = <<-BOILERPLATE
2
2
  gem 'rack'
3
3
  gem 'rake'
4
+ gem 'i18n', '< 0.7.0' if RUBY_VERSION < '1.9.3' # i18n >= 0.7.0 only works on Ruby 1.9.3 and newer
5
+
4
6
  if RUBY_PLATFORM == 'java'
5
7
  gem "activerecord-jdbcmysql-adapter"
6
- else
8
+ elsif RUBY_VERSION <= '1.9.3'
7
9
  gem 'mysql'
10
+ else
11
+ gem 'mysql2', '~> 0.3.20'
8
12
  end
9
- gem 'i18n', '< 0.7.0' if RUBY_VERSION < '1.9.3' # i18n >= 0.7.0 only works on Ruby 1.9.3 and newer
10
13
  BOILERPLATE
11
14
 
15
+ if RUBY_VERSION >= '2.2.2' && RUBY_PLATFORM != 'java'
16
+ gemfile <<-RB
17
+ gem 'activerecord', '~> 5.0.0beta2'
18
+ gem 'minitest', '~> 5.2.3'
19
+ #{boilerplate_gems}
20
+ RB
21
+ end
22
+
12
23
  if RUBY_VERSION >= '1.9.3'
13
24
  gemfile <<-RB
14
25
  gem 'activerecord', '~> 4.2.0'
@@ -45,6 +56,7 @@ if RUBY_VERSION < '2.2.0'
45
56
 
46
57
  gemfile <<-RB
47
58
  gem 'activerecord', '~> 3.0.20'
59
+ gem 'activerecord-mysql2-adapter' if RUBY_PLATFORM != 'java'
48
60
  #{boilerplate_gems}
49
61
  RB
50
62
  end
@@ -473,7 +473,7 @@ class ActiveRecordInstrumentationTest < Minitest::Test
473
473
  statement = node.params[:sql]
474
474
  assert_match(/^SELECT /, statement.sql)
475
475
 
476
- assert_equal(adapter, statement.adapter)
476
+ assert_match(statement.adapter.to_s, adapter.to_s)
477
477
  refute_nil(statement.config)
478
478
  refute_nil(statement.explainer)
479
479
  end
@@ -1,9 +1,12 @@
1
1
  mysql: &mysql
2
- <% if defined?(JRuby) %>
3
- adapter: jdbcmysql
4
- <% else %>
5
- adapter: mysql
6
- <% end %>
2
+ adapter: <%=
3
+ if defined?(JRuby)
4
+ 'jdbcmysql'
5
+ elsif RUBY_VERSION <= '1.9.3'
6
+ 'mysql'
7
+ else
8
+ 'mysql2'
9
+ end %>
7
10
  socket: <%= (`uname -s` =~ /Linux/ ) ? "" :"/tmp/mysql.sock" %>
8
11
  username: root
9
12
  host: localhost
@@ -331,7 +331,8 @@ class DataMapperTest < Minitest::Test
331
331
  NewRelic::Agent.notice_error(e)
332
332
  end
333
333
 
334
- refute last_traced_error.message.include?('&password=')
334
+ refute last_traced_error.message.include?('&password='),
335
+ "error message expected not to contain '&password=' but did: #{last_traced_error && last_traced_error.message}"
335
336
  end
336
337
 
337
338
  def assert_against_record(operation)
@@ -2,7 +2,7 @@ suite_condition("Grape is only supported for versions >= 1.9.3") do
2
2
  RUBY_VERSION >= '1.9.3'
3
3
  end
4
4
 
5
- versions = %w(0.9.0 0.8.0 0.7.0 0.6.1 0.5.0 0.4.1 0.3.2 0.2.6 0.2.0 0.1.5)
5
+ versions = %w(0.14.0 0.13.0 0.12.0 0.11.0 0.10.0 0.9.0 0.8.0 0.7.0 0.6.1 0.5.0 0.4.1 0.3.2 0.2.6 0.2.0 0.1.5)
6
6
 
7
7
  versions.each do |version|
8
8
  gemfile <<-RB
@@ -1,3 +1,11 @@
1
+ if RUBY_VERSION >= '2.2.2' && RUBY_PLATFORM != 'java'
2
+ gemfile <<-RB
3
+ gem 'rails', '~>5.0.0beta2'
4
+ gem 'haml', :require => false
5
+ gem 'minitest', '5.2.3'
6
+ RB
7
+ end
8
+
1
9
  if RUBY_VERSION >= '1.9.3'
2
10
  gemfile <<-RB
3
11
  gem 'rails', '~>4.2.1'
@@ -52,6 +52,11 @@ class ErrorController < ApplicationController
52
52
  end
53
53
 
54
54
  def noticed_error
55
+ NewRelic::Agent.notice_error(RuntimeError.new('this error should be noticed'))
56
+ render :text => "Shoulda noticed an error"
57
+ end
58
+
59
+ def deprecated_noticed_error
55
60
  newrelic_notice_error(RuntimeError.new('this error should be noticed'))
56
61
  render :text => "Shoulda noticed an error"
57
62
  end
@@ -145,6 +150,14 @@ class ErrorsWithoutSSCTest < RailsMultiverseTest
145
150
  'Controller/error/model_error')
146
151
  end
147
152
 
153
+ if Rails::VERSION::MAJOR < 5
154
+ def test_should_capture_deprecated_noticed_error_in_controller
155
+ get '/error/deprecated_noticed_error'
156
+ assert_error_reported_once('this error should be noticed',
157
+ 'Controller/error/deprecated_noticed_error')
158
+ end
159
+ end
160
+
148
161
  def test_should_capture_noticed_error_in_controller
149
162
  get '/error/noticed_error'
150
163
  assert_error_reported_once('this error should be noticed',
@@ -90,6 +90,12 @@ class NewRelic::Agent::SystemInfoTest < Minitest::Test
90
90
  assert_nil @sysinfo.parse_linux_meminfo_in_mib("")
91
91
  end
92
92
 
93
+ def test_ram_in_mb_nil_when_proc_meminfo_unreadable
94
+ NewRelic::Agent::SystemInfo.stubs(:ruby_os_identifier).returns("linux")
95
+ NewRelic::Agent::SystemInfo.expects(:proc_try_read).with('/proc/meminfo').returns(nil)
96
+ assert_nil NewRelic::Agent::SystemInfo.ram_in_mib, "Expected ram_in_mib to be nil"
97
+ end
98
+
93
99
  def test_system_info_darwin_predicate
94
100
  NewRelic::Agent::SystemInfo.stubs(:ruby_os_identifier).returns("darwin13")
95
101
  assert NewRelic::Agent::SystemInfo.darwin?, "Expected OS to match darwin"
@@ -1293,10 +1293,10 @@ class NewRelic::Agent::TransactionTest < Minitest::Test
1293
1293
  end
1294
1294
 
1295
1295
  def test_assigns_synthetics_to_intrinsic_attributes
1296
- txn = in_transaction do |txn|
1297
- txn.raw_synthetics_header = ""
1298
- txn.synthetics_payload = [1, 1, 100, 200, 300]
1299
- txn
1296
+ txn = in_transaction do |t|
1297
+ t.raw_synthetics_header = ""
1298
+ t.synthetics_payload = [1, 1, 100, 200, 300]
1299
+ t
1300
1300
  end
1301
1301
 
1302
1302
  result = txn.attributes.intrinsic_attributes_for(NewRelic::Agent::AttributeFilter::DST_TRANSACTION_TRACER)
@@ -1307,7 +1307,7 @@ class NewRelic::Agent::TransactionTest < Minitest::Test
1307
1307
 
1308
1308
 
1309
1309
  def test_intrinsic_attributes_include_gc_time
1310
- txn = in_transaction do |txn|
1310
+ txn = in_transaction do |t|
1311
1311
  NewRelic::Agent::StatsEngine::GCProfiler.stubs(:record_delta).returns(10.0)
1312
1312
  end
1313
1313
 
@@ -1320,9 +1320,9 @@ class NewRelic::Agent::TransactionTest < Minitest::Test
1320
1320
 
1321
1321
  NewRelic::Agent.instance.cross_app_monitor.stubs(:client_referring_transaction_trip_id).returns('PDX-NRT')
1322
1322
 
1323
- txn = in_transaction do |txn|
1323
+ txn = in_transaction do |t|
1324
1324
  NewRelic::Agent::TransactionState.tl_get.is_cross_app_caller = true
1325
- guid = txn.guid
1325
+ guid = t.guid
1326
1326
  end
1327
1327
 
1328
1328
  result = txn.attributes.intrinsic_attributes_for(NewRelic::Agent::AttributeFilter::DST_TRANSACTION_TRACER)
@@ -1343,10 +1343,10 @@ class NewRelic::Agent::TransactionTest < Minitest::Test
1343
1343
  def test_intrinsic_attributes_include_path_hash
1344
1344
  path_hash = nil
1345
1345
 
1346
- txn = in_transaction do |txn|
1346
+ txn = in_transaction do |t|
1347
1347
  state = NewRelic::Agent::TransactionState.tl_get
1348
1348
  state.is_cross_app_caller = true
1349
- path_hash = txn.cat_path_hash(state)
1349
+ path_hash = t.cat_path_hash(state)
1350
1350
  end
1351
1351
 
1352
1352
  result = txn.attributes.intrinsic_attributes_for(NewRelic::Agent::AttributeFilter::DST_TRANSACTION_TRACER)
@@ -1354,9 +1354,9 @@ class NewRelic::Agent::TransactionTest < Minitest::Test
1354
1354
  end
1355
1355
 
1356
1356
  def test_synthetics_attributes_not_included_if_not_valid_synthetics_request
1357
- txn = in_transaction do |txn|
1358
- txn.raw_synthetics_header = nil
1359
- txn.synthetics_payload = nil
1357
+ txn = in_transaction do |t|
1358
+ t.raw_synthetics_header = nil
1359
+ t.synthetics_payload = nil
1360
1360
  end
1361
1361
 
1362
1362
  result = txn.attributes.intrinsic_attributes_for(NewRelic::Agent::AttributeFilter::DST_TRANSACTION_TRACER)
@@ -1366,8 +1366,8 @@ class NewRelic::Agent::TransactionTest < Minitest::Test
1366
1366
  end
1367
1367
 
1368
1368
  def test_intrinsic_attributes_include_cpu_time
1369
- txn = in_transaction do |txn|
1370
- txn.stubs(:cpu_burn).returns(22.0)
1369
+ txn = in_transaction do |t|
1370
+ t.stubs(:cpu_burn).returns(22.0)
1371
1371
  end
1372
1372
 
1373
1373
  result = txn.attributes.intrinsic_attributes_for(NewRelic::Agent::AttributeFilter::DST_TRANSACTION_TRACER)
@@ -132,6 +132,15 @@ module NewRelic::Agent
132
132
  assert_equal 128, utilization_data.to_collector_hash[:total_ram_mib]
133
133
  end
134
134
 
135
+ def test_memory_is_nil_when_proc_meminfo_is_unreadable
136
+ NewRelic::Agent::SystemInfo.stubs(:ruby_os_identifier).returns("linux")
137
+ NewRelic::Agent::SystemInfo.stubs(:proc_try_read).returns(nil)
138
+
139
+ utilization_data = UtilizationData.new
140
+
141
+ assert_nil utilization_data.to_collector_hash[:total_ram_mib], "Expected total_ram_mib to be nil"
142
+ end
143
+
135
144
  def test_metadata_version_is_present_in_collector_hash
136
145
  utilization_data = UtilizationData.new
137
146
 
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: 3.14.3.313
4
+ version: 3.15.0.314
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Krajcar
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-02-05 00:00:00.000000000 Z
14
+ date: 2016-02-11 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -187,7 +187,7 @@ description: |
187
187
  information about the performance of your web application as it runs
188
188
  in production. The New Relic Ruby Agent is dual-purposed as a either a
189
189
  Gem or plugin, hosted on
190
- http://github.com/newrelic/rpm/
190
+ https://github.com/newrelic/rpm/
191
191
  email: support@newrelic.com
192
192
  executables:
193
193
  - mongrel_rpm
@@ -326,6 +326,8 @@ files:
326
326
  - lib/new_relic/agent/instrumentation/rails4/action_controller.rb
327
327
  - lib/new_relic/agent/instrumentation/rails4/action_view.rb
328
328
  - lib/new_relic/agent/instrumentation/rails4/errors.rb
329
+ - lib/new_relic/agent/instrumentation/rails5/action_controller.rb
330
+ - lib/new_relic/agent/instrumentation/rails5/action_view.rb
329
331
  - lib/new_relic/agent/instrumentation/rails_middleware.rb
330
332
  - lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb
331
333
  - lib/new_relic/agent/instrumentation/rake.rb
@@ -427,6 +429,7 @@ files:
427
429
  - lib/new_relic/control/frameworks/rails.rb
428
430
  - lib/new_relic/control/frameworks/rails3.rb
429
431
  - lib/new_relic/control/frameworks/rails4.rb
432
+ - lib/new_relic/control/frameworks/rails5.rb
430
433
  - lib/new_relic/control/frameworks/ruby.rb
431
434
  - lib/new_relic/control/frameworks/sinatra.rb
432
435
  - lib/new_relic/control/instance_methods.rb
@@ -563,6 +566,13 @@ files:
563
566
  - test/environments/rails42/config/database.yml
564
567
  - test/environments/rails42/config/environment.rb
565
568
  - test/environments/rails42/db/schema.rb
569
+ - test/environments/rails50/Gemfile
570
+ - test/environments/rails50/Rakefile
571
+ - test/environments/rails50/config/application.rb
572
+ - test/environments/rails50/config/boot.rb
573
+ - test/environments/rails50/config/database.yml
574
+ - test/environments/rails50/config/environment.rb
575
+ - test/environments/rails50/db/schema.rb
566
576
  - test/fixtures/cross_agent_tests/README.md
567
577
  - test/fixtures/cross_agent_tests/attribute_configuration.json
568
578
  - test/fixtures/cross_agent_tests/aws.json
@@ -1299,7 +1309,7 @@ files:
1299
1309
  - vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_frontend.rb
1300
1310
  - vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_service.rb
1301
1311
  - vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_transaction.rb
1302
- homepage: http://www.github.com/newrelic/rpm
1312
+ homepage: https://github.com/newrelic/rpm
1303
1313
  licenses:
1304
1314
  - New Relic
1305
1315
  - MIT