newrelic_rpm 3.9.6.257 → 3.9.7.266

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data.tar.gz.sig +0 -0
  2. data/CHANGELOG +45 -0
  3. data/lib/new_relic/agent.rb +0 -1
  4. data/lib/new_relic/agent/agent.rb +61 -22
  5. data/lib/new_relic/agent/agent_logger.rb +11 -9
  6. data/lib/new_relic/agent/configuration/default_source.rb +25 -2
  7. data/lib/new_relic/agent/cross_app_monitor.rb +15 -53
  8. data/lib/new_relic/agent/cross_app_tracing.rb +11 -3
  9. data/lib/new_relic/agent/custom_event_aggregator.rb +98 -0
  10. data/lib/new_relic/agent/event_buffer.rb +84 -0
  11. data/lib/new_relic/agent/harvester.rb +4 -15
  12. data/lib/new_relic/agent/hostname.rb +1 -9
  13. data/lib/new_relic/agent/inbound_request_monitor.rb +41 -0
  14. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +2 -2
  15. data/lib/new_relic/agent/instrumentation/queue_time.rb +0 -5
  16. data/lib/new_relic/agent/instrumentation/resque.rb +4 -9
  17. data/lib/new_relic/agent/javascript_instrumentor.rb +0 -12
  18. data/lib/new_relic/agent/method_tracer_helpers.rb +3 -1
  19. data/lib/new_relic/agent/new_relic_service.rb +1 -1
  20. data/lib/new_relic/agent/sampled_buffer.rb +13 -41
  21. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +52 -24
  22. data/lib/new_relic/agent/sized_buffer.rb +23 -0
  23. data/lib/new_relic/agent/synthetics_monitor.rb +50 -0
  24. data/lib/new_relic/agent/system_info.rb +28 -0
  25. data/lib/new_relic/agent/transaction.rb +78 -9
  26. data/lib/new_relic/agent/transaction/synthetics_sample_buffer.rb +25 -0
  27. data/lib/new_relic/agent/{request_sampler.rb → transaction_event_aggregator.rb} +53 -19
  28. data/lib/new_relic/agent/transaction_sample_builder.rb +3 -1
  29. data/lib/new_relic/agent/transaction_sampler.rb +10 -0
  30. data/lib/new_relic/agent/transaction_state.rb +1 -9
  31. data/lib/new_relic/coerce.rb +8 -2
  32. data/lib/new_relic/control.rb +0 -1
  33. data/lib/new_relic/local_environment.rb +12 -8
  34. data/lib/new_relic/metric_spec.rb +11 -2
  35. data/lib/new_relic/rack/developer_mode.rb +9 -1
  36. data/lib/new_relic/transaction_sample.rb +4 -10
  37. data/lib/new_relic/version.rb +1 -1
  38. data/newrelic_rpm.gemspec +1 -0
  39. data/test/agent_helper.rb +15 -2
  40. data/test/environments/norails/Gemfile +1 -0
  41. data/test/environments/rails21/Gemfile +1 -0
  42. data/test/environments/rails22/Gemfile +1 -0
  43. data/test/environments/rails23/Gemfile +1 -0
  44. data/test/environments/rails30/Gemfile +1 -0
  45. data/test/environments/rails31/Gemfile +1 -0
  46. data/test/environments/rails32/Gemfile +2 -1
  47. data/test/environments/rails40/Gemfile +2 -1
  48. data/test/environments/rails41/Gemfile +3 -1
  49. data/test/environments/rails42/Gemfile +3 -1
  50. data/test/fixtures/cross_agent_tests/README.md +6 -2
  51. data/test/fixtures/cross_agent_tests/docker_container_id/README.md +6 -0
  52. data/test/fixtures/cross_agent_tests/docker_container_id/cases.json +22 -0
  53. data/test/fixtures/cross_agent_tests/docker_container_id/docker-0.9.1.txt +10 -0
  54. data/test/fixtures/cross_agent_tests/docker_container_id/docker-1.0.0.txt +10 -0
  55. data/test/fixtures/cross_agent_tests/docker_container_id/docker-1.3.txt +9 -0
  56. data/test/fixtures/cross_agent_tests/docker_container_id/empty.txt +0 -0
  57. data/test/fixtures/cross_agent_tests/docker_container_id/lxc-containers-without-docker.txt +10 -0
  58. data/test/fixtures/cross_agent_tests/proc_meminfo/README.md +7 -0
  59. data/test/fixtures/cross_agent_tests/proc_meminfo/meminfo_4096MB.txt +47 -0
  60. data/test/fixtures/cross_agent_tests/rum_client_config.json +0 -80
  61. data/test/fixtures/cross_agent_tests/synthetics/synthetics.json +317 -0
  62. data/test/multiverse/lib/multiverse/runner.rb +1 -1
  63. data/test/multiverse/lib/multiverse/suite.rb +1 -0
  64. data/test/multiverse/suites/active_record/Envfile +42 -8
  65. data/test/multiverse/suites/active_record/ar_method_aliasing.rb +8 -4
  66. data/test/multiverse/suites/agent_only/audit_log_test.rb +0 -2
  67. data/test/multiverse/suites/agent_only/collector_exception_handling_test.rb +1 -2
  68. data/test/multiverse/suites/agent_only/cross_application_tracing_test.rb +5 -5
  69. data/test/multiverse/suites/agent_only/encoding_handling_test.rb +2 -0
  70. data/test/multiverse/suites/agent_only/harvest_timestamps_test.rb +8 -0
  71. data/test/multiverse/suites/agent_only/synthetics_test.rb +139 -0
  72. data/test/multiverse/suites/delayed_job/Envfile +79 -0
  73. data/test/multiverse/suites/delayed_job/before_suite.rb +33 -0
  74. data/test/multiverse/suites/delayed_job/config/newrelic.yml +18 -0
  75. data/test/multiverse/suites/delayed_job/delayed_job_sampler_test.rb +131 -0
  76. data/test/multiverse/suites/delayed_job/unsupported_backend_test.rb +24 -0
  77. data/test/multiverse/suites/high_security/high_security_test.rb +3 -10
  78. data/test/multiverse/suites/rails/Envfile +4 -4
  79. data/test/multiverse/suites/rails/request_statistics_test.rb +4 -4
  80. data/test/new_relic/agent/agent_test.rb +32 -4
  81. data/test/new_relic/agent/configuration/default_source_test.rb +6 -0
  82. data/test/new_relic/agent/cross_app_monitor_test.rb +23 -29
  83. data/test/new_relic/agent/custom_event_aggregator_test.rb +88 -0
  84. data/test/new_relic/agent/event_buffer_test_cases.rb +152 -0
  85. data/test/new_relic/agent/harvester_test.rb +5 -25
  86. data/test/new_relic/agent/hostname_test.rb +1 -1
  87. data/test/new_relic/agent/inbound_request_monitor_test.rb +49 -0
  88. data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +9 -9
  89. data/test/new_relic/agent/instrumentation/queue_time_test.rb +0 -19
  90. data/test/new_relic/agent/javascript_instrumentor_test.rb +0 -45
  91. data/test/new_relic/agent/new_relic_service_test.rb +17 -12
  92. data/test/new_relic/agent/pipe_channel_manager_test.rb +4 -4
  93. data/test/new_relic/agent/sampled_buffer_test.rb +73 -145
  94. data/test/new_relic/agent/sized_buffer_test.rb +29 -0
  95. data/test/new_relic/agent/synthetics_monitor_test.rb +96 -0
  96. data/test/new_relic/agent/system_info_test.rb +19 -3
  97. data/test/new_relic/agent/transaction/developer_mode_sample_buffer_test.rb +14 -8
  98. data/test/new_relic/agent/transaction/synthetics_sample_buffer_test.rb +38 -0
  99. data/test/new_relic/agent/{request_sampler_test.rb → transaction_event_aggregator_test.rb} +55 -4
  100. data/test/new_relic/agent/transaction_sampler_test.rb +33 -11
  101. data/test/new_relic/agent/transaction_state_test.rb +0 -1
  102. data/test/new_relic/agent/transaction_test.rb +121 -19
  103. data/test/new_relic/coerce_test.rb +38 -3
  104. data/test/new_relic/control_test.rb +1 -0
  105. data/test/new_relic/fake_collector.rb +6 -2
  106. data/test/new_relic/fake_external_server.rb +2 -6
  107. data/test/new_relic/fake_server.rb +46 -29
  108. data/test/new_relic/http_client_test_cases.rb +71 -2
  109. data/test/new_relic/local_environment_test.rb +78 -0
  110. data/test/new_relic/metric_parser/metric_parser_test.rb +2 -0
  111. data/test/new_relic/metric_spec_test.rb +43 -0
  112. data/test/new_relic/multiverse_helpers.rb +11 -18
  113. data/test/new_relic/rack/browser_monitoring_test.rb +1 -18
  114. data/test/new_relic/rack/developer_mode_test.rb +1 -1
  115. data/test/new_relic/transaction_sample_test.rb +14 -4
  116. data/test/performance/suites/rack_middleware.rb +3 -1
  117. data/test/test_helper.rb +33 -0
  118. metadata +48 -7
  119. metadata.gz.sig +0 -0
  120. data/lib/new_relic/agent/browser_token.rb +0 -41
  121. data/test/multiverse/suites/agent_only/before_suite.rb +0 -7
  122. data/test/new_relic/agent/browser_token_test.rb +0 -56
