newrelic_rpm 3.9.4.245 → 3.9.5.251

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data.tar.gz.sig +0 -0
  2. data/CHANGELOG +57 -0
  3. data/Guardfile +1 -0
  4. data/lib/new_relic/agent/agent.rb +3 -3
  5. data/lib/new_relic/agent/audit_logger.rb +5 -2
  6. data/lib/new_relic/agent/configuration/default_source.rb +11 -5
  7. data/lib/new_relic/agent/error_collector.rb +14 -1
  8. data/lib/new_relic/agent/hostname.rb +22 -1
  9. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +8 -2
  10. data/lib/new_relic/agent/instrumentation/queue_time.rb +9 -6
  11. data/lib/new_relic/agent/method_tracer.rb +51 -172
  12. data/lib/new_relic/agent/method_tracer_helpers.rb +90 -0
  13. data/lib/new_relic/agent/new_relic_service.rb +33 -11
  14. data/lib/new_relic/agent/new_relic_service/encoders.rb +9 -5
  15. data/lib/new_relic/agent/request_sampler.rb +20 -12
  16. data/lib/new_relic/agent/rules_engine.rb +31 -78
  17. data/lib/new_relic/agent/rules_engine/replacement_rule.rb +76 -0
  18. data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +48 -0
  19. data/lib/new_relic/agent/samplers/cpu_sampler.rb +1 -1
  20. data/lib/new_relic/agent/sql_sampler.rb +39 -10
  21. data/lib/new_relic/agent/stats_engine/metric_stats.rb +1 -0
  22. data/lib/new_relic/agent/stats_engine/stats_hash.rb +7 -13
  23. data/lib/new_relic/agent/system_info.rb +96 -10
  24. data/lib/new_relic/agent/threading/agent_thread.rb +4 -1
  25. data/lib/new_relic/agent/threading/backtrace_node.rb +67 -57
  26. data/lib/new_relic/agent/threading/thread_profile.rb +30 -15
  27. data/lib/new_relic/agent/transaction.rb +11 -4
  28. data/lib/new_relic/environment_report.rb +21 -20
  29. data/lib/new_relic/version.rb +1 -1
  30. data/test/agent_helper.rb +12 -0
  31. data/test/fixtures/cross_agent_tests/README.md +1 -0
  32. data/test/fixtures/cross_agent_tests/proc_cpuinfo/1pack_1core_1logical.txt +3 -0
  33. data/test/fixtures/cross_agent_tests/proc_cpuinfo/1pack_1core_2logical.txt +14 -0
  34. data/test/fixtures/cross_agent_tests/proc_cpuinfo/1pack_2core_2logical.txt +14 -0
  35. data/test/fixtures/cross_agent_tests/proc_cpuinfo/1pack_4core_4logical.txt +28 -0
  36. data/test/fixtures/{proc_cpuinfo.txt → cross_agent_tests/proc_cpuinfo/2pack_12core_24logical.txt} +0 -0
  37. data/test/fixtures/cross_agent_tests/proc_cpuinfo/2pack_20core_40logical.txt +999 -0
  38. data/test/fixtures/cross_agent_tests/proc_cpuinfo/2pack_2core_2logical.txt +51 -0
  39. data/test/fixtures/cross_agent_tests/proc_cpuinfo/2pack_2core_4logical.txt +28 -0
  40. data/test/fixtures/cross_agent_tests/proc_cpuinfo/2pack_4core_4logical.txt +28 -0
  41. data/test/fixtures/cross_agent_tests/proc_cpuinfo/4pack_4core_4logical.txt +103 -0
  42. data/test/fixtures/cross_agent_tests/proc_cpuinfo/8pack_8core_8logical.txt +199 -0
  43. data/test/fixtures/cross_agent_tests/proc_cpuinfo/README.md +24 -0
  44. data/test/fixtures/cross_agent_tests/proc_cpuinfo/Xpack_Xcore_2logical.txt +43 -0
  45. data/test/fixtures/cross_agent_tests/transaction_segment_terms.json +101 -0
  46. data/test/multiverse/lib/multiverse/suite.rb +1 -1
  47. data/test/multiverse/suites/agent_only/agent_run_id_handling_test.rb +40 -0
  48. data/test/multiverse/suites/agent_only/labels_test.rb +9 -14
  49. data/test/multiverse/suites/agent_only/marshaling_test.rb +4 -6
  50. data/test/multiverse/suites/agent_only/rename_rule_test.rb +41 -4
  51. data/test/multiverse/suites/agent_only/set_transaction_name_test.rb +11 -3
  52. data/test/multiverse/suites/config_file_loading/config_file_loading_test.rb +8 -8
  53. data/test/multiverse/suites/rack/example_app.rb +20 -0
  54. data/test/multiverse/suites/rack/http_response_code_test.rb +51 -0
  55. data/test/multiverse/suites/sidekiq/Envfile +13 -6
  56. data/test/multiverse/suites/sidekiq/sidekiq_server.rb +4 -3
  57. data/test/new_relic/agent/audit_logger_test.rb +27 -0
  58. data/test/new_relic/agent/error_collector_test.rb +26 -5
  59. data/test/new_relic/agent/hostname_test.rb +66 -14
  60. data/test/new_relic/agent/instrumentation/action_controller_subscriber_test.rb +8 -12
  61. data/test/new_relic/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb +7 -45
  62. data/test/new_relic/agent/method_tracer_test.rb +52 -1
  63. data/test/new_relic/agent/new_relic_service_test.rb +76 -0
  64. data/test/new_relic/agent/request_sampler_test.rb +7 -0
  65. data/test/new_relic/agent/rules_engine_test.rb +87 -56
  66. data/test/new_relic/agent/sql_sampler_test.rb +50 -14
  67. data/test/new_relic/agent/stats_engine/metric_stats_test.rb +2 -2
  68. data/test/new_relic/agent/stats_engine/samplers_test.rb +1 -1
  69. data/test/new_relic/agent/{stats_hash_test.rb → stats_engine/stats_hash_test.rb} +1 -38
  70. data/test/new_relic/agent/system_info_test.rb +45 -0
  71. data/test/new_relic/agent/threading/agent_thread_test.rb +30 -0
  72. data/test/new_relic/agent/threading/backtrace_node_test.rb +27 -44
  73. data/test/new_relic/agent/threading/thread_profile_test.rb +35 -14
  74. data/test/new_relic/agent/transaction_test.rb +13 -10
  75. data/test/new_relic/environment_report_test.rb +7 -6
  76. data/test/new_relic/fake_collector.rb +10 -6
  77. data/test/new_relic/multiverse_helpers.rb +4 -11
  78. data/test/new_relic/rack/agent_hooks_test.rb +1 -1
  79. data/test/performance/lib/performance/baseline_compare_reporter.rb +24 -7
  80. data/test/performance/lib/performance/result.rb +3 -1
  81. data/test/performance/lib/performance/runner.rb +10 -0
  82. data/test/performance/lib/performance/timer.rb +6 -10
  83. data/test/performance/script/runner +18 -1
  84. data/test/performance/suites/queue_time.rb +21 -0
  85. data/test/performance/suites/stats_hash.rb +34 -0
  86. data/test/performance/suites/thread_profiling.rb +26 -0
  87. metadata +25 -4
  88. metadata.gz.sig +0 -0
