newrelic_rpm 3.6.3.111 → 3.6.4.113.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/CHANGELOG +14 -1
  2. data/lib/new_relic/agent/agent.rb +14 -6
  3. data/lib/new_relic/agent/configuration/defaults.rb +8 -3
  4. data/lib/new_relic/agent/configuration/manager.rb +32 -1
  5. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +2 -2
  6. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +7 -11
  7. data/lib/new_relic/agent/instrumentation/resque.rb +2 -1
  8. data/lib/new_relic/agent/method_tracer.rb +4 -6
  9. data/lib/new_relic/agent/pipe_service.rb +4 -0
  10. data/lib/new_relic/agent/request_sampler.rb +46 -1
  11. data/lib/new_relic/agent/stats_engine/metric_stats.rb +11 -10
  12. data/lib/new_relic/agent/stats_engine/stats_hash.rb +12 -0
  13. data/lib/new_relic/agent/stats_engine/transactions.rb +1 -28
  14. data/lib/new_relic/agent/thread_profiler.rb +3 -3
  15. data/lib/new_relic/agent/transaction.rb +29 -15
  16. data/lib/new_relic/build.rb +2 -2
  17. data/lib/new_relic/noticed_error.rb +28 -12
  18. data/lib/new_relic/version.rb +1 -1
  19. data/test/agent_helper.rb +25 -0
  20. data/test/multiverse/suites/agent_only/key_transactions_test.rb +11 -11
  21. data/test/multiverse/suites/rails/request_statistics_test.rb +14 -20
  22. data/test/multiverse/suites/resque/Envfile +0 -1
  23. data/test/multiverse/suites/resque/config/newrelic.yml +1 -1
  24. data/test/multiverse/suites/resque/instrumentation_test.rb +16 -107
  25. data/test/new_relic/agent/agent/connect_test.rb +3 -3
  26. data/test/new_relic/agent/agent/start_test.rb +2 -0
  27. data/test/new_relic/agent/configuration/manager_test.rb +10 -0
  28. data/test/new_relic/agent/error_collector_test.rb +9 -9
  29. data/test/new_relic/agent/method_tracer_test.rb +8 -1
  30. data/test/new_relic/agent/request_sampler_test.rb +10 -0
  31. data/test/new_relic/agent/stats_engine/metric_stats_test.rb +40 -4
  32. data/test/new_relic/agent/transaction_test.rb +23 -0
  33. data/test/new_relic/noticed_error_test.rb +84 -2
  34. data/test/test_helper.rb +2 -16
  35. data.tar.gz.sig +0 -0
  36. metadata +11 -6
  37. metadata.gz.sig +0 -0
@@ -140,7 +140,7 @@ EOF
140
140
 
141
141
  @worker_loop.run(@interval) do
142
142
  NewRelic::Agent.instance.stats_engine.
143
- record_supportability_metrics_timed("ThreadProfiler/PollingTime") do
143
+ record_supportability_metric_timed("ThreadProfiler/PollingTime") do
144
144
 
145
145
  @poll_count += 1
146
146
  AgentThread.list.each do |t|
@@ -161,7 +161,7 @@ EOF
161
161
  mark_done
162
162
  ::NewRelic::Agent.logger.debug("Finished thread profile. #{@sample_count} backtraces, #{@failure_count} failures. Will send with next harvest.")
163
163
  NewRelic::Agent.instance.stats_engine.
164
- record_supportability_metrics_count(@failure_count, "ThreadProfiler/BacktraceFailures")
164
+ record_supportability_metric_count("ThreadProfiler/BacktraceFailures", @failure_count)
165
165
  end
166
166
  end
167
167
 
@@ -197,7 +197,7 @@ EOF
197
197
  @flattened_nodes.sort!(&:order_for_pruning)
198
198
 
199
199
  NewRelic::Agent.instance.stats_engine.
200
- record_supportability_metrics_count(@flattened_nodes.size, "ThreadProfiler/NodeCount")
200
+ record_supportability_metric_count("ThreadProfiler/NodeCount", @flattened_nodes.size)
201
201
 
202
202
  mark_for_pruning(@flattened_nodes, count_to_keep)
203
203
 
@@ -23,6 +23,7 @@ module NewRelic
23
23
  attr_accessor(:type, :exceptions, :filtered_params, :force_flag,
24
24
  :jruby_cpu_start, :process_cpu_start, :database_metric_name)
25
25
  attr_reader :name
26
+ attr_reader :stats_hash
26
27
 