@@ -0,0 +1,38 @@
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 File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_helper'))
6
+
7
+ class NewRelic::Agent::Transaction
8
+ class SyntheticsSampleBufferTest < Minitest::Test
9
+ def setup
10
+ @buffer = SyntheticsSampleBuffer.new
11
+ end
12
+
13
+ def test_doesnt_store_if_not_synthetics
14
+ sample = stub(:synthetics_resource_id => nil)
15
+ @buffer.store(sample)
16
+ assert_empty @buffer.samples
17
+ end
18
+
19
+ def test_stores_if_synthetics
20
+ sample = stub(:synthetics_resource_id => 42)
21
+ @buffer.store(sample)
22
+ assert_equal [sample], @buffer.samples
23
+ end
24
+
25
+ def test_applies_limits
26
+ last_sample = nil
27
+
28
+ try_count = @buffer.capacity + 1
29
+ try_count.times do |i|
30
+ last_sample = stub(:synthetics_resource_id => i)
31
+ @buffer.store(last_sample)
32
+ end
33
+
34
+ assert_equal @buffer.capacity, @buffer.samples.length
35
+ refute_includes @buffer.samples, last_sample
36
+ end
37
+ end
38
+ end
@@ -5,14 +5,14 @@
5
5
 
6
6
  require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