@@ -75,7 +75,9 @@ module Performance
75
75
  def self.from_hash(hash)
76
76
  elapsed = hash['measurements'].delete('elapsed')
77
77
  result = self.new(hash['suite'], hash['name'])
78
- result.measurements.merge! hash['measurements']
78
+ hash['measurements'].each do |key, value|
79
+ result.measurements[key.to_sym] = value
80
+ end
79
81
  result.tags.merge! hash['tags']
80
82
  result.exception = hash['exception']
81
83
  result.elapsed = elapsed
@@ -198,6 +198,16 @@ module Performance
198
198
  report_results(results, Time.now - t0)
199
199
  end
200
200
 
201
+ def list_test_cases
202
+ results = []
203
+ suites_to_run.each do |cls|
204
+ methods_for_test_case(cls.new).each do |method|
205
+ results << [cls, method]
206
+ end
207
+ end
208
+ results
209
+ end
210
+
201
211
  def report_results(results, elapsed)
202
212
  @reporter_classes.each do |cls|
203
213
  cls.new(results, elapsed, @options).report
@@ -4,15 +4,18 @@
4
4
 
5
5
  module Performance
6
6
  class Timer
7
- attr_accessor :start_timestamp, :stop_timestamp
7
+ attr_accessor :start_timestamp, :stop_timestamp, :elapsed
8
8
 