27
28
  # Give the current transaction a request context. Use this to
28
29
  # get the URI and referer. The request is interpreted loosely
@@ -30,12 +31,15 @@ module NewRelic
30
31
  attr_accessor :request
31
32
 
32
33
 
33
- # Return the currently active transaction, or nil. Call with +true+
34
- # to create a new transaction if one is not already on the thread.
34
+ # Return the currently active transaction, or nil.
35
35
  def self.current
36
36
  self.stack.last
37
37
  end
38
38
 
39
+ def self.parent
40
+ self.stack[-2]
41
+ end
42
+
39
43
  def self.start(transaction_type, options={})
40
44
  txn = Transaction.new(transaction_type, options)
41
45
  txn.start(transaction_type)
@@ -44,9 +48,9 @@ module NewRelic
44
48
  end
45
49
 
46
50
  def self.stop(metric_name=nil, end_time=Time.now)
47
- txn = self.stack.pop
51
+ txn = self.stack.last
48
52
  txn.stop(metric_name, end_time) if txn
49
- return txn
53
+ return self.stack.pop
50
54
  end
51
55
 
52
56
  def self.stack
@@ -98,6 +102,7 @@ module NewRelic
98
102
  @force_flag = options[:force]
99
103
  @request = options[:request]
100
104
  @exceptions = {}
105
+ @stats_hash = StatsHash.new
101
106
  TransactionInfo.get.transaction = self
102
107
  end
103
108
 
@@ -119,6 +124,14 @@ module NewRelic
119
124
  @name_frozen
120
125
  end
121
126
 
127
+ def parent
128
+ has_parent? && self.class.stack[-2]
129
+ end
130
+
131
+ def root?
132
+ self.class.stack.size == 1
133
+ end
134
+
122
135
  def has_parent?
123
136
  self.class.stack.size > 1
124
137
  end
@@ -131,7 +144,6 @@ module NewRelic
131
144
 
132
145
  NewRelic::Agent::StatsEngine::GCProfiler.init
133
146
  agent.stats_engine.start_transaction
134
- agent.stats_engine.push_transaction_stats
135
147
  transaction_sampler.notice_transaction(uri, filtered_params)
136
148
  sql_sampler.notice_transaction(uri, filtered_params)
137
149
  end
@@ -165,9 +177,8 @@ module NewRelic
165
177
  freeze_name
166
178
  log_underflow if @type.nil?
167
179
 
168
- # these record metrics so need to be done before
169
- # the pop
170
- if self.class.stack.empty?
180
+ # these record metrics so need to be done before merging stats
181
+ if self.root?
171
182
  # this one records metrics and wants to happen
172
183
  # before the transaction sampler is finished
173
184
  if traced?
@@ -180,16 +191,20 @@ module NewRelic
180
191
  end
181
192
 
182
193
  record_exceptions
183
- agent.stats_engine.pop_transaction_stats(@name)
194
+ merge_stats_hash
184
195
 
185
- # these tear everything down so need to be done
186
- # after the pop
187
- if self.class.stack.empty?
196
+ # these tear everything down so need to be done after merging stats
197
+ if self.root?
188
198
  agent.events.notify(:transaction_finished, @name, end_time.to_f - start_time.to_f, overview_metrics)
189
199
  agent.stats_engine.end_transaction
190
200
  end
191
201
  end
192
202
 
203
+ def merge_stats_hash
204
+ stats = stats_hash.resolve_scopes(@name)
205
+ NewRelic::Agent.instance.stats_engine.merge!(stats)
206
+ end
207
+
193
208
  def record_exceptions
194
209
  @exceptions.each do |exception, options|
195
210
  options[:metric] = @name
@@ -268,13 +283,12 @@ module NewRelic
268
283
  (current) ? current.user_attributes : {}
269
284
  end
270
285
 
271
- def record_apdex(metric_name)
286
+ def record_apdex(metric_name, end_time=Time.now)
272
287
  return unless recording_web_transaction? && NewRelic::Agent.is_execution_traced?
273
288
  metric_parser = NewRelic::MetricParser::MetricParser \
274
289
  .for_metric_named(metric_name)
275
290
 
276
- t = Time.now
277
- self.class.record_apdex(metric_parser, t - start_time, t - apdex_start, exceptions.any?)
291
+ self.class.record_apdex(metric_parser, end_time - start_time, end_time - apdex_start, exceptions.any?)
278
292
  end
279
293
 
280
294
  # Yield to a block that is run with a database metric name context. This means
