wd_newrelic_rpm 3.5.6 → 3.5.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. data/CHANGELOG +43 -3
  2. data/Gemfile +6 -2
  3. data/LICENSE +23 -0
  4. data/lib/new_relic/agent.rb +50 -3
  5. data/lib/new_relic/agent/agent.rb +40 -60
  6. data/lib/new_relic/agent/configuration/defaults.rb +9 -3
  7. data/lib/new_relic/agent/configuration/server_source.rb +4 -0
  8. data/lib/new_relic/agent/cross_app_monitor.rb +239 -0
  9. data/lib/new_relic/agent/cross_app_tracing.rb +281 -0
  10. data/lib/new_relic/agent/database.rb +28 -10
  11. data/lib/new_relic/agent/error_collector.rb +5 -0
  12. data/lib/new_relic/agent/event_listener.rb +4 -0
  13. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +58 -39
  14. data/lib/new_relic/agent/instrumentation/metric_frame.rb +16 -3
  15. data/lib/new_relic/agent/instrumentation/net.rb +13 -11
  16. data/lib/new_relic/agent/instrumentation/queue_time.rb +50 -192
  17. data/lib/new_relic/agent/instrumentation/rails4/action_controller.rb +145 -0
  18. data/lib/new_relic/agent/instrumentation/rails4/errors.rb +45 -0
  19. data/lib/new_relic/agent/instrumentation/resque.rb +10 -10
  20. data/lib/new_relic/agent/instrumentation/sinatra.rb +19 -9
  21. data/lib/new_relic/agent/new_relic_service.rb +63 -9
  22. data/lib/new_relic/agent/pipe_service.rb +8 -12
  23. data/lib/new_relic/agent/rules_engine.rb +72 -0
  24. data/lib/new_relic/agent/shim_agent.rb +0 -1
  25. data/lib/new_relic/agent/sql_sampler.rb +3 -2
  26. data/lib/new_relic/agent/stats.rb +149 -0
  27. data/lib/new_relic/agent/stats_engine.rb +9 -0
  28. data/lib/new_relic/agent/stats_engine/gc_profiler.rb +1 -24
  29. data/lib/new_relic/agent/stats_engine/metric_stats.rb +84 -185
  30. data/lib/new_relic/agent/stats_engine/stats_hash.rb +58 -0
  31. data/lib/new_relic/agent/stats_engine/transactions.rb +10 -2
  32. data/lib/new_relic/agent/transaction_info.rb +31 -6
  33. data/lib/new_relic/agent/transaction_sample_builder.rb +19 -8
  34. data/lib/new_relic/agent/transaction_sampler.rb +17 -10
  35. data/lib/new_relic/helper.rb +32 -0
  36. data/lib/new_relic/local_environment.rb +24 -32
  37. data/lib/new_relic/okjson.rb +599 -0
  38. data/lib/new_relic/transaction_sample.rb +2 -1
  39. data/lib/new_relic/transaction_sample/segment.rb +2 -1
  40. data/lib/new_relic/version.rb +1 -1
  41. data/newrelic.yml +27 -41
  42. data/test/multiverse/suites/agent_only/Envfile +5 -1
  43. data/test/multiverse/suites/agent_only/audit_log_test.rb +2 -4
  44. data/test/multiverse/suites/agent_only/config/newrelic.yml +1 -2
  45. data/test/multiverse/suites/agent_only/{cross_process_test.rb → cross_application_tracing_test.rb} +3 -3
  46. data/test/multiverse/suites/agent_only/key_transactions_test.rb +66 -0
  47. data/test/multiverse/suites/agent_only/marshaling_test.rb +9 -22
  48. data/test/multiverse/suites/agent_only/rename_rule_test.rb +57 -0
  49. data/test/multiverse/suites/agent_only/start_up_test.rb +1 -1
  50. data/test/multiverse/suites/agent_only/thread_profiling_test.rb +17 -6
  51. data/test/multiverse/suites/rails/error_tracing_test.rb +20 -8
  52. data/test/multiverse/suites/rails/queue_time_test.rb +2 -2
  53. data/test/multiverse/suites/resque/instrumentation_test.rb +4 -3
  54. data/test/multiverse/suites/sinatra/Envfile +2 -0
  55. data/test/multiverse/suites/sinatra/config/newrelic.yml +1 -0
  56. data/test/multiverse/suites/sinatra/sinatra_metric_explosion_test.rb +5 -5
  57. data/test/multiverse/suites/sinatra/sinatra_test.rb +77 -10
  58. data/test/new_relic/agent/agent/connect_test.rb +45 -1
  59. data/test/new_relic/agent/agent/start_worker_thread_test.rb +0 -3
  60. data/test/new_relic/agent/agent_test.rb +20 -40
  61. data/test/new_relic/agent/agent_test_controller_test.rb +27 -60
  62. data/test/new_relic/agent/busy_calculator_test.rb +1 -1
  63. data/test/new_relic/agent/configuration/server_source_test.rb +8 -3
  64. data/test/new_relic/agent/cross_app_monitor_test.rb +237 -0
  65. data/test/new_relic/agent/database_test.rb +60 -16
  66. data/test/new_relic/agent/error_collector_test.rb +28 -4
  67. data/test/new_relic/agent/event_listener_test.rb +23 -2
  68. data/test/new_relic/agent/instrumentation/browser_monitoring_timings_test.rb +1 -1
  69. data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +85 -12
  70. data/test/new_relic/agent/instrumentation/metric_frame_test.rb +95 -0
  71. data/test/new_relic/agent/instrumentation/net_instrumentation_test.rb +436 -59
  72. data/test/new_relic/agent/instrumentation/queue_time_test.rb +58 -357
  73. data/test/new_relic/agent/instrumentation/task_instrumentation_test.rb +2 -5
  74. data/test/new_relic/agent/method_tracer_test.rb +4 -2
  75. data/test/new_relic/agent/new_relic_service_test.rb +108 -6
  76. data/test/new_relic/agent/pipe_channel_manager_test.rb +1 -1
  77. data/test/new_relic/agent/pipe_service_test.rb +9 -9
  78. data/test/new_relic/agent/rpm_agent_test.rb +0 -11
  79. data/test/new_relic/agent/rules_engine_test.rb +82 -0
  80. data/test/new_relic/agent/shim_agent_test.rb +0 -4
  81. data/test/new_relic/agent/sql_sampler_test.rb +7 -0
  82. data/test/new_relic/agent/stats_engine/gc_profiler_test.rb +85 -0
  83. data/test/new_relic/agent/stats_engine/metric_stats_test.rb +110 -23
  84. data/test/new_relic/agent/stats_engine_test.rb +1 -46
  85. data/test/new_relic/agent/stats_hash_test.rb +93 -0
  86. data/test/new_relic/agent/stats_test.rb +197 -0
  87. data/test/new_relic/agent/transaction_info_test.rb +63 -11
  88. data/test/new_relic/agent/transaction_sample_builder_test.rb +10 -3
  89. data/test/new_relic/agent/transaction_sampler_test.rb +92 -80
  90. data/test/new_relic/agent/worker_loop_test.rb +1 -1
  91. data/test/new_relic/agent_test.rb +35 -5
  92. data/test/new_relic/control_test.rb +1 -1
  93. data/test/new_relic/fake_collector.rb +87 -9
  94. data/test/new_relic/helper_test.rb +24 -0
  95. data/test/new_relic/metric_data_test.rb +11 -11
  96. data/test/new_relic/metric_spec_test.rb +1 -1
  97. data/test/script/ci.sh +1 -1
  98. data/test/test_contexts.rb +0 -1
  99. data/test/test_helper.rb +21 -3
  100. metadata +34 -41
  101. data/lib/new_relic/agent/cross_process_monitoring.rb +0 -187
  102. data/lib/new_relic/stats.rb +0 -337
  103. data/test/new_relic/agent/cross_process_monitoring_test.rb +0 -190
  104. data/test/new_relic/agent/stats_engine/metric_stats/harvest_test.rb +0 -133
  105. data/test/new_relic/fakes_sending_data.rb +0 -30
  106. data/test/new_relic/stats_test.rb +0 -421