9
9
  def initialize
10
10
  @start_timestamp = nil
11
11
  @stop_timestamp = nil
12
+ @elapsed = 0.0
13
+ @most_recent_start = nil
12
14
  end
13
15
 
14
16
  def start(t=Time.now)
15
- @start_timestamp = t
17
+ @start_timestamp ||= t
18
+ @most_recent_start = t
16
19
  end
17
20
 
18
21
  def stopped?
@@ -21,6 +24,7 @@ module Performance
21
24
 
22
25
  def stop(t=Time.now)
23
26
  @stop_timestamp = t
27
+ @elapsed += t - @most_recent_start
24
28
  end
25
29
 
26
30
  def measure
@@ -29,14 +33,6 @@ module Performance
29
33
  stop
30
34
  end
31
35
 
32
- def elapsed
33
- if @stop_timestamp && @start_timestamp
34
- @stop_timestamp - @start_timestamp
35
- else
36
- nil
37
- end
38
- end
39
-
40
36
  def inspect
41
37
  "<Performance::Timer @start_timestamp=#{start_timestamp.inspect}, @stop_timestamp=#{stop_timestamp.inspect}, elapsed=#{elapsed}>"
42
38
  end
@@ -30,6 +30,10 @@ parser = OptionParser.new do |opts|
30
30
  end
31
31
  end
32
32
 
33
+ opts.on("-l", "--list", "List all available suites and tests") do
34
+ options[:list] = true
35
+ end
36
+
33
37
  opts.on("-s", "--suite=NAME", "Filter to just run a single test suite") do |name|
34
38
  options[:suite] = name
35
39
  end
@@ -100,4 +104,17 @@ end
100
104
  parser.parse!
101
105
 
102
106
  runner = Performance::Runner.new(options)
103
- runner.run_and_report
107
+
108
+ if options[:list]
109
+ all_tests = runner.list_test_cases
110
+ tests_by_suite = all_tests.group_by { |t| t[0] }
111
+ tests_by_suite.each do |(suite, tests)|
112
+ puts "#{suite}:"
113
+ tests.each do |(_, test_method)|
114
+ puts " #{test_method}"
115
+ end
116
+ puts ''
117
+ end
118
+ else
119
+ runner.run_and_report
120
+ end
@@ -0,0 +1,21 @@
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
+ class QueueTimePerfTests < Performance::TestCase
6
+ def setup
7
+ @headers = [
8
+ { 'HTTP_X_REQUEST_START' => "t=1409849996.2152882" },
9
+ { 'HTTP_X_REQUEST_START' => "t=1409850011020.236" },
10
+ { 'HTTP_X_REQUEST_START' => "t=1409850011020236.0" },
11
+ ]
12
+ end
13
+
14
+ def test_queue_time_parsing
15
+ iterations.times do
16
+ @headers.each do |h|
17
+ NewRelic::Agent::Instrumentation::QueueTime.parse_frontend_timestamp(h)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,34 @@
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
+ class StatsHashPerfTest < Performance::TestCase
6
+ def setup
7
+ @hash = NewRelic::Agent::StatsHash.new
8
+ end
9
+
10
+ def test_record(timer)
11
+ iterations.times do
12
+ hash = NewRelic::Agent::StatsHash.new
13
+ timer.measure do
14
+ 100.times do |i|
15
+ hash.record("foo#{i}", 1)
16
+ end
17
+ end
18
+ end
19
+ end
20
+
21
+ def test_merge(timer)
22
+ iterations.times do
23
+ incoming = {}
24
+ 100.times do |i|
25
+ incoming["foo#{i}"] = NewRelic::Agent::Stats.new
26
+ end
27
+
28
+ hash = NewRelic::Agent::StatsHash.new
29
+ timer.measure do
30
+ hash.merge!(incoming)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -80,4 +80,30 @@ class ThreadProfiling < Performance::TestCase
80
80
  end