@@ -1,2 +1,2 @@
1
- # GITSHA: cade932a16499e0064acab0ce40cc0c3d4574cc5
2
- module NewRelic; module VERSION; BUILD='111'; end; end
1
+ # GITSHA: 2fa9f3b608f38bec0e49b2b29ded3c381e9f1409
2
+ module NewRelic; module VERSION; BUILD='113.beta'; end; end
@@ -10,12 +10,14 @@ class NewRelic::NoticedError
10
10
  attr_accessor :path, :timestamp, :params, :exception_class, :message
11
11
  attr_reader :exception_id
12
12
 
13
+ STRIPPED_EXCEPTION_REPLACEMENT_MESSAGE = "Message removed by New Relic 'strip_exception_messages' setting"
14
+
13
15
  def initialize(path, data, exception, timestamp = Time.now)
14
16
  @exception_id = exception.object_id
15
17
  @path = path
16
18
  @params = NewRelic::NoticedError.normalize_params(data)
17
19
 
18
- @exception_class = exception.is_a?(Exception) ? exception.class.name : 'Error'
20
+ @exception_class = exception.class
19
21
 
20
22
  if exception.respond_to?('original_exception')
21
23
  @message = exception.original_exception.message.to_s
@@ -34,18 +36,24 @@ class NewRelic::NoticedError
34
36
  # clamp long messages to 4k so that we don't send a lot of
35
37
  # overhead across the wire
36
38
  @message = @message[0..4095] if @message.length > 4096
37
-
38
- # obfuscate error message if necessary
39
- if NewRelic::Agent.config[:high_security]
40
- @message = NewRelic::Agent::Database.obfuscate_sql(@message)
39
+
40
+ # replace error message if enabled
41
+ if NewRelic::Agent.config[:'strip_exception_messages.enabled'] && !whitelisted?
42
+ @message = STRIPPED_EXCEPTION_REPLACEMENT_MESSAGE
41
43
  end
42
-
44
+
43
45
  @timestamp = timestamp
44
46
  end
45
47
 
48
+ def whitelisted?
49
+ NewRelic::Agent.config.stripped_exceptions_whitelist.find do |klass|
50
+ exception_class <= klass
51
+ end
52
+ end
53
+
46
54
  def ==(other)
47
55
  if other.respond_to?(:exception_id)
48
- @exception_id == other.exception_id
56
+ exception_id == other.exception_id
49
57
  else
50
58
  false
51
59
  end
@@ -53,11 +61,19 @@ class NewRelic::NoticedError
53
61
 
54
62
  include NewRelic::Coerce
55
63
 
64
+ def exception_name_for_collector
65
+ if exception_class < Exception
66
+ exception_class.name
67
+ else
68
+ 'Error'
69
+ end
70
+ end
71
+
56
72
  def to_collector_array(encoder=nil)
57
- [ NewRelic::Helper.time_to_millis(@timestamp),
58
- string(@path),
59
- string(@message),
60
- string(@exception_class),
61
- @params ]
73
+ [ NewRelic::Helper.time_to_millis(timestamp),
74
+ string(path),
75
+ string(message),
76
+ string(exception_name_for_collector),
77
+ params ]
62
78
  end
63
79
  end
@@ -12,7 +12,7 @@ module NewRelic
12
12
 
13
13
  MAJOR = 3
14
14
  MINOR = 6
15
- TINY = 3
15
+ TINY = 4
16
16
 
17
17
  begin
18
18
  require File.join(File.dirname(__FILE__), 'build')
data/test/agent_helper.rb CHANGED
@@ -154,6 +154,16 @@ def assert_metrics_not_recorded(not_expected)
154
154
  assert_equal([], found_but_not_expected, "Found unexpected metrics: [#{found_but_not_expected.join(', ')}]")
155
155
  end
156
156
 
157
+ def assert_truthy(expected, msg = nil)
158
+ msg = build_message( msg, "Expected ? to be truthy", expected )
159
+ assert_block( msg ) { expected }
160
+ end
161
+
162
+ def assert_falsy(expected, msg = nil)
163
+ msg = build_message( msg, "Expected ? to be falsy", expected )
164
+ assert_block( msg ) { !expected }
165
+ end
166
+
157
167
  # Mock up a transaction for testing purposes, optionally specifying a name and
158
168
  # transaction type. The given block will be executed within the context of the
159
169
  # dummy transaction.
@@ -195,6 +205,21 @@ def in_web_transaction(name='dummy')
195
205
  end
196
206
  end