@@ -42,7 +42,7 @@ module NewRelic
42
42
  def test_finish_setup_applied_server_side_config
43
43
  with_config({ :'transction_tracer.enabled' => true,
44
44
  'error_collector.enabled' => true,
45
- :log_level => 'info' }, 2) do
45
+ :log_level => 'info' }, :level => 2) do
46
46
  NewRelic::Agent.instance.finish_setup('log_level' => 'debug',
47
47
  'agent_config' => { 'transaction_tracer.enabled' => false },
48
48
  'collect_errors' => false)
@@ -78,10 +78,6 @@ module NewRelic
78
78
  NewRelic::Agent.instance.stats_engine.get_stats_no_scope(metric) \
79
79
  .record_data_point(1.0)
80
80
 
81
- # ensure that cached metric ids don't interfere with metric merging
82
- NewRelic::Agent.agent.instance_variable_set(:@metric_ids,
83
- { NewRelic::MetricSpec.new('Instance/Busy') => 1 })
84
-
85
81
  NewRelic::Agent::PipeChannelManager.listener.close_all_pipes
86
82
  NewRelic::Agent.register_report_channel(:agent_test) # before fork
87
83
  pid = Process.fork do
@@ -237,6 +233,40 @@ module NewRelic
237
233
  NewRelic::Agent::PipeChannelManager.listener.close_all_pipes
238
234
  end
239
235
 