7
7
  require File.expand_path(File.join(File.dirname(__FILE__),'..','data_container_tests'))
8
- require 'new_relic/agent/request_sampler'
8
+ require 'new_relic/agent/transaction_event_aggregator'
9
9
 
10
- class NewRelic::Agent::RequestSamplerTest < Minitest::Test
10
+ class NewRelic::Agent::TransactionEventAggregatorTest < Minitest::Test
11
11
 
12
12
  def setup
13
13
  freeze_time
14
14
  @event_listener = NewRelic::Agent::EventListener.new
15
- @sampler = NewRelic::Agent::RequestSampler.new( @event_listener )
15
+ @sampler = NewRelic::Agent::TransactionEventAggregator.new(@event_listener)
16
16
  end
17
17
 
18
18
  # Helpers for DataContainerTests
@@ -207,7 +207,7 @@ class NewRelic::Agent::RequestSamplerTest < Minitest::Test
207
207
  end
208
208
 
209
209
  def test_resets_limits_on_harvest
210
- with_sampler_config( :'request_sampler.max_samples_stored' => 100 ) do
210
+ with_sampler_config( :'analytics_events.max_samples_stored' => 100 ) do
211
211
  50.times { generate_request('before') }
212
212
  samples_before = @sampler.samples
213
213
  assert_equal 50, samples_before.size