197
207
 
208
+ def with_config(config_hash, opts={})
209
+ opts = { :level => 0, :do_not_cast => false }.merge(opts)
210
+ if opts[:do_not_cast]
211
+ config = config_hash
212
+ else
213
+ config = NewRelic::Agent::Configuration::DottedHash.new(config_hash)
214
+ end
215
+ NewRelic::Agent.config.apply_config(config, opts[:level])
216
+ begin
217
+ yield
218
+ ensure
219
+ NewRelic::Agent.config.remove_config(config)
220
+ end
221
+ end
222
+
198
223
  def freeze_time(now=Time.now)
199
224
  Time.stubs(:now).returns(now)
200
225
  end
@@ -2,17 +2,19 @@
2
2
  # This file is distributed under New Relic's license terms.
3
3
  # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
4
 
5
+ require File.join(File.dirname(__FILE__), '..', '..', '..', 'agent_helper')
6
+
5
7
  class KeyTransactionsTest < Test::Unit::TestCase
6
8
  class TestWidget
7
9
  include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation
8
10
 
9
- def key_txn(t0)
10
- Time.stubs(:now).returns(t0 + 5)
11
+ def key_txn
12
+ advance_time(5)
11
13
  end
12
14
  add_transaction_tracer :key_txn
13
15
 
14
- def other_txn(t0)
15
- Time.stubs(:now).returns(t0 + 5)
16
+ def other_txn
17
+ advance_time(5)
16
18
  end
17
19
  add_transaction_tracer :other_txn
18
20
  end
@@ -31,9 +33,7 @@ class KeyTransactionsTest < Test::Unit::TestCase
31
33
  NewRelic::Agent.manual_start(:sync_startup => true,
32
34
  :force_reconnect => true)
33
35
 
34
- # Important that this be stubbed before any of our add_transaction_tracer's
35
- # end up getting run in the test methods
36
- @now = stub_time_now
36
+ freeze_time
37
37
  end
38
38
 
39
39
  def teardown
@@ -46,7 +46,7 @@ class KeyTransactionsTest < Test::Unit::TestCase
46
46
  FAILING = 2
47
47
 
48
48
  def test_applied_correct_apdex_t_to_key_txn
49
- TestWidget.new.key_txn(@now)
49
+ TestWidget.new.key_txn
50
50
  NewRelic::Agent.instance.send(:harvest_and_send_timeslice_data)
51
51
 
52
52
  stats = $collector.reported_stats_for_metric('Apdex')[0]
@@ -55,7 +55,7 @@ class KeyTransactionsTest < Test::Unit::TestCase
55
55
  end
56
56
 
57
57
  def test_applied_correct_apdex_t_to_regular_txn
58
- TestWidget.new.other_txn(@now)
58
+ TestWidget.new.other_txn
59
59
  NewRelic::Agent.instance.send(:harvest_and_send_timeslice_data)
60
60
 
61
61
  stats = $collector.reported_stats_for_metric('Apdex')[0]
@@ -64,8 +64,8 @@ class KeyTransactionsTest < Test::Unit::TestCase
64
64
  end
65
65
 
66
66
  def test_applied_correct_tt_theshold
67
- TestWidget.new.key_txn(@now)
68
- TestWidget.new.other_txn(@now)
67
+ TestWidget.new.key_txn
68
+ TestWidget.new.other_txn
69
69
 
70
70
  NewRelic::Agent.instance.send(:harvest_and_send_slowest_sample)
71
71
 
@@ -6,6 +6,7 @@
6
6
 
7
7
  require 'rails/test_help'
8
8
  require './app'
9
+ require File.join(File.dirname(__FILE__), '..', '..', '..', 'agent_helper')
9
10
 
10
11
  class RequestStatsController < ApplicationController
11
12
  include Rails.application.routes.url_helpers
@@ -43,12 +44,22 @@ class RequestStatsTest < ActionController::TestCase
43
44
  # Tests
44
45
  #
45
46
 
46
- def test_is_disabled_by_default
47
+ def test_is_enabled_by_default
47
48
  200.times { get :stats_action }
48
49
 
49
50
  NewRelic::Agent.agent.send(:harvest_and_send_analytic_event_data)
50
51
 
51
- assert_nil $collector.agent_data.find {|post| post.action == 'analytic_event_data' }
52
+ assert_equal 1, $collector.calls_for('analytic_event_data').length
53
+ end
54
+
55
+ def test_doesnt_send_when_disabled
56
+ with_config( :'request_sampler.enabled' => false ) do
57
+ 200.times { get :stats_action }
58
+
59
+ NewRelic::Agent.agent.send(:harvest_and_send_analytic_event_data)
60
+
61
+ assert_equal 0, $collector.calls_for('analytic_event_data').length
62
+ end
52
63
  end