236
+ def test_record_metric
237
+ dummy_engine = NewRelic::Agent.agent.stats_engine
238
+ dummy_engine.expects(:record_metric).with('foo', 12)
239
+ NewRelic::Agent.record_metric('foo', 12)
240
+ end
241
+
242
+ def test_record_metric_accepts_hash
243
+ dummy_engine = NewRelic::Agent.agent.stats_engine
244
+ stats_hash = {
245
+ :count => 12,
246
+ :total => 42,
247
+ :min => 1,
248
+ :max => 5,
249
+ :sum_of_squares => 999
250
+ }
251
+ expected_stats = NewRelic::Agent::Stats.new()
252
+ expected_stats.call_count = 12
253
+ expected_stats.total_call_time = 42
254
+ expected_stats.total_exclusive_time = 42
255
+ expected_stats.min_call_time = 1
256
+ expected_stats.max_call_time = 5
257
+ expected_stats.sum_of_squares = 999
258
+ dummy_engine.expects(:record_metric).with('foo', expected_stats)
259
+ NewRelic::Agent.record_metric('foo', stats_hash)
260
+ end
261
+
262
+ def test_increment_metric
263
+ dummy_engine = NewRelic::Agent.agent.stats_engine
264
+ dummy_stats = mock
265
+ dummy_stats.expects(:increment_count).with(12)
266
+ dummy_engine.expects(:record_metric).with('foo').yields(dummy_stats)
267
+ NewRelic::Agent.increment_metric('foo', 12)
268
+ end
269
+
240
270
  private
241
271
 
242
272
  def mocked_agent
@@ -168,7 +168,7 @@ class NewRelic::ControlTest < Test::Unit::TestCase
168
168
  def test_sql_tracer_disabled_when_tt_disabled_by_server
169
169
  with_config({:'slow_sql.enabled' => true,
170
170
  :'transaction_tracer.enabled' => true,
171
- :monitor_mode => true}, 2) do
171
+ :monitor_mode => true}, :level => 2) do
172
172
  NewRelic::Agent.instance.finish_setup('collect_traces' => false)
173
173
 