@@ -243,6 +243,57 @@ class NewRelic::Agent::RequestSamplerTest < Minitest::Test
243
243
  assert_equal('404', code)
244
244
  end
245
245
 
246
+ def test_synthetics_aggregation_limits
247
+ with_sampler_config(:'synthetics.events_limit' => 10) do
248
+ 20.times do
249
+ generate_request('synthetic', :synthetics_resource_id => 100)
250
+ end
251
+
252
+ assert_equal 10, @sampler.samples.size
253
+ end
254
+ end
255
+
256
+
257
+ def test_merging_synthetics_still_applies_limit
258
+ samples = with_sampler_config(:'synthetics.events_limit' => 20) do
259
+ 20.times do
260
+ generate_request('synthetic', :synthetics_resource_id => 100)
261
+ end
262
+ @sampler.harvest!
263
+ end
264
+
265
+ with_sampler_config(:'synthetics.events_limit' => 10) do
266
+ @sampler.merge!(samples)
267
+ assert_equal 10, @sampler.samples.size
268
+ end
269
+ end
270
+
271
+ def test_synthetics_event_dropped_records_supportability_metrics
272
+ with_sampler_config(:'synthetics.events_limit' => 20) do
273
+ 20.times do
274
+ generate_request('synthetic', :synthetics_resource_id => 100)
275
+ end
276
+
277
+ @sampler.harvest!
278
+
279
+ metric = 'Supportability/TransactionEventAggregator/synthetics_events_dropped'
280
+ assert_metrics_not_recorded(metric)
281
+ end
282
+ end
283
+
284
+ def test_synthetics_event_dropped_records_supportability_metrics
285
+ with_sampler_config(:'synthetics.events_limit' => 10) do
286
+ 20.times do
287
+ generate_request('synthetic', :synthetics_resource_id => 100)
288
+ end
289
+
290
+ @sampler.harvest!
291
+
292
+ metric = 'Supportability/TransactionEventAggregator/synthetics_events_dropped'
293
+ assert_metrics_recorded(metric => { :call_count => 10 })
294
+ end
295
+ end
296
+
246
297
  #
247
298
  # Helpers
248
299
  #
@@ -42,6 +42,7 @@ class NewRelic::Agent::TransactionSamplerTest < Minitest::Test
42
42
  :custom_parameters => {},
43
43
  :cat_trip_id => '',
44
44
  :cat_path_hash => '',
45
+ :is_synthetics_request? => false,
45
46
  :filtered_params => {} )
46
47
  end
47
48
 
@@ -614,17 +615,6 @@ class NewRelic::Agent::TransactionSamplerTest < Minitest::Test
614
615
  end
615
616
  end
616
617
 
617
- def test_stack_trace_scope
618
- with_config(:'transaction_tracer.stack_trace_threshold' => 0) do
619
- t = Time.now
620
- @sampler.on_start_transaction(@state, t.to_f)
621
- @sampler.notice_push_frame(@state, (t+1).to_f)
622
-
623
- segment = @sampler.send(:tl_builder).current_segment
624
- assert segment[:backtrace]
625
- end
626
- end
627
-
628
618
  def test_nil_stacktrace
629
619
  with_config(:'transaction_tracer.stack_trace_threshold' => 2) do
630
620
  @sampler.on_start_transaction(@state, Time.now.to_f)
@@ -839,6 +829,38 @@ class NewRelic::Agent::TransactionSamplerTest < Minitest::Test
839
829
  assert_equal path_hash, custom_params_from_last_sample[:'nr.path_hash']
840
830
  end
841
831
 