53
64
 
54
65
  def test_request_times_should_be_reported_if_enabled
@@ -57,7 +68,7 @@ class RequestStatsTest < ActionController::TestCase
57
68
 
58
69
  NewRelic::Agent.agent.send(:harvest_and_send_analytic_event_data)
59
70
 
60
- post = $collector.agent_data.find {|post| post.action == 'analytic_event_data' }
71
+ post = $collector.calls_for('analytic_event_data').first
61
72
 
62
73
  assert_not_nil( post )
63
74
  assert_kind_of Array, post.body
@@ -97,22 +108,5 @@ class RequestStatsTest < ActionController::TestCase
97
108
  assert_kind_of Time, Time.parse(object.to_s) rescue object
98
109
  end
99
110
 
100
- # :TODO: Remove this if/when test_helper is available from multiverse tests
101
- def with_config(config_hash, opts={})
102
- opts = { :level => 0, :do_not_cast => false }.merge(opts)
103
- if opts[:do_not_cast]
104
- config = config_hash
105
- else
106
- config = NewRelic::Agent::Configuration::DottedHash.new(config_hash)
107
- end
108
- NewRelic::Agent.config.apply_config(config, opts[:level])
109
- begin
110
- yield
111
- ensure
112
- NewRelic::Agent.config.remove_config(config)
113
- end
114
- end
115
-
116
-
117
111
  end
118
112
 
@@ -16,7 +16,6 @@ RB
16
16
 
17
17
  before_suite do
18
18
  ENV["NEWRELIC_MULTIVERSE_REDIS_PORT"] = (20_000 + ($$ % 10_000)).to_s
19
- ENV["NEWRELIC_MULTIVERSE_FAKE_COLLECTOR_PORT"] = (30_000 + ($$ % 10_000)).to_s
20
19
  system("echo 'port #{ENV["NEWRELIC_MULTIVERSE_REDIS_PORT"]}' | redis-server - > /dev/null &")
21
20
  end
22
21
 
@@ -11,7 +11,7 @@ development:
11
11
  app_name: test
12
12
  host: 127.0.0.1
13
13
  api_host: 127.0.0.1
14
- port: <%= ENV['NEWRELIC_MULTIVERSE_FAKE_COLLECTOR_PORT'] %>
14
+ port: <%= (30_000 + ($$ % 10_000)) %>
15
15
  transaction_tracer:
16
16
  record_sql: obfuscated
17
17
  enabled: true
@@ -13,106 +13,39 @@ require File.join(File.dirname(__FILE__), 'resque_setup')
13
13
 
14
14
  class ResqueTest < Test::Unit::TestCase
15
15
  JOB_COUNT = 5
16
- COLLECTOR_PORT = ENV['NEWRELIC_MULTIVERSE_FAKE_COLLECTOR_PORT']
17
16
 
18
17
  def setup
19
18
  $collector ||= NewRelic::FakeCollector.new
20
19
  $collector.reset
21
- $collector.run(COLLECTOR_PORT)
20
+ $collector.run
21
+
22
22
  $redis.del('queue:resque_test')
23
23
  $redis.set('index_key', 0)
24
24
  Resque::Stat.clear('processed')
25
- @pidfile = "resque_test.#{$$}.pid"
26
- JOB_COUNT.times do |i|
27
- Resque.enqueue(JobForTesting, 'index_key', i + 1)
28
- end
29
- end
30
-
31
- def teardown
32
- File.unlink(@pidfile) if File.file?(@pidfile)
33
- end
34
-
35
- def start_worker(opts={})
36
- if opts[:background]
37
- start_worker_background(opts[:env_vars])
38
- else
39
- start_worker_child(opts[:env_vars])
40
- end
41
- end
42
-
43
- def stop_worker(opts={})
44
- opts[:background] ? stop_worker_background : stop_worker_child
45
- end
46
-
47
- def start_worker_child(env_vars=nil)
48
- worker_cmd = "#{env_vars} QUEUE=* TERM_CHILD=1 bundle exec rake resque:work"
49
- @worker_pid = Process.fork
50
- Process.exec(worker_cmd) if @worker_pid.nil?
51
- end
52
25
 