174
174
  assert(!NewRelic::Agent::Agent.instance.sql_sampler.enabled?,
@@ -4,7 +4,6 @@ require 'uri'
4
4
  require 'socket'
5
5
  require 'timeout'
6
6
  require 'ostruct'
7
- require File.join(File.dirname(__FILE__), 'fakes_sending_data')
8
7
 
9
8
  require 'json' if RUBY_VERSION >= '1.9'
10
9
 
@@ -12,8 +11,6 @@ module NewRelic
12
11
  class FakeCollector
13
12
  attr_accessor :agent_data, :mock
14
13
 
15
- include FakesSendingData
16
-
17
14
  def initialize
18
15
  @id_counter = 0
19
16
  @base_expectations = {
@@ -53,16 +50,16 @@ module NewRelic
53
50
  end
54
51
  run_id = uri.query =~ /run_id=(\d+)/ ? $1 : nil
55
52
  req.body.rewind
56
-
53
+
57
54
  body = if format == :json
58
55
  body = JSON.load(req.body.read)
59
56
  else
60
57
  body = Marshal.load(req.body.read)
61
58
  end
62
- @agent_data << OpenStruct.new(:action => method,
63
- :body => body,
64
- :run_id => run_id,
65
- :format => format)
59
+ @agent_data << AgentPost.create(:action => method,
60
+ :body => body,
61
+ :run_id => run_id,
62
+ :format => format)
66
63
  end
67
64
  res.finish
68
65
  end
@@ -151,6 +148,87 @@ module NewRelic
151
148
 
152
149
  return true
153
150
  end
151
+
152
+ def calls_for(method)
153
+ @agent_data.select {|d| d.action == method }
154
+ end
155
+
156
+ def reported_stats_for_metric(name, scope=nil)
157
+ calls_for('metric_data').map do |post|
158
+ post.body[3].find do |metric_record|
159
+ metric_record[0]['name'] == name &&
160
+ (!scope || metric_record[0]['scope'] == scope)
161
+ end
162
+ end.compact.map{|m| m[1]}
163
+ end
164
+
165
+ class AgentPost
166
+ attr_accessor :action, :body, :run_id, :format
167
+ def initialize(opts={})
168
+ @action = opts[:action]
169
+ @body = opts[:body]
170
+ @run_id = opts[:run_id]
171
+ @format = opts[:format]
172
+ end
173
+
174
+ def self.create(opts={})
175
+ case opts[:action]
176
+ when 'connect'
177
+ ConnectPost.new(opts)
178
+ when 'metric_data'
179
+ AgentPost.new(opts)
180
+ when 'profile_data'
181
+ ProfileDataPost.new(opts)
182
+ when 'sql_trace_data'
183
+ SqlTraceDataPost.new(opts)
184
+ when 'transaction_sample_data'
185
+ TransactionSampleDataPost.new(opts)
186
+ else
187
+ new(opts)
188
+ end
189
+ end
190
+
191
+ def [](key)
192
+ @body[key]
193
+ end
194
+
195
+ def unblob(blob)
196
+ return unless blob
197
+ JSON.load(Zlib::Inflate.inflate(Base64.decode64(blob)))
198
+ end
199
+ end
200
+
201
+ class ConnectPost < AgentPost
202
+ def initialize(opts={})
203
+ super
204
+ @body = @body[0]
205
+ end
206
+ end
207
+
208
+ class ProfileDataPost < AgentPost
209
+ def initialize(opts={})
210
+ super
211
+ @body[1][0][4] = unblob(@body[1][0][4]) if @format == :json
212
+ end
213
+ end
214
+
215
+ class SqlTraceDataPost < AgentPost
216
+ def initialize(opts={})
217
+ super
218
+ @body[0][0][9] = unblob(@body[0][0][9]) if @format == :json
219
+ end
220
+ end
221
+
222
+ class TransactionSampleDataPost < AgentPost
223
+ def initialize(opts={})
224
+ super
225
+ @body[4] = unblob(@body[4]) if @format == :json
226
+ end
227
+
228
+ def metric_name
229
+ @body[1][0][2]
230
+ end
231
+ end
154
232
  end
155
233
 
156
234
  # might we need this? I'll just leave it here for now
@@ -290,7 +368,7 @@ if $0 == __FILE__
290
368
  end
291
369
 
292
370
  def invoke(method, post={}, code=200)
293
- uri = URI.parse("http://127.0.0.1:#{determine_port}/agent_listener/8/12345/#{method}")
371
+ uri = URI.parse("http://127.0.0.1:#{@collector.determine_port}/agent_listener/8/12345/#{method}")
294
372
  request = Net::HTTP::Post.new("#{uri.path}?#{uri.query}")
295
373
  if uri.query && uri.query.include?('marshal_format=json')
296
374
  request.body = JSON.dump(post)
@@ -0,0 +1,24 @@
1
+ #encoding: utf-8
2
+
3
+ #require File.expand_path(File.join(File.dirname(__FILE__),'..','test_helper'))
4
+ require 'test/unit'
5
+ require 'newrelic_rpm'
6
+
7
+ class HelperTest < Test::Unit::TestCase
8
+
9
+ def test_json_serializer_method
10
+ obj = [
11
+ 99, 'luftballons',
12
+ {
13
+ 'Hast du etwas' => 'Zeit für mich',
14
+ 'Dann singe ich' => {
15
+ 'ein lied' => 'für dich'
16
+ }
17
+ }
18
+ ]
19
+ copy = NewRelic.json_load( NewRelic.json_dump(obj) )
20
+
21
+ assert( obj == copy )
22
+ end
23
+
24
+ end
@@ -101,29 +101,29 @@ class NewRelic::MetricDataTest < Test::Unit::TestCase
101
101
  end
102
102
 
103
103
  def test_to_json_no_metric_id
104
- md = NewRelic::MetricData.new(NewRelic::MetricSpec.new('Custom/test/method', ''), NewRelic::MethodTraceStats.new, nil)
104
+ md = NewRelic::MetricData.new(NewRelic::MetricSpec.new('Custom/test/method', ''), NewRelic::Agent::Stats.new, nil)
105
105
  json = md.to_json
106
106
  assert(json.include?('"Custom/test/method"'), "should include the metric spec in the json")
107
107
  assert(json.include?('"metric_id":null}'), "should have a null metric_id")
108
108
  end
109
109
 
110
110
  def test_to_json_with_metric_id
111
- md = NewRelic::MetricData.new(NewRelic::MetricSpec.new('Custom/test/method', ''), NewRelic::MethodTraceStats.new, 12345)
111
+ md = NewRelic::MetricData.new(NewRelic::MetricSpec.new('Custom/test/method', ''), NewRelic::Agent::Stats.new, 12345)
112
112
  assert_equal('{"metric_spec":null,"stats":{"total_exclusive_time":0.0,"min_call_time":0.0,"call_count":0,"sum_of_squares":0.0,"total_call_time":0.0,"max_call_time":0.0},"metric_id":12345}', md.to_json, "should not include the metric spec and should have a metric_id")
113
113
  end
114
114
 
115
115
  def test_to_s_with_metric_spec
116
- md = NewRelic::MetricData.new(NewRelic::MetricSpec.new('Custom/test/method', ''), NewRelic::MethodTraceStats.new, 12345)
117
- assert_equal('Custom/test/method(): [01/01/70 12:00AM UTC, 0.000s; 0 calls 0s]', md.to_s, "should not include the metric id and should include the metric spec")
116
+ md = NewRelic::MetricData.new(NewRelic::MetricSpec.new('Custom/test/method', ''), NewRelic::Agent::Stats.new, 12345)
117
+ assert_equal('Custom/test/method(): [ 0 calls 0.0000s]', md.to_s, "should not include the metric id and should include the metric spec")
118
118
  end
119
119
 
120
120
  def test_to_s_without_metric_spec
121
- md = NewRelic::MetricData.new(nil, NewRelic::MethodTraceStats.new, 12345)
122
- assert_equal('12345: [01/01/70 12:00AM UTC, 0.000s; 0 calls 0s]', md.to_s, "should include the metric id and not have a metric spec")
121
+ md = NewRelic::MetricData.new(nil, NewRelic::Agent::Stats.new, 12345)
122
+ assert_equal('12345: [ 0 calls 0.0000s]', md.to_s, "should include the metric id and not have a metric spec")
123
123
  end
124
124
 
125
125
  def test_to_collector_array_with_spec
126
- stats = NewRelic::MethodTraceStats.new
126
+ stats = NewRelic::Agent::Stats.new
127
127
  stats.record_data_point(1.0)
128
128
  stats.record_data_point(2.0, 1.0)
129
129
  md = NewRelic::MetricData.new(NewRelic::MetricSpec.new('Custom/test/method', 'scope'),
@@ -134,7 +134,7 @@ class NewRelic::MetricDataTest < Test::Unit::TestCase
134
134
  end
135
135
 
136
136
  def test_to_collector_array_with_spec_and_id
137
- stats = NewRelic::MethodTraceStats.new
137
+ stats = NewRelic::Agent::Stats.new
138
138
  stats.record_data_point(1.0)
139
139
  stats.record_data_point(2.0, 1.0)
140
140
  md = NewRelic::MetricData.new(NewRelic::MetricSpec.new('Custom/test/method', 'scope'),
@@ -144,7 +144,7 @@ class NewRelic::MetricDataTest < Test::Unit::TestCase
144
144
  end
145
145
 
146
146
  def test_to_collector_array_with_id
147
- stats = NewRelic::MethodTraceStats.new
147
+ stats = NewRelic::Agent::Stats.new
148
148
  stats.record_data_point(1.0)
149
149
  stats.record_data_point(2.0, 1.0)
150
150
  md = NewRelic::MetricData.new(nil, stats, 1234)
@@ -154,7 +154,7 @@ class NewRelic::MetricDataTest < Test::Unit::TestCase
154
154
 
155
155
  # Rationals in metric data? -- https://support.newrelic.com/tickets/28053
156
156
  def test_to_collector_array_with_rationals
157
- stats = NewRelic::MethodTraceStats.new
157
+ stats = NewRelic::Agent::Stats.new
158
158
  stats.call_count = Rational(1, 1)
159
159
  stats.total_call_time = Rational(2, 1)
160
160
  stats.total_exclusive_time = Rational(3, 1)
@@ -168,7 +168,7 @@ class NewRelic::MetricDataTest < Test::Unit::TestCase
168
168
  end
169
169
 
170
170
  def test_to_collector_array_with_bad_values
171
- stats = NewRelic::MethodTraceStats.new
171
+ stats = NewRelic::Agent::Stats.new
172
172
  stats.call_count = nil
173
173
  stats.total_call_time = "junk"
174
174
  stats.total_exclusive_time = Object.new
@@ -46,7 +46,7 @@ class NewRelic::MetricSpecTest < Test::Unit::TestCase
46
46
 
47
47
  compare_spec(spec, import)
48
48
 
49
- stats = NewRelic::MethodTraceStats.new
49
+ stats = NewRelic::Agent::Stats.new
50
50
 
51
51
  import = ::ActiveSupport::JSON.decode(stats.to_json)
52
52
 
@@ -29,7 +29,7 @@ set -e
29
29
  if [ "x$RUBY" == "x" ]; then
30
30
  echo '$RUBY is undefined'
31
31
  echo 'defaulting to 1.9.3'
32
- export RUBY=1.9.3-p286
32
+ export RUBY=1.9.3-p374
33
33
  fi
34
34
  if [ "x$BRANCH" == "x" ]; then
35
35
  echo '$BRANCH is undefined'
@@ -10,7 +10,6 @@ module TestContexts
10
10
  NewRelic::Agent::Agent.instance.service = default_service
11
11
  NewRelic::Agent.manual_start :log => @log
12
12
  @agent = NewRelic::Agent.instance
13
- @agent.metric_ids.clear
14
13
  @agent.transaction_sampler.send :clear_builder
15
14
  @agent.transaction_sampler.reset!
16
15
  @agent.stats_engine.clear_stats
@@ -140,15 +140,33 @@ def assert_calls_unscoped_metrics(*metrics)
140
140
  assert_not_equal first_metrics, last_metrics, "should have changed these metrics"
141
141
  end
142
142
 
143
+ unless defined?( assert_includes )
144
+ def assert_includes( collection, member, msg=nil )
145
+ msg = build_message( msg, "Expected ? to include ?", collection, member )
146
+ assert_block( msg ) { collection.include?(member) }
147
+ end
148
+ end
149
+
150
+ unless defined?( assert_not_includes )
151
+ def assert_not_includes( collection, member, msg=nil )
152
+ msg = build_message( msg, "Expected ? not to include ?", collection, member )
153
+ assert_block( msg ) { !collection.include?(member) }
154
+ end
155
+ end
143
156
 
144
157
  def compare_metrics(expected, actual)
145
158
  actual.delete_if {|a| a.include?('GC/cumulative') } # in case we are in REE
146
159
  assert_equal(expected.to_a.sort, actual.to_a.sort, "extra: #{(actual - expected).to_a.inspect}; missing: #{(expected - actual).to_a.inspect}")
147
160
  end
148
161
 
149
- def with_config(config_hash, level=0)
150
- config = NewRelic::Agent::Configuration::DottedHash.new(config_hash)
151
- NewRelic::Agent.config.apply_config(config, level)
162
+ def with_config(config_hash, opts={})
163
+ opts = { :level => 0, :do_not_cast => false }.merge(opts)
164
+ if opts[:do_not_cast]
165
+ config = config_hash
166
+ else
167
+ config = NewRelic::Agent::Configuration::DottedHash.new(config_hash)
168
+ end
169
+ NewRelic::Agent.config.apply_config(config, opts[:level])
152
170
  begin
153
171
  yield
154
172
  ensure
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wd_newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.6
4
+ version: 3.5.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2013-02-19 00:00:00.000000000 Z
16
+ date: 2013-03-07 00:00:00.000000000 Z
17
17
  dependencies: []
18
18
  description: ! 'Weasel Diesel compatible version of rpm.
19
19
 
@@ -80,7 +80,8 @@ files:
80
80
  - lib/new_relic/agent/configuration/mask_defaults.rb
81
81
  - lib/new_relic/agent/configuration/server_source.rb
82
82
  - lib/new_relic/agent/configuration/yaml_source.rb
83
- - lib/new_relic/agent/cross_process_monitoring.rb
83
+ - lib/new_relic/agent/cross_app_monitor.rb
84
+ - lib/new_relic/agent/cross_app_tracing.rb
84
85
  - lib/new_relic/agent/database.rb
85
86
  - lib/new_relic/agent/error_collector.rb
86
87
  - lib/new_relic/agent/event_listener.rb
@@ -107,6 +108,8 @@ files:
107
108
  - lib/new_relic/agent/instrumentation/rails/errors.rb
108
109
  - lib/new_relic/agent/instrumentation/rails3/action_controller.rb
109
110
  - lib/new_relic/agent/instrumentation/rails3/errors.rb
111
+ - lib/new_relic/agent/instrumentation/rails4/action_controller.rb
112
+ - lib/new_relic/agent/instrumentation/rails4/errors.rb
110
113
  - lib/new_relic/agent/instrumentation/resque.rb
111
114
  - lib/new_relic/agent/instrumentation/sinatra.rb
112
115
  - lib/new_relic/agent/instrumentation/sunspot.rb
@@ -115,6 +118,7 @@ files:
115
118
  - lib/new_relic/agent/new_relic_service.rb
116
119
  - lib/new_relic/agent/pipe_channel_manager.rb
117
120
  - lib/new_relic/agent/pipe_service.rb
121
+ - lib/new_relic/agent/rules_engine.rb
118
122
  - lib/new_relic/agent/sampler.rb
119
123
  - lib/new_relic/agent/samplers/cpu_sampler.rb
120
124
  - lib/new_relic/agent/samplers/delayed_job_sampler.rb
@@ -122,10 +126,12 @@ files:
122
126
  - lib/new_relic/agent/samplers/object_sampler.rb
123
127
  - lib/new_relic/agent/shim_agent.rb
124
128
  - lib/new_relic/agent/sql_sampler.rb
129
+ - lib/new_relic/agent/stats.rb
125
130
  - lib/new_relic/agent/stats_engine.rb
126
131
  - lib/new_relic/agent/stats_engine/gc_profiler.rb
127
132
  - lib/new_relic/agent/stats_engine/metric_stats.rb
128
133
  - lib/new_relic/agent/stats_engine/samplers.rb
134
+ - lib/new_relic/agent/stats_engine/stats_hash.rb
129
135
  - lib/new_relic/agent/stats_engine/transactions.rb
130
136
  - lib/new_relic/agent/thread.rb
131
137
  - lib/new_relic/agent/thread_profiler.rb
@@ -162,13 +168,13 @@ files:
162
168
  - lib/new_relic/metric_spec.rb
163
169
  - lib/new_relic/metrics.rb
164
170
  - lib/new_relic/noticed_error.rb
171
+ - lib/new_relic/okjson.rb
165
172
  - lib/new_relic/rack.rb
166
173
  - lib/new_relic/rack/agent_hooks.rb
167
174
  - lib/new_relic/rack/browser_monitoring.rb
168
175
  - lib/new_relic/rack/developer_mode.rb
169
176
  - lib/new_relic/rack/error_collector.rb
170
177
  - lib/new_relic/recipes.rb
171
- - lib/new_relic/stats.rb
172
178
  - lib/new_relic/timer_lib.rb
173
179
  - lib/new_relic/transaction_analysis.rb
174
180
  - lib/new_relic/transaction_analysis/segment_summary.rb
@@ -208,13 +214,15 @@ files:
208
214
  - test/multiverse/suites/agent_only/Envfile
209
215
  - test/multiverse/suites/agent_only/audit_log_test.rb
210
216
  - test/multiverse/suites/agent_only/config/newrelic.yml
211
- - test/multiverse/suites/agent_only/cross_process_test.rb
217
+ - test/multiverse/suites/agent_only/cross_application_tracing_test.rb
212
218
  - test/multiverse/suites/agent_only/http_response_code_test.rb
219
+ - test/multiverse/suites/agent_only/key_transactions_test.rb
213
220
  - test/multiverse/suites/agent_only/logging_test.rb
214
221
  - test/multiverse/suites/agent_only/marshaling_test.rb
215
222
  - test/multiverse/suites/agent_only/method_visibility_test.rb
216
223
  - test/multiverse/suites/agent_only/no_dns_resolv.rb
217
224
  - test/multiverse/suites/agent_only/pipe_manager_test.rb
225
+ - test/multiverse/suites/agent_only/rename_rule_test.rb
218
226
  - test/multiverse/suites/agent_only/rum_instrumentation_test.rb
219
227
  - test/multiverse/suites/agent_only/service_timeout_test.rb
220
228
  - test/multiverse/suites/agent_only/ssl_test.rb
@@ -282,7 +290,7 @@ files:
282
290
  - test/new_relic/agent/configuration/manager_test.rb
283
291
  - test/new_relic/agent/configuration/server_source_test.rb
284
292
  - test/new_relic/agent/configuration/yaml_source_test.rb
285
- - test/new_relic/agent/cross_process_monitoring_test.rb
293
+ - test/new_relic/agent/cross_app_monitor_test.rb
286
294
  - test/new_relic/agent/database_test.rb
287
295
  - test/new_relic/agent/error_collector/notice_error_test.rb
288
296
  - test/new_relic/agent/error_collector_test.rb
@@ -307,13 +315,16 @@ files:
307
315
  - test/new_relic/agent/pipe_channel_manager_test.rb
308
316
  - test/new_relic/agent/pipe_service_test.rb
309
317
  - test/new_relic/agent/rpm_agent_test.rb
318
+ - test/new_relic/agent/rules_engine_test.rb
310
319
  - test/new_relic/agent/sampler_test.rb
311
320
  - test/new_relic/agent/shim_agent_test.rb
312
321
  - test/new_relic/agent/sql_sampler_test.rb
313
- - test/new_relic/agent/stats_engine/metric_stats/harvest_test.rb
322
+ - test/new_relic/agent/stats_engine/gc_profiler_test.rb
314
323
  - test/new_relic/agent/stats_engine/metric_stats_test.rb
315
324
  - test/new_relic/agent/stats_engine/samplers_test.rb
316
325
  - test/new_relic/agent/stats_engine_test.rb
326
+ - test/new_relic/agent/stats_hash_test.rb
327
+ - test/new_relic/agent/stats_test.rb
317
328
  - test/new_relic/agent/thread_profiler_test.rb
318
329
  - test/new_relic/agent/thread_test.rb
319
330
  - test/new_relic/agent/threaded_test.rb
@@ -331,8 +342,8 @@ files:
331
342
  - test/new_relic/delayed_job_injection_test.rb
332
343
  - test/new_relic/dispatcher_test.rb
333
344
  - test/new_relic/fake_collector.rb
334
- - test/new_relic/fakes_sending_data.rb
335
345
  - test/new_relic/framework_test.rb
346
+ - test/new_relic/helper_test.rb
336
347
  - test/new_relic/load_test.rb
337
348
  - test/new_relic/local_environment_test.rb
338
349
  - test/new_relic/metric_data_test.rb
@@ -345,7 +356,6 @@ files:
345
356
  - test/new_relic/rack/developer_mode_helper_test.rb
346
357
  - test/new_relic/rack/developer_mode_test.rb
347
358
  - test/new_relic/rack/error_collector_test.rb
348
- - test/new_relic/stats_test.rb
349
359
  - test/new_relic/transaction_analysis/segment_summary_test.rb
350
360
  - test/new_relic/transaction_analysis_test.rb
351
361
  - test/new_relic/transaction_sample/composite_segment_test.rb
@@ -443,38 +453,21 @@ files:
443
453
  - vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_transaction.rb
444
454
  homepage: http://www.github.com/newrelic/rpm
445
455
  licenses: []
446
- post_install_message: ! "\n# New Relic Ruby Agent Release Notes #\n\n## v3.5.6 ##\n\n
447
- \ * Use HTTPS by default\n\n The agent now defaults to using SSL when it communicates
448
- with New Relic's\n servers. By defaults already configured, New Relic does not
449
- transmit any\n sensitive information (e.g. SQL parameters are masked), but SSL
450
- adds \n another layer of security. Upgrading customers may need to remove the\n
451
- \ \"ssl: false\" directive from their newrelic.yml to enable ssl. Customers on\n
452
- \ Jruby may need to install the jruby-openssl gem to take advantage of this\n
453
- \ feature.\n\n * Fix two Resque-related issues\n\n Fixes a possible hang on
454
- exit of an instrumented Resque master process\n (https://github.com/defunkt/resque/issues/578),
455
- as well as a file descriptor\n leak that could occur during startup of the Resque
456
- master process.\n\n * Fix for error graph over 100%\n\n Some errors were double
457
- counted toward the overall error total. This\n resulted in graphs with error
458
- percentages over 100%. This duplication did\n not impact the specific error traces
459
- captured, only the total metric.\n\n * Notice gracefully handled errors in Sinatra\n\n
460
- \ When show_exceptions was set to false in Sinatra, errors weren't caught\n by
461
- New Relic's error collector. Now handled errors also have the chance\n to get
462
- reported back.\n\n * Ruby 2.0 compatibility fixes\n\n Ruby 2.0 no longer finds
463
- protected methods by default, but will with a flag.\n http://tenderlovemaking.com/2012/09/07/protected-methods-and-ruby-2-0.html\n\n
464
- \ Thanks Ravil Bayramgalin and Charlie Somerville for the fixes.\n\n * Auto-detect
465
- Trinidad as dispatcher\n\n Code already existing for detecting Trinidad as a
466
- dispatcher, but was only\n accessible via an ENV variable. This now auto-detects
467
- on startup. Thanks\n Robert Rasmussen for catching that.\n\n * Coercion of types
468
- in collector communication\n\n Certain metrics can be recorded with a Ruby Rational
469
- type, which JSON\n serializes as a string rather than a floating point value.
470
- We now treat\n coerce each outgoing value, and log issues before sending the
471
- data.\n\n * Developer mode fix for chart error\n\n Added require to fix a NameError
472
- in developer mode for summary page. Thanks\n to Ryan B. Harvey.\n\n * Don't
473
- touch deprecated RAILS_ROOT if on Rails 3\n\n Under some odd startup conditions,
474
- we would look for the RAILS_ROOT constant\n after failing to find the ::Rails.root
475
- in a Rails 3 app, causing deprecation\n warnings. Thanks for Adrian Irving-Beer
476
- for the fix.\n\nSee https://github.com/newrelic/rpm/blob/master/CHANGELOG for a
477
- full list of\nchanges.\n"
456
+ post_install_message: ! "\n# New Relic Ruby Agent Release Notes #\n\n## v3.5.8 ##\n\n
457
+ \ * Key Transactions\n\n The Ruby agent now supports Key Transactions! Check
458
+ out more details on the\n feature at https://newrelic.com/docs/site/key-transactions\n\n
459
+ \ * Ruby 2.0\n\n The Ruby agent is compatible with Ruby 2.0.0 which was just
460
+ released.\n\n * Improved Sinatra instrumentation\n\n Several cases around the
461
+ use of conditions and pass in Sinatra are now\n better supported by the Ruby
462
+ agent. Thanks Konstantin for the help!\n\n * Outbound HTTP headers\n\n Adds
463
+ a 'X-NewRelic-ID' header to outbound Net::HTTP requests. This change\n helps
464
+ improve the correlation of performance between services in a service-\n oriented
465
+ architecture for a forthcoming feature. In the meantime, to disable\n the header,
466
+ set this in your newrelic.yml:\n\n cross_application_tracer:\n enabled:
467
+ false\n\n * Automatically detect Resque dispatcher\n\n The agent does better
468
+ auto-detection for the Resque worker process.\n This should reduce the need to
469
+ set NEW_RELIC_DISPATCHER=resque directly.\n\nSee https://github.com/newrelic/rpm/blob/master/CHANGELOG
470
+ for a full list of\nchanges.\n"
478
471
  rdoc_options:
479
472
  - --line-numbers
480
473
  - --inline-source