81
81
  @service.unsubscribe('eagle')
82
82
  end
83
+
84
+ def test_generating_traces(timer)
85
+ require 'new_relic/agent/threading/thread_profile'
86
+
87
+ (iterations/1000).times do
88
+ profile = ::NewRelic::Agent::Threading::ThreadProfile.new({})
89
+
90
+ aggregate_lots_of_nodes(profile, 5, [])
91
+
92
+ timer.measure do
93
+ profile.generate_traces
94
+ end
95
+ end
96
+ end
97
+
98
+ def aggregate_lots_of_nodes(profile, depth, trace)
99
+ if depth > 0
100
+ 10.times do |i|
101
+ trace.push("path#{i}:#{i+50}:in `depth#{depth}'")
102
+ aggregate_lots_of_nodes(profile, depth-1, trace)
103
+ trace.pop
104
+ end
105
+ else
106
+ profile.aggregate(trace, :request, Thread.current)
107
+ end
108
+ end
83
109
  end
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.9.4.245
4
+ version: 3.9.5.251
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -41,7 +41,7 @@ cert_chain:
41
41
  K0ZZTXduQWIrVm1OT2h2MVMrc0poYmpaMzBQS2d6NnZMaFQ2dW5pZUNqTGs5
42
42
  d0dHbWxTSwpZamJudkE5cXJhTExhalNqCi0tLS0tRU5EIENFUlRJRklDQVRF
43
43
  LS0tLS0K
44
- date: 2014-09-04 00:00:00.000000000 Z
44
+ date: 2014-09-24 00:00:00.000000000 Z
45
45
  dependencies:
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: rake
@@ -353,6 +353,7 @@ files:
353
353
  - lib/new_relic/agent/javascript_instrumentor.rb
354
354
  - lib/new_relic/agent/memory_logger.rb
355
355
  - lib/new_relic/agent/method_tracer.rb
356
+ - lib/new_relic/agent/method_tracer_helpers.rb
356
357
  - lib/new_relic/agent/new_relic_service.rb
357
358
  - lib/new_relic/agent/new_relic_service/encoders.rb
358
359
  - lib/new_relic/agent/new_relic_service/json_marshaller.rb
@@ -364,6 +365,8 @@ files:
364
365
  - lib/new_relic/agent/pipe_service.rb
365
366
  - lib/new_relic/agent/request_sampler.rb
366
367
  - lib/new_relic/agent/rules_engine.rb
368
+ - lib/new_relic/agent/rules_engine/replacement_rule.rb
369
+ - lib/new_relic/agent/rules_engine/segment_terms_rule.rb
367
370
  - lib/new_relic/agent/sampled_buffer.rb
368
371
  - lib/new_relic/agent/sampler.rb
369
372
  - lib/new_relic/agent/sampler_collection.rb
@@ -646,6 +649,19 @@ files:
646
649
  - test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case9.explain.txt
647
650
  - test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case9.obfuscated.txt
648
651
  - test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case9.query.txt
652
+ - test/fixtures/cross_agent_tests/proc_cpuinfo/1pack_1core_1logical.txt
653
+ - test/fixtures/cross_agent_tests/proc_cpuinfo/1pack_1core_2logical.txt
654
+ - test/fixtures/cross_agent_tests/proc_cpuinfo/1pack_2core_2logical.txt
655
+ - test/fixtures/cross_agent_tests/proc_cpuinfo/1pack_4core_4logical.txt
656
+ - test/fixtures/cross_agent_tests/proc_cpuinfo/2pack_12core_24logical.txt
657
+ - test/fixtures/cross_agent_tests/proc_cpuinfo/2pack_20core_40logical.txt
658
+ - test/fixtures/cross_agent_tests/proc_cpuinfo/2pack_2core_2logical.txt
659
+ - test/fixtures/cross_agent_tests/proc_cpuinfo/2pack_2core_4logical.txt
660
+ - test/fixtures/cross_agent_tests/proc_cpuinfo/2pack_4core_4logical.txt
661
+ - test/fixtures/cross_agent_tests/proc_cpuinfo/4pack_4core_4logical.txt
662
+ - test/fixtures/cross_agent_tests/proc_cpuinfo/8pack_8core_8logical.txt
663
+ - test/fixtures/cross_agent_tests/proc_cpuinfo/README.md
664
+ - test/fixtures/cross_agent_tests/proc_cpuinfo/Xpack_Xcore_2logical.txt
649
665
  - test/fixtures/cross_agent_tests/rules.json