53
- def stop_worker_child
54
- Process.kill("QUIT", @worker_pid)
55
- Process.waitpid(@worker_pid)
56
- end
57
-
58
- def start_worker_background(env_vars=nil)
59
- worker_cmd = "PIDFILE=#{@pidfile} TERM_CHILD=1 RESQUE_TERM_TIMEOUT=1 BACKGROUND=1 " +
60
- "#{env_vars} QUEUE=* bundle exec rake resque:work"
61
- system(worker_cmd)
62
- end
26
+ # From multiverse, we only run the Resque jobs inline to check that we
27
+ # are properly instrumenting the methods. Testing of the forking/backgrounding
28
+ # will be done in our upcoming end-to-end testing suites
29
+ Resque.inline = true
63
30
 
64
- def stop_worker_background
65
- daemon_pid = File.read(@pidfile).to_i
66
-
67
- tries = 0
68
- while process_alive?(daemon_pid) && tries < 3
69
- Process.kill('TERM', daemon_pid)
70
- sleep 4 # default resque TERM timeout
71
- tries += 1
31
+ JOB_COUNT.times do |i|
32
+ Resque.enqueue(JobForTesting, 'index_key', i + 1)
72
33
  end
73
34
 
74
- if process_alive?(daemon_pid)
75
- $stderr.puts "Oops. Daemon (pid #{daemon_pid}) is still running. Trying to halt it with SIGQUIT"
76
- Process.kill('QUIT', daemon_pid)
77
- sleep 1
78
-
79
- # If it's still alive, someone will likely have to go kill the process manually.
80
- # Alternatively, we could kill -9 it, but I decided to err on the side of caution
81
- if process_alive?(daemon_pid)
82
- raise "Resque is zombified. You might have to clean up process #{daemon_pid} manually."
83
- end
84
- end
35
+ NewRelic::Agent.instance.send(:transmit_data)
85
36
  end
86
37
 
87
- def process_alive?(pid)
88
- Process.kill(0, pid)
89
- return true
90
- rescue Errno::ESRCH
91
- return false
38
+ def test_all_jobs_ran
39
+ assert_equal(JOB_COUNT, $redis.get('index_key').to_i)
92
40
  end
93
41
 
94
- def wait_for_jobs
95
- time_for_jobs = 10
96
- begin
97
- Timeout.timeout(time_for_jobs) do
98
- loop do
99
- break if Resque.info[:processed] == JOB_COUNT
100
- sleep(0.1)
101
- end
102
- end
103
- rescue Timeout::Error => err
104
- completed = Resque.info[:processed]
105
- raise err.exception("waiting #{time_for_jobs}s for completion of #{JOB_COUNT} jobs - got only #{completed}")
106
- end
42
+ def test_agent_posts_correct_metric_data
43
+ assert_metric_and_call_count('Instance/Busy', 1)
44
+ assert_metric_and_call_count('OtherTransaction/ResqueJob/all', JOB_COUNT)
107
45
  end
108
46
 
109
- def run_worker(opts={})
110
- begin
111
- start_worker(opts)
112
- wait_for_jobs
113
- ensure
114
- stop_worker(opts)
115
- end
47
+ def test_agent_still_running_after_inline_job
48
+ assert NewRelic::Agent.instance.started?
116
49
  end
117
50
 
118
51
  METRIC_VALUES_POSITION = 3
@@ -127,28 +60,4 @@ class ResqueTest < Test::Unit::TestCase
127
60
  call_count = metric[1][0]
128
61
  assert_equal(expected_call_count, call_count)
129
62
  end
130
-
131
- def test_all_jobs_ran
132
- run_worker
133
- assert_equal(JOB_COUNT, $redis.get('index_key').to_i)
134
- end
135
-
136
- def test_agent_posts_correct_metric_data
137
- run_worker
138
- assert_metric_and_call_count('Instance/Busy', 1)
139
- assert_metric_and_call_count('OtherTransaction/ResqueJob/all', JOB_COUNT)
140
- end
141
-
142
- if RUBY_VERSION >= '1.9'
143
- def test_all_jobs_ran_background
144
- run_worker(:background => true)
145
- assert_equal(JOB_COUNT, $redis.get('index_key').to_i)
146
- end
147
-
148
- def test_agent_posts_correct_metric_data_background
149
- run_worker(:background => true)
150
- assert_metric_and_call_count('Instance/Busy', 1)
151
- assert_metric_and_call_count('OtherTransaction/ResqueJob/all', JOB_COUNT)
152
- end
153
- end
154
63
  end