832
+ def test_synthetics_parameters_not_included_if_not_valid_synthetics_request
833
+ with_config(:'transaction_tracer.transaction_threshold' => 0.0) do
834
+ in_transaction do |txn|
835
+ txn.raw_synthetics_header = nil
836
+ txn.synthetics_payload = nil
837
+ end
838
+ end
839
+
840
+ sample = NewRelic::Agent.agent.transaction_sampler.harvest!.first
841
+
842
+ custom_params = sample.params[:custom_params]
843
+ assert_nil sample.synthetics_resource_id
844
+ assert_nil custom_params[:'nr.synthetics_resource_id']
845
+ assert_nil custom_params[:'nr.synthetics_job_id']
846
+ assert_nil custom_params[:'nr.synthetics_monitor_id']
847
+ end
848
+
849
+ def test_synthetics_parameters_included
850
+ in_transaction do |txn|
851
+ txn.raw_synthetics_header = ""
852
+ txn.synthetics_payload = [1, 1, 100, 200, 300]
853
+ end
854
+
855
+ sample = NewRelic::Agent.agent.transaction_sampler.harvest!.first
856
+
857
+ custom_params = sample.params[:custom_params]
858
+ assert_equal 100, sample.synthetics_resource_id
859
+ assert_equal 100, custom_params[:'nr.synthetics_resource_id']
860
+ assert_equal 200, custom_params[:'nr.synthetics_job_id']
861
+ assert_equal 300, custom_params[:'nr.synthetics_monitor_id']
862
+ end
863
+
842
864
  class Dummy
843
865
  include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation
844
866
  def run(n)
@@ -100,7 +100,6 @@ module NewRelic::Agent
100
100
  state.is_cross_app_caller = true
101
101
  state.client_cross_app_id = :client_cross_app_id
102
102
  state.referring_transaction_info = :referring_transaction_info
103
- state.request_token = :request_token
104
103
  state.busy_entries = 1
105
104
  state.sql_sampler_transaction_data = Object.new
106
105
  state.transaction_sample_builder = Object.new
@@ -343,24 +343,6 @@ class NewRelic::Agent::TransactionTest < Minitest::Test
343
343
  refute found_guid
344
344
  end
345
345
 
346
- def test_end_fires_a_transaction_finished_event_with_guid_if_request_token_and_too_long
347
- guid = nil
348
- NewRelic::Agent.subscribe(:transaction_finished) do |payload|
349
- guid = payload[:guid]
350
- end
351
-
352
- with_config(:apdex_t => 2.0) do
353
- freeze_time
354
- in_transaction do
355
- state = NewRelic::Agent::TransactionState.tl_get
356
- state.request_token = 'token'
357
- advance_time 4.0
358
- end
359
- end
360
-
361
- refute_empty guid
362
- end
363
-
364
346
  def test_end_fires_a_transaction_finished_event_with_guid_if_referring_transaction
365
347
  guid = nil
366
348
  NewRelic::Agent.subscribe(:transaction_finished) do |payload|
@@ -438,6 +420,23 @@ class NewRelic::Agent::TransactionTest < Minitest::Test
438
420
  end
439
421
  end
440
422
 
423
+ def test_guid_in_finish_event_payload_if_incoming_synthetics_header
424
+ keys = []
425
+ NewRelic::Agent.subscribe(:transaction_finished) do |payload|
426
+ keys = payload.keys
427
+ end
428
+
429
+ raw_synthetics_header = 'dummy data'
430
+ synthetics_payload = [123, 456, 789, 111]
431
+
432
+ in_transaction do |txn|
433
+ txn.raw_synthetics_header = raw_synthetics_header
434
+ txn.synthetics_payload = synthetics_payload
435
+ end
436
+
437
+ assert_includes keys, :guid
438
+ end
439
+
441
440
  def test_cross_app_fields_in_finish_event_payload
442
441
  keys = []
443
442
  NewRelic::Agent.subscribe(:transaction_finished) do |payload|
@@ -464,7 +463,6 @@ class NewRelic::Agent::TransactionTest < Minitest::Test
464
463
  advance_time(10)
465
464
 
466
465
  state = NewRelic::Agent::TransactionState.tl_get
467
- state.request_token = 'token'
468
466
  state.is_cross_app_caller = false
469
467
  end
470
468
 
@@ -472,6 +470,73 @@ class NewRelic::Agent::TransactionTest < Minitest::Test
472
470
  refute_includes keys, :cat_path_hash