650
666
  - test/fixtures/cross_agent_tests/rum_client_config.json
651
667
  - test/fixtures/cross_agent_tests/rum_cookie.json
@@ -740,9 +756,9 @@ files:
740
756
  - test/fixtures/cross_agent_tests/sql_obfuscation/string_with_twin_single_quotes.obfuscated
741
757
  - test/fixtures/cross_agent_tests/sql_obfuscation/string_with_twin_single_quotes.sql
742
758
  - test/fixtures/cross_agent_tests/sql_parsing.json
759
+ - test/fixtures/cross_agent_tests/transaction_segment_terms.json
743
760
  - test/fixtures/cross_agent_tests/url_clean.json
744
761
  - test/fixtures/cross_agent_tests/url_domain_extraction.json
745
- - test/fixtures/proc_cpuinfo.txt
746
762
  - test/helpers/exceptions.rb
747
763
  - test/helpers/file_searching.rb
748
764
  - test/helpers/mongo_metric_builder.rb
@@ -763,6 +779,7 @@ files:
763
779
  - test/multiverse/suites/activemerchant/Envfile
764
780
  - test/multiverse/suites/activemerchant/activemerchant_test.rb
765
781
  - test/multiverse/suites/agent_only/Envfile
782
+ - test/multiverse/suites/agent_only/agent_run_id_handling_test.rb
766
783
  - test/multiverse/suites/agent_only/audit_log_test.rb
767
784
  - test/multiverse/suites/agent_only/before_suite.rb
768
785
  - test/multiverse/suites/agent_only/collector_exception_handling_test.rb
@@ -844,6 +861,7 @@ files:
844
861
  - test/multiverse/suites/padrino/padrino_test.rb
845
862
  - test/multiverse/suites/rack/Envfile
846
863
  - test/multiverse/suites/rack/example_app.rb
864
+ - test/multiverse/suites/rack/http_response_code_test.rb
847
865
  - test/multiverse/suites/rack/nested_non_rack_app_test.rb
848
866
  - test/multiverse/suites/rack/rack_auto_instrumentation_test.rb
849
867
  - test/multiverse/suites/rack/rack_unsupported_version_test.rb
@@ -1007,9 +1025,10 @@ files:
1007
1025
  - test/new_relic/agent/stats_engine/gc_profiler_test.rb
1008
1026
  - test/new_relic/agent/stats_engine/metric_stats_test.rb
1009
1027
  - test/new_relic/agent/stats_engine/samplers_test.rb
1028
+ - test/new_relic/agent/stats_engine/stats_hash_test.rb
1010
1029
  - test/new_relic/agent/stats_engine_test.rb
1011
- - test/new_relic/agent/stats_hash_test.rb
1012
1030
  - test/new_relic/agent/stats_test.rb
1031
+ - test/new_relic/agent/system_info_test.rb
1013
1032
  - test/new_relic/agent/threading/agent_thread_test.rb
1014
1033
  - test/new_relic/agent/threading/backtrace_node_test.rb
1015
1034
  - test/new_relic/agent/threading/backtrace_service_test.rb
@@ -1109,10 +1128,12 @@ files:
1109
1128
  - test/performance/script/runner
1110
1129
  - test/performance/suites/config.rb
1111
1130
  - test/performance/suites/marshalling.rb
1131
+ - test/performance/suites/queue_time.rb
1112
1132
  - test/performance/suites/rack_middleware.rb
1113
1133
  - test/performance/suites/rum_autoinsertion.rb
1114
1134
  - test/performance/suites/sql_obfuscation.rb
1115
1135
  - test/performance/suites/startup.rb
1136
+ - test/performance/suites/stats_hash.rb
1116
1137
  - test/performance/suites/thread_profiling.rb
1117
1138
  - test/performance/suites/trace_execution_scoped.rb
1118
1139
  - test/performance/suites/transaction_tracing.rb
metadata.gz.sig CHANGED
Binary file