newrelic_rpm 3.6.0.83 → 3.6.1.85.beta
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +27 -0
- data/Gemfile +2 -7
- data/README.md +1 -1
- data/lib/new_relic/agent/agent.rb +3 -2
- data/lib/new_relic/agent/autostart.rb +56 -0
- data/lib/new_relic/agent/browser_monitoring.rb +19 -14
- data/lib/new_relic/agent/configuration/defaults.rb +12 -2
- data/lib/new_relic/agent/configuration/environment_source.rb +4 -1
- data/lib/new_relic/agent/cross_app_monitor.rb +2 -1
- data/lib/new_relic/agent/cross_app_tracing.rb +19 -10
- data/lib/new_relic/agent/error_collector.rb +5 -4
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +204 -0
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +88 -0
- data/lib/new_relic/agent/instrumentation/active_record.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +84 -0
- data/lib/new_relic/agent/instrumentation/browser_monitoring_timings.rb +3 -2
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +104 -87
- data/lib/new_relic/agent/instrumentation/evented_subscriber.rb +91 -0
- data/lib/new_relic/agent/instrumentation/memcache.rb +4 -4
- data/lib/new_relic/agent/instrumentation/merb/errors.rb +4 -4
- data/lib/new_relic/agent/instrumentation/rack.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +20 -20
- data/lib/new_relic/agent/instrumentation/rails/errors.rb +5 -5
- data/lib/new_relic/agent/instrumentation/rails3/errors.rb +3 -3
- data/lib/new_relic/agent/instrumentation/rails4/action_controller.rb +3 -25
- data/lib/new_relic/agent/instrumentation/rails4/action_view.rb +2 -115
- data/lib/new_relic/agent/instrumentation/rails4/active_record.rb +2 -82
- data/lib/new_relic/agent/instrumentation/rails4/errors.rb +3 -4
- data/lib/new_relic/agent/method_tracer.rb +93 -56
- data/lib/new_relic/agent/null_logger.rb +6 -0
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +9 -4
- data/lib/new_relic/agent/sql_sampler.rb +10 -6
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +19 -3
- data/lib/new_relic/agent/stats_engine/transactions.rb +53 -34
- data/lib/new_relic/agent/system_info.rb +54 -0
- data/lib/new_relic/agent/thread.rb +2 -2
- data/lib/new_relic/agent/transaction/pop.rb +52 -0
- data/lib/new_relic/agent/transaction.rb +388 -0
- data/lib/new_relic/agent/transaction_info.rb +5 -13
- data/lib/new_relic/agent/transaction_sample_builder.rb +13 -20
- data/lib/new_relic/agent/transaction_sampler.rb +13 -15
- data/lib/new_relic/agent/uri_util.rb +35 -0
- data/lib/new_relic/agent.rb +54 -11
- data/lib/new_relic/build.rb +2 -2
- data/lib/new_relic/control/frameworks/rails.rb +0 -1
- data/lib/new_relic/control/frameworks/rails3.rb +2 -0
- data/lib/new_relic/control/frameworks/rails4.rb +0 -4
- data/lib/new_relic/control/instance_methods.rb +5 -19
- data/lib/new_relic/control/server_methods.rb +2 -0
- data/lib/new_relic/environment_report.rb +4 -34
- data/lib/new_relic/latest_changes.rb +1 -1
- data/lib/new_relic/local_environment.rb +0 -6
- data/lib/new_relic/metric_spec.rb +2 -2
- data/lib/new_relic/rack/error_collector.rb +6 -4
- data/lib/new_relic/transaction_sample.rb +7 -1
- data/lib/new_relic/version.rb +1 -1
- data/lib/newrelic_rpm.rb +2 -2
- data/newrelic.yml +20 -20
- data/test/config/test_control.rb +2 -2
- data/test/multiverse/suites/agent_only/audit_log_test.rb +1 -1
- data/test/multiverse/suites/agent_only/cross_application_tracing_test.rb +0 -2
- data/test/multiverse/suites/agent_only/logging_test.rb +1 -1
- data/test/multiverse/suites/agent_only/marshaling_test.rb +5 -3
- data/test/multiverse/suites/agent_only/rename_rule_test.rb +2 -0
- data/test/multiverse/suites/agent_only/set_transaction_name_test.rb +96 -0
- data/test/multiverse/suites/agent_only/testing_app.rb +1 -0
- data/test/multiverse/suites/rails/error_tracing_test.rb +17 -29
- data/test/multiverse/suites/rails/queue_time_test.rb +8 -2
- data/test/multiverse/suites/rails/view_instrumentation_test.rb +6 -3
- data/test/multiverse/suites/resque/instrumentation_test.rb +1 -1
- data/test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb +8 -0
- data/test/new_relic/agent/agent/connect_test.rb +2 -1
- data/test/new_relic/agent/agent/start_test.rb +0 -10
- data/test/new_relic/agent/agent_logger_test.rb +15 -0
- data/test/new_relic/agent/agent_test_controller.rb +6 -2
- data/test/new_relic/agent/agent_test_controller_test.rb +20 -69
- data/test/new_relic/agent/autostart_test.rb +67 -0
- data/test/new_relic/agent/browser_monitoring_test.rb +60 -38
- data/test/new_relic/agent/configuration/environment_source_test.rb +19 -17
- data/test/new_relic/agent/cross_app_monitor_test.rb +8 -0
- data/test/new_relic/agent/error_collector/notice_error_test.rb +0 -5
- data/test/new_relic/agent/error_collector_test.rb +8 -9
- data/test/new_relic/agent/instrumentation/action_controller_subscriber_test.rb +228 -0
- data/test/new_relic/agent/instrumentation/action_view_subscriber_test.rb +18 -34
- data/test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb +5 -5
- data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +8 -9
- data/test/new_relic/agent/instrumentation/browser_monitoring_timings_test.rb +1 -1
- data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +24 -38
- data/test/new_relic/agent/instrumentation/net_instrumentation_test.rb +126 -178
- data/test/new_relic/agent/instrumentation/rack_test.rb +1 -1
- data/test/new_relic/agent/instrumentation/task_instrumentation_test.rb +135 -151
- data/test/new_relic/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb +153 -81
- data/test/new_relic/agent/method_tracer_test.rb +42 -33
- data/test/new_relic/agent/mock_scope_listener.rb +4 -4
- data/test/new_relic/agent/pipe_channel_manager_test.rb +4 -2
- data/test/new_relic/agent/rpm_agent_test.rb +86 -89
- data/test/new_relic/agent/sql_sampler_test.rb +18 -19
- data/test/new_relic/agent/stats_engine/gc_profiler_test.rb +5 -8
- data/test/new_relic/agent/stats_engine/metric_stats_test.rb +20 -8
- data/test/new_relic/agent/stats_engine/samplers_test.rb +31 -14
- data/test/new_relic/agent/stats_engine_test.rb +53 -60
- data/test/new_relic/agent/thread_test.rb +7 -7
- data/test/new_relic/agent/transaction/pop_test.rb +96 -0
- data/test/new_relic/agent/transaction_info_test.rb +6 -17
- data/test/new_relic/agent/transaction_sample_builder_test.rb +10 -18
- data/test/new_relic/agent/transaction_sampler_test.rb +80 -75
- data/test/new_relic/agent/{instrumentation/metric_frame_test.rb → transaction_test.rb} +76 -42
- data/test/new_relic/agent/uri_util_test.rb +75 -0
- data/test/new_relic/agent_test.rb +115 -9
- data/test/test_helper.rb +138 -9
- data.tar.gz.sig +0 -0
- metadata +37 -74
- metadata.gz.sig +0 -0
- data/lib/new_relic/agent/instrumentation/metric_frame/pop.rb +0 -84
- data/lib/new_relic/agent/instrumentation/metric_frame.rb +0 -353
- data/test/new_relic/agent/instrumentation/metric_frame/pop_test.rb +0 -175
- data/test/test_contexts.rb +0 -34
@@ -10,6 +10,7 @@ module NewRelic
|
|
10
10
|
# through the agent method or the control instance through
|
11
11
|
# NewRelic::Control.instance . But it's nice to make sure.
|
12
12
|
class MainAgentTest < Test::Unit::TestCase
|
13
|
+
include NewRelic::Agent::MethodTracer
|
13
14
|
|
14
15
|
def setup
|
15
16
|
NewRelic::Agent.reset_config
|
@@ -71,23 +72,20 @@ module NewRelic
|
|
71
72
|
:start_channel_listener => true)
|
72
73
|
|
73
74
|
metric = 'Custom/test/method'
|
74
|
-
NewRelic::Agent.
|
75
|
-
.record_data_point(1.0)
|
75
|
+
NewRelic::Agent.record_metric(metric, 1.0)
|
76
76
|
|
77
77
|
NewRelic::Agent::PipeChannelManager.listener.close_all_pipes
|
78
78
|
NewRelic::Agent.register_report_channel(:agent_test) # before fork
|
79
79
|
pid = Process.fork do
|
80
80
|
NewRelic::Agent.after_fork(:report_to_channel => :agent_test)
|
81
|
-
NewRelic::Agent.
|
82
|
-
.record_data_point(2.0)
|
81
|
+
NewRelic::Agent.record_metric(metric, 2.0)
|
83
82
|
end
|
84
83
|
Process.wait(pid)
|
85
84
|
NewRelic::Agent::PipeChannelManager.listener.stop
|
86
85
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
engine.reset_stats
|
86
|
+
assert_metrics_recorded({
|
87
|
+
metric => { :call_count => 2, :total_call_time => 3.0 }
|
88
|
+
})
|
91
89
|
end
|
92
90
|
end
|
93
91
|
end
|
@@ -164,7 +162,7 @@ module NewRelic
|
|
164
162
|
end
|
165
163
|
|
166
164
|
def test_abort_transaction_bang
|
167
|
-
NewRelic::Agent::
|
165
|
+
NewRelic::Agent::Transaction.expects(:abort_transaction!)
|
168
166
|
NewRelic::Agent.abort_transaction!
|
169
167
|
end
|
170
168
|
|
@@ -263,6 +261,114 @@ module NewRelic
|
|
263
261
|
NewRelic::Agent.increment_metric('foo', 12)
|
264
262
|
end
|
265
263
|
|
264
|
+
class Transactor
|
265
|
+
include NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
266
|
+
def txn
|
267
|
+
yield
|
268
|
+
end
|
269
|
+
add_transaction_tracer :txn
|
270
|
+
|
271
|
+
def task_txn
|
272
|
+
yield
|
273
|
+
end
|
274
|
+
add_transaction_tracer :task_txn, :category => :task
|
275
|
+
end
|
276
|
+
|
277
|
+
def test_set_transaction_name
|
278
|
+
engine = NewRelic::Agent.instance.stats_engine
|
279
|
+
engine.reset_stats
|
280
|
+
Transactor.new.txn do
|
281
|
+
NewRelic::Agent.set_transaction_name('new_name')
|
282
|
+
end
|
283
|
+
assert engine.lookup_stats('Controller/new_name')
|
284
|
+
end
|
285
|
+
|
286
|
+
def test_get_transaction_name_returns_nil_outside_transaction
|
287
|
+
assert_equal nil, NewRelic::Agent.get_transaction_name
|
288
|
+
end
|
289
|
+
|
290
|
+
def test_get_transaction_name_returns_the_default_txn_name
|
291
|
+
engine = NewRelic::Agent.instance.stats_engine
|
292
|
+
engine.reset_stats
|
293
|
+
Transactor.new.txn do
|
294
|
+
assert_equal 'NewRelic::MainAgentTest::Transactor/txn', NewRelic::Agent.get_transaction_name
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
298
|
+
def test_get_transaction_name_returns_what_I_set
|
299
|
+
engine = NewRelic::Agent.instance.stats_engine
|
300
|
+
engine.reset_stats
|
301
|
+
Transactor.new.txn do
|
302
|
+
NewRelic::Agent.set_transaction_name('a_new_name')
|
303
|
+
assert_equal 'a_new_name', NewRelic::Agent.get_transaction_name
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
def test_get_txn_name_and_set_txn_name_preserves_category
|
308
|
+
engine = NewRelic::Agent.instance.stats_engine
|
309
|
+
engine.reset_stats
|
310
|
+
Transactor.new.txn do
|
311
|
+
NewRelic::Agent.set_transaction_name('a_new_name', :category => :task)
|
312
|
+
new_name = NewRelic::Agent.get_transaction_name + "2"
|
313
|
+
NewRelic::Agent.set_transaction_name(new_name)
|
314
|
+
end
|
315
|
+
assert engine.lookup_stats('OtherTransaction/Background/a_new_name2')
|
316
|
+
end
|
317
|
+
|
318
|
+
def test_set_transaction_name_applies_proper_scopes
|
319
|
+
engine = NewRelic::Agent.instance.stats_engine
|
320
|
+
engine.reset_stats
|
321
|
+
Transactor.new.txn do
|
322
|
+
trace_execution_scoped('Custom/something') {}
|
323
|
+
NewRelic::Agent.set_transaction_name('new_name')
|
324
|
+
end
|
325
|
+
assert engine.lookup_stats('Custom/something', 'Controller/new_name')
|
326
|
+
end
|
327
|
+
|
328
|
+
def test_set_transaction_name_sets_tt_name
|
329
|
+
sampler = NewRelic::Agent.instance.transaction_sampler
|
330
|
+
Transactor.new.txn do
|
331
|
+
NewRelic::Agent.set_transaction_name('new_name')
|
332
|
+
end
|
333
|
+
assert_equal 'Controller/new_name', sampler.last_sample.params[:path]
|
334
|
+
end
|
335
|
+
|
336
|
+
def test_set_transaction_name_gracefully_fails_when_frozen
|
337
|
+
engine = NewRelic::Agent.instance.stats_engine
|
338
|
+
engine.reset_stats
|
339
|
+
Transactor.new.txn do
|
340
|
+
NewRelic::Agent::Transaction.current.freeze_name
|
341
|
+
NewRelic::Agent.set_transaction_name('new_name')
|
342
|
+
end
|
343
|
+
assert_nil engine.lookup_stats('Controller/new_name')
|
344
|
+
end
|
345
|
+
|
346
|
+
def test_set_transaction_name_applies_category
|
347
|
+
engine = NewRelic::Agent.instance.stats_engine
|
348
|
+
engine.reset_stats
|
349
|
+
Transactor.new.txn do
|
350
|
+
NewRelic::Agent.set_transaction_name('new_name', :category => :task)
|
351
|
+
end
|
352
|
+
assert engine.lookup_stats('OtherTransaction/Background/new_name')
|
353
|
+
Transactor.new.txn do
|
354
|
+
NewRelic::Agent.set_transaction_name('new_name', :category => :rack)
|
355
|
+
end
|
356
|
+
assert engine.lookup_stats('Controller/Rack/new_name')
|
357
|
+
Transactor.new.txn do
|
358
|
+
NewRelic::Agent.set_transaction_name('new_name', :category => :sinatra)
|
359
|
+
end
|
360
|
+
assert engine.lookup_stats('Controller/Sinatra/new_name')
|
361
|
+
end
|
362
|
+
|
363
|
+
def test_set_transaction_name_uses_current_txn_category_default
|
364
|
+
engine = NewRelic::Agent.instance.stats_engine
|
365
|
+
engine.reset_stats
|
366
|
+
Transactor.new.task_txn do
|
367
|
+
NewRelic::Agent.set_transaction_name('new_name')
|
368
|
+
end
|
369
|
+
assert engine.lookup_stats('OtherTransaction/Background/new_name')
|
370
|
+
end
|
371
|
+
|
266
372
|
private
|
267
373
|
|
268
374
|
def mocked_agent
|
data/test/test_helper.rb
CHANGED
@@ -55,7 +55,6 @@ rescue LoadError => e
|
|
55
55
|
end
|
56
56
|
|
57
57
|
require 'test/unit'
|
58
|
-
require 'shoulda'
|
59
58
|
begin
|
60
59
|
require 'mocha/setup'
|
61
60
|
rescue LoadError
|
@@ -80,6 +79,7 @@ def default_service(stubbed_method_overrides = {})
|
|
80
79
|
:metric_data => nil,
|
81
80
|
:error_data => nil,
|
82
81
|
:transaction_sample_data => nil,
|
82
|
+
:sql_trace_data => nil,
|
83
83
|
:get_agent_commands => []
|
84
84
|
}
|
85
85
|
|
@@ -106,9 +106,13 @@ def assert_between(floor, ceiling, value, message="expected #{floor} <= #{value}
|
|
106
106
|
assert((floor <= value && value <= ceiling), message)
|
107
107
|
end
|
108
108
|
|
109
|
+
def assert_in_delta(expected, actual, delta)
|
110
|
+
assert_between((expected - delta), (expected + delta), actual)
|
111
|
+
end
|
112
|
+
|
109
113
|
def check_metric_time(metric, value, delta)
|
110
114
|
time = NewRelic::Agent.get_stats(metric).total_call_time
|
111
|
-
|
115
|
+
assert_in_delta(value, time, delta)
|
112
116
|
end
|
113
117
|
|
114
118
|
def check_metric_count(metric, value)
|
@@ -175,6 +179,76 @@ def compare_metrics(expected, actual)
|
|
175
179
|
assert_equal(expected.to_a.sort, actual.to_a.sort, "extra: #{(actual - expected).to_a.inspect}; missing: #{(expected - actual).to_a.inspect}")
|
176
180
|
end
|
177
181
|
|
182
|
+
def metric_spec_from_specish(specish)
|
183
|
+
spec = case specish
|
184
|
+
when String then NewRelic::MetricSpec.new(specish)
|
185
|
+
when Array then NewRelic::MetricSpec.new(*specish)
|
186
|
+
end
|
187
|
+
spec
|
188
|
+
end
|
189
|
+
|
190
|
+
def _normalize_metric_expectations(expectations)
|
191
|
+
case expectations
|
192
|
+
when Array
|
193
|
+
hash = {}
|
194
|
+
expectations.each { |k| hash[k] = { :call_count => 1 } }
|
195
|
+
hash
|
196
|
+
else
|
197
|
+
expectations
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
def assert_metrics_recorded(expected)
|
202
|
+
expected = _normalize_metric_expectations(expected)
|
203
|
+
expected.each do |specish, expected_attrs|
|
204
|
+
expected_spec = metric_spec_from_specish(specish)
|
205
|
+
actual_stats = NewRelic::Agent.instance.stats_engine.lookup_stats(*Array(specish))
|
206
|
+
if !actual_stats
|
207
|
+
all_specs = NewRelic::Agent.instance.stats_engine.metric_specs
|
208
|
+
matches = all_specs.select { |spec| spec.name == expected_spec.name }
|
209
|
+
matches.map! { |m| " #{m.inspect}" }
|
210
|
+
msg = "Did not find stats for spec #{expected_spec.inspect}."
|
211
|
+
msg += "\nDid find specs: [\n#{matches.join(",\n")}\n]" unless matches.empty?
|
212
|
+
assert(actual_stats, msg)
|
213
|
+
end
|
214
|
+
expected_attrs.each do |attr, expected_value|
|
215
|
+
actual_value = actual_stats.send(attr)
|
216
|
+
if attr == :call_count
|
217
|
+
assert_equal(expected_value, actual_value,
|
218
|
+
"Expected #{attr} for #{expected_spec} to be #{expected_value}, got #{actual_value}")
|
219
|
+
else
|
220
|
+
assert_in_delta(expected_value, actual_value, 0.0001,
|
221
|
+
"Expected #{attr} for #{expected_spec} to be ~#{expected_value}, got #{actual_value}")
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
def assert_metrics_recorded_exclusive(expected, options={})
|
228
|
+
expected = _normalize_metric_expectations(expected)
|
229
|
+
assert_metrics_recorded(expected)
|
230
|
+
recorded_metrics = NewRelic::Agent.instance.stats_engine.metrics
|
231
|
+
if options[:filter]
|
232
|
+
recorded_metrics = recorded_metrics.select { |m| m.match(options[:filter]) }
|
233
|
+
end
|
234
|
+
expected_metrics = expected.keys.map { |s| metric_spec_from_specish(s).to_s }
|
235
|
+
unexpected_metrics = recorded_metrics.select{|m| m !~ /GC\/cumulative/}
|
236
|
+
unexpected_metrics -= expected_metrics
|
237
|
+
assert_equal(0, unexpected_metrics.size, "Found unexpected metrics: [#{unexpected_metrics.join(', ')}]")
|
238
|
+
end
|
239
|
+
|
240
|
+
def assert_metrics_not_recorded(not_expected)
|
241
|
+
not_expected = _normalize_metric_expectations(not_expected)
|
242
|
+
found_but_not_expected = []
|
243
|
+
not_expected.each do |specish, _|
|
244
|
+
spec = metric_spec_from_specish(specish)
|
245
|
+
if NewRelic::Agent.instance.stats_engine.lookup_stats(*Array(specish))
|
246
|
+
found_but_not_expected << spec
|
247
|
+
end
|
248
|
+
end
|
249
|
+
assert_equal([], found_but_not_expected, "Found unexpected metrics: [#{found_but_not_expected.join(', ')}]")
|
250
|
+
end
|
251
|
+
|
178
252
|
def with_config(config_hash, opts={})
|
179
253
|
opts = { :level => 0, :do_not_cast => false }.merge(opts)
|
180
254
|
if opts[:do_not_cast]
|
@@ -211,35 +285,90 @@ ensure
|
|
211
285
|
::NewRelic::Agent.logger = logger
|
212
286
|
end
|
213
287
|
|
288
|
+
def in_transaction(name='dummy')
|
289
|
+
NewRelic::Agent.instance.instance_variable_set(:@transaction_sampler,
|
290
|
+
NewRelic::Agent::TransactionSampler.new)
|
291
|
+
NewRelic::Agent.instance.stats_engine.transaction_sampler = \
|
292
|
+
NewRelic::Agent.instance.transaction_sampler
|
293
|
+
NewRelic::Agent::Transaction.start(:other)
|
294
|
+
val = yield
|
295
|
+
NewRelic::Agent::Transaction.stop(name)
|
296
|
+
val
|
297
|
+
end
|
298
|
+
|
299
|
+
def freeze_time(now=Time.now)
|
300
|
+
Time.stubs(:now).returns(now)
|
301
|
+
end
|
302
|
+
|
303
|
+
def advance_time(seconds)
|
304
|
+
freeze_time(Time.now + seconds)
|
305
|
+
end
|
306
|
+
|
214
307
|
module NewRelic
|
215
308
|
def self.fixture_path(name)
|
216
309
|
File.join(File.dirname(__FILE__), 'fixtures', name)
|
217
310
|
end
|
218
311
|
end
|
219
312
|
|
313
|
+
def fixture_tcp_socket( response )
|
314
|
+
# Don't actually talk to Google.
|
315
|
+
socket = stub("socket") do
|
316
|
+
stubs(:closed?).returns(false)
|
317
|
+
stubs(:close)
|
318
|
+
|
319
|
+
# Simulate a bunch of socket-ey stuff since Mocha doesn't really
|
320
|
+
# provide any other way to do it
|
321
|
+
class << self
|
322
|
+
attr_accessor :response, :write_checker
|
323
|
+
end
|
324
|
+
|
325
|
+
def self.check_write
|
326
|
+
self.write_checker = Proc.new
|
327
|
+
end
|
328
|
+
|
329
|
+
def self.write( buf )
|
330
|
+
self.write_checker.call( buf ) if self.write_checker
|
331
|
+
buf.length
|
332
|
+
end
|
333
|
+
|
334
|
+
def self.sysread( size, buf='' )
|
335
|
+
@data ||= response.to_s
|
336
|
+
raise EOFError if @data.empty?
|
337
|
+
buf.replace @data.slice!( 0, size )
|
338
|
+
buf
|
339
|
+
end
|
340
|
+
class << self
|
341
|
+
alias_method :read_nonblock, :sysread
|
342
|
+
end
|
343
|
+
|
344
|
+
end
|
345
|
+
|
346
|
+
socket.response = response
|
347
|
+
TCPSocket.stubs( :open ).returns( socket )
|
348
|
+
|
349
|
+
return socket
|
350
|
+
end
|
351
|
+
|
220
352
|
module TransactionSampleTestHelper
|
221
353
|
module_function
|
222
354
|
def make_sql_transaction(*sql)
|
223
355
|
sampler = NewRelic::Agent::TransactionSampler.new
|
224
356
|
sampler.notice_first_scope_push Time.now.to_f
|
225
|
-
sampler.notice_transaction
|
357
|
+
sampler.notice_transaction(nil, :jim => "cool")
|
226
358
|
sampler.notice_push_scope "a"
|
227
|
-
|
228
|
-
sampler.notice_transaction '/path/2', nil, :jim => "cool"
|
229
|
-
|
230
359
|
sql.each {|sql_statement| sampler.notice_sql(sql_statement, {:adapter => "test"}, 0 ) }
|
231
360
|
|
232
361
|
sleep 0.02
|
233
362
|
yield if block_given?
|
234
363
|
sampler.notice_pop_scope "a"
|
235
|
-
sampler.notice_scope_empty
|
364
|
+
sampler.notice_scope_empty(stub('txn', :name => '/path', :custom_parameters => {}))
|
236
365
|
|
237
366
|
sampler.samples[0]
|
238
367
|
end
|
239
368
|
|
240
369
|
def run_sample_trace_on(sampler, path='/path')
|
241
370
|
sampler.notice_first_scope_push Time.now.to_f
|
242
|
-
sampler.notice_transaction
|
371
|
+
sampler.notice_transaction(path, {})
|
243
372
|
sampler.notice_push_scope "Controller/sandwiches/index"
|
244
373
|
sampler.notice_sql("SELECT * FROM sandwiches WHERE bread = 'wheat'", nil, 0)
|
245
374
|
sampler.notice_push_scope "ab"
|
@@ -250,7 +379,7 @@ module TransactionSampleTestHelper
|
|
250
379
|
sampler.notice_sql("SELECT * FROM sandwiches WHERE bread = 'french'", nil, 0)
|
251
380
|
sampler.notice_pop_scope "lew"
|
252
381
|
sampler.notice_pop_scope "Controller/sandwiches/index"
|
253
|
-
sampler.notice_scope_empty
|
382
|
+
sampler.notice_scope_empty(stub('txn', :name => path, :custom_parameters => {}))
|
254
383
|
sampler.samples[0]
|
255
384
|
end
|
256
385
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.6.
|
5
|
-
prerelease:
|
4
|
+
version: 3.6.1.85.beta
|
5
|
+
prerelease: 9
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jason Clark
|
@@ -41,7 +41,7 @@ cert_chain:
|
|
41
41
|
cHUySWFQWE92bTNUOEc0TzZxWnZobkxoL1VpZW4rK0RqOGVGQmVjVFBvTThw
|
42
42
|
VmpLM3BoNQpuL0V3dVpDY0U2Z2h0Q0NNCi0tLS0tRU5EIENFUlRJRklDQVRF
|
43
43
|
LS0tLS0K
|
44
|
-
date: 2013-04-
|
44
|
+
date: 2013-04-16 00:00:00.000000000 Z
|
45
45
|
dependencies: []
|
46
46
|
description: ! 'New Relic is a performance management system, developed by New Relic,
|
47
47
|
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/new_relic/agent/agent.rb
|
96
96
|
- lib/new_relic/agent/agent_logger.rb
|
97
97
|
- lib/new_relic/agent/audit_logger.rb
|
98
|
+
- lib/new_relic/agent/autostart.rb
|
98
99
|
- lib/new_relic/agent/beacon_configuration.rb
|
99
100
|
- lib/new_relic/agent/browser_monitoring.rb
|
100
101
|
- lib/new_relic/agent/busy_calculator.rb
|
@@ -112,20 +113,22 @@ files:
|
|
112
113
|
- lib/new_relic/agent/error_collector.rb
|
113
114
|
- lib/new_relic/agent/event_listener.rb
|
114
115
|
- lib/new_relic/agent/instrumentation.rb
|
116
|
+
- lib/new_relic/agent/instrumentation/action_controller_subscriber.rb
|
117
|
+
- lib/new_relic/agent/instrumentation/action_view_subscriber.rb
|
115
118
|
- lib/new_relic/agent/instrumentation/active_merchant.rb
|
116
119
|
- lib/new_relic/agent/instrumentation/active_record.rb
|
117
120
|
- lib/new_relic/agent/instrumentation/active_record_helper.rb
|
121
|
+
- lib/new_relic/agent/instrumentation/active_record_subscriber.rb
|
118
122
|
- lib/new_relic/agent/instrumentation/acts_as_solr.rb
|
119
123
|
- lib/new_relic/agent/instrumentation/authlogic.rb
|
120
124
|
- lib/new_relic/agent/instrumentation/browser_monitoring_timings.rb
|
121
125
|
- lib/new_relic/agent/instrumentation/controller_instrumentation.rb
|
122
126
|
- lib/new_relic/agent/instrumentation/data_mapper.rb
|
123
127
|
- lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb
|
128
|
+
- lib/new_relic/agent/instrumentation/evented_subscriber.rb
|
124
129
|
- lib/new_relic/agent/instrumentation/memcache.rb
|
125
130
|
- lib/new_relic/agent/instrumentation/merb/controller.rb
|
126
131
|
- lib/new_relic/agent/instrumentation/merb/errors.rb
|
127
|
-
- lib/new_relic/agent/instrumentation/metric_frame.rb
|
128
|
-
- lib/new_relic/agent/instrumentation/metric_frame/pop.rb
|
129
132
|
- lib/new_relic/agent/instrumentation/net.rb
|
130
133
|
- lib/new_relic/agent/instrumentation/passenger_instrumentation.rb
|
131
134
|
- lib/new_relic/agent/instrumentation/queue_time.rb
|
@@ -165,11 +168,15 @@ files:
|
|
165
168
|
- lib/new_relic/agent/stats_engine/samplers.rb
|
166
169
|
- lib/new_relic/agent/stats_engine/stats_hash.rb
|
167
170
|
- lib/new_relic/agent/stats_engine/transactions.rb
|
171
|
+
- lib/new_relic/agent/system_info.rb
|
168
172
|
- lib/new_relic/agent/thread.rb
|
169
173
|
- lib/new_relic/agent/thread_profiler.rb
|
174
|
+
- lib/new_relic/agent/transaction.rb
|
175
|
+
- lib/new_relic/agent/transaction/pop.rb
|
170
176
|
- lib/new_relic/agent/transaction_info.rb
|
171
177
|
- lib/new_relic/agent/transaction_sample_builder.rb
|
172
178
|
- lib/new_relic/agent/transaction_sampler.rb
|
179
|
+
- lib/new_relic/agent/uri_util.rb
|
173
180
|
- lib/new_relic/agent/worker_loop.rb
|
174
181
|
- lib/new_relic/coerce.rb
|
175
182
|
- lib/new_relic/collection_helper.rb
|
@@ -258,6 +265,7 @@ files:
|
|
258
265
|
- test/multiverse/suites/agent_only/rename_rule_test.rb
|
259
266
|
- test/multiverse/suites/agent_only/rum_instrumentation_test.rb
|
260
267
|
- test/multiverse/suites/agent_only/service_timeout_test.rb
|
268
|
+
- test/multiverse/suites/agent_only/set_transaction_name_test.rb
|
261
269
|
- test/multiverse/suites/agent_only/ssl_test.rb
|
262
270
|
- test/multiverse/suites/agent_only/start_up_test.rb
|
263
271
|
- test/multiverse/suites/agent_only/test_trace_method_with_punctuation.rb
|
@@ -321,6 +329,7 @@ files:
|
|
321
329
|
- test/new_relic/agent/agent_test_controller_test.rb
|
322
330
|
- test/new_relic/agent/apdex_from_server_test.rb
|
323
331
|
- test/new_relic/agent/audit_logger_test.rb
|
332
|
+
- test/new_relic/agent/autostart_test.rb
|
324
333
|
- test/new_relic/agent/beacon_configuration_test.rb
|
325
334
|
- test/new_relic/agent/browser_monitoring_test.rb
|
326
335
|
- test/new_relic/agent/busy_calculator_test.rb
|
@@ -333,6 +342,7 @@ files:
|
|
333
342
|
- test/new_relic/agent/error_collector/notice_error_test.rb
|
334
343
|
- test/new_relic/agent/error_collector_test.rb
|
335
344
|
- test/new_relic/agent/event_listener_test.rb
|
345
|
+
- test/new_relic/agent/instrumentation/action_controller_subscriber_test.rb
|
336
346
|
- test/new_relic/agent/instrumentation/action_view_subscriber_test.rb
|
337
347
|
- test/new_relic/agent/instrumentation/active_record_helper_test.rb
|
338
348
|
- test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb
|
@@ -340,8 +350,6 @@ files:
|
|
340
350
|
- test/new_relic/agent/instrumentation/browser_monitoring_timings_test.rb
|
341
351
|
- test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
|
342
352
|
- test/new_relic/agent/instrumentation/instrumentation_test.rb
|
343
|
-
- test/new_relic/agent/instrumentation/metric_frame/pop_test.rb
|
344
|
-
- test/new_relic/agent/instrumentation/metric_frame_test.rb
|
345
353
|
- test/new_relic/agent/instrumentation/net_instrumentation_test.rb
|
346
354
|
- test/new_relic/agent/instrumentation/queue_time_test.rb
|
347
355
|
- test/new_relic/agent/instrumentation/rack_test.rb
|
@@ -369,9 +377,12 @@ files:
|
|
369
377
|
- test/new_relic/agent/thread_profiler_test.rb
|
370
378
|
- test/new_relic/agent/thread_test.rb
|
371
379
|
- test/new_relic/agent/threaded_test.rb
|
380
|
+
- test/new_relic/agent/transaction/pop_test.rb
|
372
381
|
- test/new_relic/agent/transaction_info_test.rb
|
373
382
|
- test/new_relic/agent/transaction_sample_builder_test.rb
|
374
383
|
- test/new_relic/agent/transaction_sampler_test.rb
|
384
|
+
- test/new_relic/agent/transaction_test.rb
|
385
|
+
- test/new_relic/agent/uri_util_test.rb
|
375
386
|
- test/new_relic/agent/worker_loop_test.rb
|
376
387
|
- test/new_relic/agent_test.rb
|
377
388
|
- test/new_relic/coerce_test.rb
|
@@ -413,7 +424,6 @@ files:
|
|
413
424
|
- test/script/ci_agent-tests_runner.sh
|
414
425
|
- test/script/ci_bench.sh
|
415
426
|
- test/script/ci_multiverse_runner.sh
|
416
|
-
- test/test_contexts.rb
|
417
427
|
- test/test_helper.rb
|
418
428
|
- ui/helpers/developer_mode_helper.rb
|
419
429
|
- ui/helpers/google_pie_chart.rb
|
@@ -496,72 +506,25 @@ files:
|
|
496
506
|
- lib/new_relic/build.rb
|
497
507
|
homepage: http://www.github.com/newrelic/rpm
|
498
508
|
licenses: []
|
499
|
-
post_install_message: !
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
The primary metrics data structures in the Ruby agent are now thread safe.
|
521
|
-
|
522
|
-
This should provide better reliability for the agent under JRuby and threaded
|
523
|
-
|
524
|
-
scenarios such as Sidekiq or Puma.
|
525
|
-
|
526
|
-
|
527
|
-
* More robust environment report
|
528
|
-
|
529
|
-
|
530
|
-
The agent''s analysis of the local environment (e.g. OS, Processors, loaded
|
531
|
-
|
532
|
-
gems) will now work in a wider variety of app environments, including
|
533
|
-
|
534
|
-
Sinatra.
|
535
|
-
|
536
|
-
|
537
|
-
* Experimental Rainbows! support
|
538
|
-
|
539
|
-
|
540
|
-
The Ruby agent now automatically detects and instruments the Rainbows! web
|
541
|
-
|
542
|
-
server. This support is considered experimental at present, and has not been
|
543
|
-
|
544
|
-
tested with all dispatch modes.
|
545
|
-
|
546
|
-
|
547
|
-
Thanks to Joseph Chen for the contribution.
|
548
|
-
|
549
|
-
|
550
|
-
* Fix a potential file descriptor leak in Resque instrumentation
|
551
|
-
|
552
|
-
|
553
|
-
A file descriptor leak that occurred when DontPerform exceptions were used to
|
554
|
-
|
555
|
-
abort processing of a job has been fixed. This should allow the Resque
|
556
|
-
|
557
|
-
instrumentation work correctly with the resque-lonely_job gem.
|
558
|
-
|
559
|
-
|
560
|
-
See https://github.com/newrelic/rpm/blob/master/CHANGELOG for a full list of
|
561
|
-
|
562
|
-
changes.
|
563
|
-
|
564
|
-
'
|
509
|
+
post_install_message: ! "\n# New Relic Ruby Agent Release Notes #\n\n## v3.6.1 ##\n\n*
|
510
|
+
Full URIs for HTTP requests are recorded in transaction traces\n\n When recording
|
511
|
+
a transaction trace node for an outgoing HTTP call via\n Net::HTTP, the agent will
|
512
|
+
now save the full URI (instead of just the hostname)\n for the request. Embedded
|
513
|
+
credentials, the query string, and the fragment will\n be stripped from the URI
|
514
|
+
before it is saved.\n\n* Simplify Agent Autostart Logic\n\n Previously the agent
|
515
|
+
would only start when it detected a supported\n \"Dispatcher\", meaning a known
|
516
|
+
web server or background task framework. This\n was problematic for customers
|
517
|
+
using webservers that the agent was not\n configured to detect (e.g. Puma). Now
|
518
|
+
the agent will attempt to report any\n time it detects it is running in a monitored
|
519
|
+
environment (e.g. production).\n There are two exceptions to this. The agent will
|
520
|
+
not autostart in a rails\n console or irb session or when the process was invoked
|
521
|
+
by a rake task (e.g.\n rake assets:precompile). The NEWRELIC_ENABLE environment
|
522
|
+
variable can be set\n to true or false to force the agent to start or not start.\n\n*
|
523
|
+
Don't attempt to resolve collector hostname when proxy is in use\n\n When a proxy
|
524
|
+
is configured, the agent will not attempt to lookup and cache the\n IP address
|
525
|
+
of New Relic server to which it is sending data, since DNS may not\n be available
|
526
|
+
in some environments. Thanks to Bill Kirtley for the contribution\n\nSee https://github.com/newrelic/rpm/blob/master/CHANGELOG
|
527
|
+
for a full list of\nchanges.\n"
|
565
528
|
rdoc_options:
|
566
529
|
- --line-numbers
|
567
530
|
- --inline-source
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,84 +0,0 @@
|
|
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 'new_relic/agent/instrumentation'
|
6
|
-
module NewRelic
|
7
|
-
module Agent
|
8
|
-
module Instrumentation
|
9
|
-
class MetricFrame
|
10
|
-
module Pop
|
11
|
-
|
12
|
-
def clear_thread_metric_frame!
|
13
|
-
Thread.current[:newrelic_metric_frame] = nil
|
14
|
-
end
|
15
|
-
|
16
|
-
def set_new_scope!(metric)
|
17
|
-
agent.stats_engine.scope_name = metric
|
18
|
-
end
|
19
|
-
|
20
|
-
def log_underflow
|
21
|
-
::NewRelic::Agent.logger.error "Underflow in metric frames: #{caller.join("\n ")}"
|
22
|
-
end
|
23
|
-
|
24
|
-
def notice_scope_empty
|
25
|
-
transaction_sampler.notice_scope_empty
|
26
|
-
sql_sampler.notice_scope_empty
|
27
|
-
end
|
28
|
-
|
29
|
-
def record_transaction_cpu
|
30
|
-
burn = cpu_burn
|
31
|
-
transaction_sampler.notice_transaction_cpu_time(burn) if burn
|
32
|
-
end
|
33
|
-
|
34
|
-
def normal_cpu_burn
|
35
|
-
return unless @process_cpu_start
|
36
|
-
process_cpu - @process_cpu_start
|
37
|
-
end
|
38
|
-
|
39
|
-
def jruby_cpu_burn
|
40
|
-
return unless @jruby_cpu_start
|
41
|
-
burn = (jruby_cpu_time - @jruby_cpu_start)
|
42
|
-
record_jruby_cpu_burn(burn)
|
43
|
-
burn
|
44
|
-
end
|
45
|
-
|
46
|
-
# we need to do this here because the normal cpu sampler
|
47
|
-
# process doesn't work on JRuby. See the cpu_sampler.rb file
|
48
|
-
# to understand where cpu is recorded for non-jruby processes
|
49
|
-
def record_jruby_cpu_burn(burn)
|
50
|
-
NewRelic::Agent.record_metric(NewRelic::Metrics::USER_TIME, burn)
|
51
|
-
end
|
52
|
-
|
53
|
-
def cpu_burn
|
54
|
-
normal_cpu_burn || jruby_cpu_burn
|
55
|
-
end
|
56
|
-
|
57
|
-
def end_transaction!
|
58
|
-
agent.stats_engine.end_transaction
|
59
|
-
end
|
60
|
-
|
61
|
-
def notify_transaction_sampler(web_transaction)
|
62
|
-
record_transaction_cpu
|
63
|
-
notice_scope_empty
|
64
|
-
end
|
65
|
-
|
66
|
-
def traced?
|
67
|
-
NewRelic::Agent.is_execution_traced?
|
68
|
-
end
|
69
|
-
|
70
|
-
def handle_empty_path_stack(metric)
|
71
|
-
raise 'path stack not empty' unless @path_stack.empty?
|
72
|
-
notify_transaction_sampler(metric.is_web_transaction?) if traced?
|
73
|
-
end_transaction!
|
74
|
-
clear_thread_metric_frame!
|
75
|
-
end
|
76
|
-
|
77
|
-
def current_stack_metric
|
78
|
-
metric_name
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|