473
471
  end
474
472
 
473
+ def test_is_not_synthetic_request_without_payload
474
+ in_transaction do |txn|
475
+ txn.raw_synthetics_header = ""
476
+ refute txn.is_synthetics_request?
477
+ end
478
+ end
479
+
480
+ def test_is_not_synthetic_request_without_header
481
+ in_transaction do |txn|
482
+ txn.synthetics_payload = [1,2,3,4,5]
483
+ refute txn.is_synthetics_request?
484
+ end
485
+ end
486
+
487
+ def test_is_synthetic_request
488
+ in_transaction do |txn|
489
+ txn.raw_synthetics_header = ""
490
+ txn.synthetics_payload = [1,2,3,4,5]
491
+ assert txn.is_synthetics_request?
492
+ end
493
+ end
494
+
495
+ def test_synthetics_accessors
496
+ in_transaction do
497
+ state = NewRelic::Agent::TransactionState.tl_get
498
+ txn = state.current_transaction
499
+ txn.synthetics_payload = [1,2,3,4,5]
500
+
501
+ assert_equal 1, txn.synthetics_version
502
+ assert_equal 2, txn.synthetics_account_id
503
+ assert_equal 3, txn.synthetics_resource_id
504
+ assert_equal 4, txn.synthetics_job_id
505
+ assert_equal 5, txn.synthetics_monitor_id
506
+ end
507
+ end
508
+
509
+ def test_synthetics_fields_in_finish_event_payload
510
+ keys = []
511
+ NewRelic::Agent.subscribe(:transaction_finished) do |payload|
512
+ keys = payload.keys
513
+ end
514
+
515
+ in_transaction do |txn|
516
+ txn.raw_synthetics_header = "something"
517
+ txn.synthetics_payload = [1, 1, 100, 200, 300]
518
+ end
519
+
520
+ assert_includes keys, :synthetics_resource_id
521
+ assert_includes keys, :synthetics_job_id
522
+ assert_includes keys, :synthetics_monitor_id
523
+ end
524
+
525
+ def test_synthetics_fields_not_in_finish_event_payload_if_no_cross_app_calls
526
+ keys = []
527
+ NewRelic::Agent.subscribe(:transaction_finished) do |payload|
528
+ keys = payload.keys
529
+ end
530
+
531
+ in_transaction do |txn|
532
+ # Make totally sure we're not synthetic
533
+ txn.raw_synthetics_header = nil
534
+ end
535
+
536
+ refute_includes keys, :synthetics_resource_id
537
+ refute_includes keys, :synthetics_job_id
538
+ refute_includes keys, :synthetics_monitor_id
539
+ end
475
540
  def test_logs_warning_if_a_non_hash_arg_is_passed_to_add_custom_params
476
541
  expects_logging(:warn, includes("add_custom_parameters"))
477
542
  in_transaction do
@@ -947,6 +1012,43 @@ class NewRelic::Agent::TransactionTest < Minitest::Test
947
1012
  end
948
1013
  end
949
1014
 
1015
+ def test_doesnt_record_queue_time_if_it_is_zero
1016
+ in_transaction('boo') do
1017
+ # nothing
1018
+ end
1019
+ assert_metrics_not_recorded(['WebFrontend/QueueTime'])
1020
+ end
1021
+
1022
+ def test_doesnt_record_scoped_queue_time_metric
1023
+ t0 = freeze_time
1024
+ advance_time 10.0
1025
+ in_transaction('boo', :apdex_start_time => t0) do
1026
+ # nothing
1027
+ end
1028
+ assert_metrics_recorded('WebFrontend/QueueTime' => { :call_count => 1, :total_call_time => 10.0 })
1029
+ assert_metrics_not_recorded(
1030
+ [['WebFrontend/QueueTime', 'boo']]
1031
+ )
1032
+ end
1033
+
1034
+ def test_doesnt_record_crazy_high_queue_times
1035
+ t0 = freeze_time(Time.at(10.0))
1036
+ advance_time(40 * 365 * 24 * 60 * 60) # 40 years
1037
+ in_transaction('boo', :apdex_start_time => t0) do
1038
+ # nothing
1039
+ end
1040
+ assert_metrics_not_recorded(['WebFrontend/QueueTime'])
1041
+ end
1042
+
1043
+ def test_background_transactions_with_ignore_rules_are_ok
1044
+ with_config(:'rules.ignore_url_regexes' => ['foobar']) do
1045
+ in_transaction('foo') do
1046
+ end
1047
+ end
1048
+
1049
+ assert_metrics_recorded(['foo'])
1050
+ end
1051
+
950
1052
  def assert_has_custom_parameter(txn, key, value = key)
951
1053
  assert_equal(value, txn.custom_parameters[key])
952
1054
  end
@@ -104,11 +104,46 @@ class CoerceTest < Minitest::Test
104
104
  )
105
105
  end
106
106
 
107
- def test_event_params_coerce_only_allow_values_that_are_strings_symbols_floats_or_ints
107
+ def test_event_params_coerce_only_allow_values_that_are_strings_symbols_floats_or_ints_or_bools
108
108
  assert_equal(
109
- {'foo' => 1.0, 'bar' => 2, 'bang' => 'woot', 'ok' => 'dokey'},
109
+ {
110
+ 'foo' => 1.0,
111
+ 'bar' => 2,
112
+ 'bang' => 'woot',
113
+ 'ok' => 'dokey',
114
+ 'truthy' => true,
115
+ 'falsy' => false
116
+ },
110
117
  event_params(
111
- {'foo' => 1.0, 'bar' => 2, 'bang' => 'woot', 'ok' => :dokey, 'bad' => [], 'worse' => {}, 'nope' => Rational(1)}
118
+ {
119
+ 'foo' => 1.0,
120
+ 'bar' => 2,
121
+ 'bang' => 'woot',
122
+ 'ok' => :dokey,
123
+ 'bad' => [],
124
+ 'worse' => {},
125
+ 'nope' => Rational(1),
126
+ 'truthy' => true,
127
+ 'falsy' => false
128
+ }
129
+ )
130
+ )
131
+ end
132
+
133
+ def test_event_params_turns_nan_or_infinity_into_null
134
+ assert_equal(
135
+ {
136
+ 'nan' => nil,
137
+ 'inf' => nil,
138
+ 'ninf' => nil
139
+ },
140
+ event_params(
141
+ {
142
+ # Ruby 1.8.7 doesn't have Float::NAN, INFINITY so we have to hack it
143
+ 'nan' => 0.0 / 0.0,
144
+ 'inf' => 1.0 / 0.0,
145
+ 'ninf' => -1.0 / 0.0
146
+ }
112
147
  )
113
148
  )
114
149
  end
@@ -227,5 +227,6 @@ class NewRelic::ControlTest < Minitest::Test
227
227
  NewRelic::Agent.instance.harvest_samplers.clear
228
228
  NewRelic::Agent.instance.instance_variable_set(:@connect_state, :pending)
229
229
  NewRelic::Agent.instance.instance_variable_set(:@worker_thread, nil)
230
+ NewRelic::Agent.instance.harvester.instance_variable_set(:@starting_pid, nil)
230
231
  end
231
232
  end
@@ -54,8 +54,8 @@ module NewRelic
54
54
 
55
55
  attr_accessor :agent_data, :mock
56
56
 
57
- def initialize(ssl=false)
58
- super(DEFAULT_PORT, ssl)
57
+ def initialize
58
+ super(DEFAULT_PORT)
59
59
  @id_counter = 0
60
60
  @mock = {
61
61
  'get_redirect_host' => Response.new(200, {'return_value' => 'localhost'}),
@@ -284,6 +284,10 @@ module NewRelic
284
284
  def xray_id
285
285
  @body[8]
286
286
  end
287
+
288
+ def synthetics_resource_id
289
+ @body[9]
290
+ end
287
291
  end
288
292
 
289
293
  class SubmittedTransactionTraceTree