newrelic_rpm 3.3.4.1 → 3.3.5.beta1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of newrelic_rpm might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -1,3 +1,13 @@
1
+ v3.3.5.beta1
2
+ * [FIX] Allow tracing of ! and ? methods
3
+ * [PERF] Give up after scanning first 50k of the response in RUM
4
+ auto-instrumentation.
5
+ * [FIX] Don't raise when extracting metrics from SQL queries with non UTF-8 bytes.
6
+ * Replaced "Custom/DJ Locked Jobs" metric with new metrics for
7
+ monitoring DelayedJob: queue_length, failed_jobs, and locked_jobs, all under
8
+ Workers/DelayedJob. queue_length is also broken out by queue name or priority
9
+ depending on the version of DelayedJob deployed.
10
+
1
11
  v3.3.4.1
2
12
  * Bug fix when rendering empty collection in Rails 3.1+
3
13
 
@@ -17,7 +27,7 @@ v3.3.2
17
27
  * Fix for lost database connections when using a forking framework
18
28
  * Workaround for RedHat kernel bug which prevented blocking reads of /proc fs
19
29
  * Do not trap signals when handling exceptions
20
-
30
+
21
31
  v3.3.1
22
32
  * improved Ruby 1.8.6 support
23
33
  * fix for issues with RAILS_ROOT deprecation warnings
@@ -46,11 +56,11 @@ v3.2.0
46
56
  * Fix to mutex lib load issue
47
57
  * Performance enhancements (thanks to Jeremy Kemper)
48
58
  * Fix overly verbose STDOUT message (thanks to Anselm Helbig)
49
-
59
+
50
60
  v3.1.2
51
61
  * Fixed some thread safety issues
52
62
  * Work around for Ruby 1.8.7 Marshal crash bug
53
- * Numerous community patches (Gabriel Horner, Bradley Harris, Diego Garcia,
63
+ * Numerous community patches (Gabriel Horner, Bradley Harris, Diego Garcia,
54
64
  Tommy Sullivan, Greg Hazel, John Thomas Marino, Paul Elliott, Pan Thomakos)
55
65
  * Fixed RUM instrumentation bug
56
66
 
@@ -64,13 +74,13 @@ v3.1.1
64
74
  * Support for logging to STDOUT
65
75
  * Support for Spymemcached client on jruby
66
76
 
67
- v3.1.0
77
+ v3.1.0
68
78
  * Support for aggregating data from short-running
69
79
  processes to reduce reporting overhead
70
80
  * Numerous bug fixes
71
81
  * Increased unit test coverage
72
82
 
73
- v3.0.1
83
+ v3.0.1
74
84
  * Updated Real User Monitoring to reduce javascript size and improve
75
85
  compatibility, fix a few known bugs
76
86
 
@@ -113,7 +123,7 @@ v2.13.3
113
123
  * Dalli instrumentation from Mike Perham (thanks Mike)
114
124
  * Datamapper instrumentation from Jordan Ritter (thanks Jordan)
115
125
  * Apdex now defaults to 0.5
116
- !!! Please be aware that if you are not setting an apdex,
126
+ !!! Please be aware that if you are not setting an apdex,
117
127
  !!! this will cause a change in the apparent performance of your app.
118
128
  * Make metric hashes threadsafe (fixes problems sending metrics in Jruby
119
129
  threaded code)
@@ -152,7 +162,7 @@ v2.13.0
152
162
  details from web and background transactions occurring outside RPM
153
163
  * fixed a bug related to enabling a gold trial / upgrade not sending
154
164
  trasaction traces correctly
155
-
165
+
156
166
  v2.12.3
157
167
  * fix regression in startup sequence
158
168
 
@@ -177,7 +187,7 @@ v2.11.2
177
187
  * fix for unicorn not reporting when the proc line had 'master' in it
178
188
  * fix regression for passenger 2.0 and earlier
179
189
  * fix after_fork in the shim
180
-
190
+
181
191
  v2.11.1
182
192
  * republished gem without generated rdocs
183
193
 
@@ -185,18 +195,18 @@ v2.11.0
185
195
  * rails3 instrumentation (no developer mode support yet)
186
196
  * removed the ensure_worker_thread started and instead defined an after_fork
187
197
  handler that will set up the agent properly in forked processes.
188
- * change at_exit handler so the shutdown always goes after other shutdown
198
+ * change at_exit handler so the shutdown always goes after other shutdown
189
199
  handlers
190
200
  * add visibility to active record db transactions in the rpm transaction
191
201
  traces (thanks to jeremy kemper)
192
202
  * fix regression in merb support which caused merb apps not to start
193
- * added NewRelic::Agent.logger to the public api to write to the agent
203
+ * added NewRelic::Agent.logger to the public api to write to the agent
194
204
  log file.
195
205
  * optimizations to background thread, controller instrumentation, memory
196
206
  usage
197
207
  * add logger method to public_api
198
208
  * support list notation for ignored exceptions in the newrelic.yml
199
-
209
+
200
210
  v2.10.8
201
211
  * fix bug in delayed_job instrumentation that caused the job queue sampler
202
212
  to run in the wrong place
@@ -206,30 +216,30 @@ v2.10.8
206
216
  * fix problem with the Authlogic metric names which caused errors in
207
217
  developer mode. Authlogic metrics now adhere to the convention of
208
218
  prefixing the name with 'Custom'
209
- * allow more correct overriding of transaction trace settings in the
219
+ * allow more correct overriding of transaction trace settings in the
210
220
  call to #manual_start
211
221
  * simplify WorkerLoop and add better protection for concurrency
212
222
  * preliminary support for rails3
213
-
223
+
214
224
  v2.10.6
215
225
  * fix missing URL and referer on some traced errors and transactions
216
226
  * gather traced errors *after* executing the rescue chain in ActionController
217
227
  * always load controller instrumentation
218
228
  * pick up token validation from newrelic.yml
219
-
229
+
220
230
  v2.10.5
221
231
  * fix bug in delayed_job instrumentation occurring when there was no DJ log
222
-
232
+
223
233
  v2.10.4
224
234
  * fix incompatibility with Capistrano 2.5.16
225
235
  * strip down URLs reported in transactions and errors to path only
226
-
236
+
227
237
  v2.10.3
228
238
  * optimization to reduce overhead: move background samplers into foreground thread
229
239
  * change default config file to ignore RoutingErrors
230
240
  * moved the background task instrumentation into a separate tab in the RPM UI
231
241
  * allow override of the RPM application name via NEWRELIC_APP_NAME environment variable
232
- * revised Delayed::Job instrumentation so no manual_start is required
242
+ * revised Delayed::Job instrumentation so no manual_start is required
233
243
  * send buffered data on shutdown
234
244
  * expanded support for queue length and queue time
235
245
  * remove calls to starts_with to fix Sinatra and non-rails deployments
@@ -241,9 +251,9 @@ v2.10.3
241
251
 
242
252
  v2.10.2.
243
253
  * beta release of 2.10
244
- * fix bugs with Sinatra app instrumentation
254
+ * fix bugs with Sinatra app instrumentation
245
255
  * minor doc updates
246
-
256
+
247
257
  v2.10.1.
248
258
  * alpha release of 2.10
249
259
  * rack support, including metal; ignores 404s; requires a module inclusion (see docs)
@@ -251,14 +261,14 @@ v2.10.1.
251
261
  * add API method to abort transaction recording for in-flight transactions
252
262
  * remove account management calls from newrelic_api.rb
253
263
  * truncating extremely large transaction traces for efficiency
254
- * fix error reporting in recipes; add newrelic_rails_env option to recipes to
264
+ * fix error reporting in recipes; add newrelic_rails_env option to recipes to
255
265
  override the rails env used to pull the app_name out of newrelic.yml
256
266
  * added TorqueBox recognition (thanks Bob McWhirter)
257
267
  * renamed config settings: enabled => monitor_mode; developer => developer_mode;
258
268
  old names will still work in newrelic.yml
259
269
  * instrumentation for DelayedJob (thanks Travis Tilley)
260
- * added config switches to turn off certain instrumentation when you aren't
261
- interested in the metrics, to save on overhead--see newrelic.yml for details.
270
+ * added config switches to turn off certain instrumentation when you aren't
271
+ interested in the metrics, to save on overhead--see newrelic.yml for details.
262
272
  * add profiling support to dev mode; very experimental!
263
273
  * add 'multi_threaded' config option to indicate when the app is running
264
274
  multi-threaded, so we can disable some instrumentation
@@ -279,13 +289,13 @@ v2.10.1.
279
289
  * renamed the dispatcher metric
280
290
  * refactored stats_engine code for readability
281
291
  * optimization: reduce wakeup times for harvest thread
282
-
292
+
283
293
  v2.10.0.
284
294
  * alpha release of 2.10
285
295
  * support unicorn
286
296
  * instrumentation of GC for REE and MRE with GC patch
287
297
  * support agent restarting when changes are made to the account
288
- * removed #newrelic_notice_error from Object class, replaced by NewRelic::Agent#notic_error
298
+ * removed #newrelic_notice_error from Object class, replaced by NewRelic::Agent#notic_error
289
299
  * collect histogram statistics
290
300
  * add custom parameters to newrelic_notice_error call to display
291
301
  extra info for errors
@@ -321,13 +331,13 @@ v2.9.4.
321
331
  v2.9.3.
322
332
  * fix startup failure in Windows due to memory sampler
323
333
  * add JRuby environment information
324
-
334
+
325
335
  v2.9.2.
326
- * change default apdex_t to 0.5 seconds
336
+ * change default apdex_t to 0.5 seconds
327
337
  * fix bug in deployments introduced by multi_homed setting
328
338
  * support overriding the log in the agent api
329
339
  * fix JRuby problem using objectspace
330
- * display custom parameters when looking at transactions in dev mode
340
+ * display custom parameters when looking at transactions in dev mode
331
341
  * display count of sql statements on the list of transactions in dev mode
332
342
  * fixes for merb--thanks to Carl Lerche
333
343
 
@@ -335,14 +345,14 @@ v2.9.1.
335
345
  * add newrelic_ignore_apdex method to controller classes to allow
336
346
  you to omit some actions from apdex statistics
337
347
  * Add hook for Passenger shutdown events to get more timely shutdown
338
- notices; this will help in more accurate memory readings in
348
+ notices; this will help in more accurate memory readings in
339
349
  Passenger
340
350
  * add newrelic_notice_error to Object class
341
- * optional ability to verify SSL certificates, note that this has some
351
+ * optional ability to verify SSL certificates, note that this has some
342
352
  performance and reliability implications
343
353
  * support multi-homed host with multiple apps running on duplicate
344
354
  ports
345
-
355
+
346
356
  v2.9.0.
347
357
  Noteworthy Enhancements
348
358
  * give visibility to templates and partials in Rails 2.1 and later, in
@@ -357,7 +367,7 @@ v2.9.0.
357
367
  * add API for system monitoring daemons (refer to KB articles); changed
358
368
  API for manual starting of the agent; refer to
359
369
  NewRelic::Agent.manual_start for details
360
- * do certificate verification on ssl connections to
370
+ * do certificate verification on ssl connections to
361
371
  collector.newrelic.com
362
372
  * support instances appearing in more than one application by allowing a
363
373
  semicolon separated list of names for the newrelic.yml app_name
@@ -371,17 +381,17 @@ v2.9.0.
371
381
  * added number of queries to transactions in the transaction list
372
382
  * added some sorting options for the transaction list
373
383
  * added a page showing the list of active threads
374
-
384
+
375
385
  Compatibility Enhancements
376
386
  * ruby 1.9.1 compatibility
377
387
  * support concurrency when determining busy times, for 2.2 compatibility
378
388
  * in jruby, use Java used heap for memory sampling if the system memory
379
389
  is not accessible from an unsupported platform
380
- * jruby will no longer start the agent now when running the console or
390
+ * jruby will no longer start the agent now when running the console or
381
391
  rake tasks
382
392
  * API support for RPM as a footnote add-in
383
393
  * webrick support restored
384
-
394
+
385
395
  Noteworthy bugfixes
386
396
  * sample memory on linux by reading /proc/#{$$}/status file
387
397
  * fixed ambiguous 'View' metrics showing up in controller breakdown
@@ -392,7 +402,7 @@ v2.9.0.
392
402
  * moved CPU sampler off background thread and onto the harvest thread
393
403
  * tests now run cleanly in any rails app using test:newrelic or
394
404
  test:plugins
395
-
405
+
396
406
  Agent improvements to support future RPM enhancements
397
407
  * add instrumentation to capture metrics on response codes; not yet
398
408
  working in rails 2.3.*
@@ -463,7 +473,7 @@ v2.8.1.
463
473
  symlinked to /usr/bin. Usage: newrelic_cmd deployments --help
464
474
  * Fix issue invoking api when host is not set in newrelic.yml
465
475
  * Fix deployments api so it will work from a gem
466
- * Fix thin incompatibility in developer mode
476
+ * Fix thin incompatibility in developer mode
467
477
 
468
478
  v2.8.0.
469
479
  * add beta of api in new_relic_api.rb
@@ -471,7 +481,7 @@ v2.8.0.
471
481
  * preliminary support for capturing deployment information via capistrano
472
482
  * change memory sampler for solaris to use /usr/bin/ps
473
483
  * allow ERB in newrelic.yml file
474
- * merged support for merb into this version
484
+ * merged support for merb into this version
475
485
  * fix incompatibility in the developer mode with the safe_erb plugin
476
486
  * fix module namespace issue causing an error accessing
477
487
  NewRelic::Instrumentation modules
@@ -561,7 +571,7 @@ v2.2.2.
561
571
 
562
572
  v2.2.1.
563
573
  + Add rails 2.1 support for Developer Mode
564
- + Changes to memory sampler: Add support for JRuby and fix Solaris support.
574
+ + Changes to memory sampler: Add support for JRuby and fix Solaris support.
565
575
  * Stop catching exceptions and start catching StandardError; other exception cleanup
566
576
  * Add protective exception catching to the stats engine
567
577
  * Improved support for thin domain sockets
@@ -93,7 +93,7 @@ module NewRelic
93
93
  require 'new_relic/agent/samplers/cpu_sampler'
94
94
  require 'new_relic/agent/samplers/memory_sampler'
95
95
  require 'new_relic/agent/samplers/object_sampler'
96
- require 'new_relic/agent/samplers/delayed_job_lock_sampler'
96
+ require 'new_relic/agent/samplers/delayed_job_sampler'
97
97
  require 'set'
98
98
  require 'thread'
99
99
  require 'resolv'
@@ -18,7 +18,8 @@ module NewRelic
18
18
  end
19
19
 
20
20
  sql, name, binds = args
21
- metric = metric_for_name(name) || metric_for_sql(sql)
21
+ metric = metric_for_name(NewRelic::Helper.correctly_encoded(name)) ||
22
+ metric_for_sql(NewRelic::Helper.correctly_encoded(sql))
22
23
 
23
24
  if !metric
24
25
  log_without_newrelic_instrumentation(*args, &block)
@@ -138,15 +138,17 @@ module NewRelic
138
138
  end
139
139
  options_arg << %Q[:#{key} => #{valuestr}]
140
140
  end
141
+ traced_method, punctuation = method.to_s.sub(/([?!=])$/, ''), $1
142
+
141
143
  class_eval <<-EOC
142
- def #{method.to_s}_with_newrelic_transaction_trace(*args, &block)
144
+ def #{traced_method.to_s}_with_newrelic_transaction_trace#{punctuation}(*args, &block)
143
145
  perform_action_with_newrelic_trace(#{options_arg.join(',')}) do
144
- #{method.to_s}_without_newrelic_transaction_trace(*args, &block)
146
+ #{traced_method.to_s}_without_newrelic_transaction_trace#{punctuation}(*args, &block)
145
147
  end
146
148
  end
147
149
  EOC
148
- alias_method "#{method.to_s}_without_newrelic_transaction_trace", method.to_s
149
- alias_method method.to_s, "#{method.to_s}_with_newrelic_transaction_trace"
150
+ alias_method "#{traced_method.to_s}_without_newrelic_transaction_trace#{punctuation}", method.to_s
151
+ alias_method method.to_s, "#{traced_method.to_s}_with_newrelic_transaction_trace#{punctuation}"
150
152
  NewRelic::Control.instance.log.debug("Traced transaction: class = #{self.name}, method = #{method.to_s}, options = #{options.inspect}")
151
153
  end
152
154
  end
@@ -197,7 +197,7 @@ module NewRelic
197
197
  # the proper call scope.
198
198
  def log_with_newrelic_instrumentation(msg)
199
199
  return unless NewRelic::Agent.is_execution_traced?
200
- return unless operation = case msg.query
200
+ return unless operation = case NewRelic::Helper.correctly_encoded(msg.query)
201
201
  when /^\s*select/i then 'find'
202
202
  when /^\s*(update|insert)/i then 'save'
203
203
  when /^\s*delete/i then 'destroy'
@@ -0,0 +1,89 @@
1
+ require 'new_relic/agent/sampler'
2
+ require 'new_relic/delayed_job_injection'
3
+
4
+ module NewRelic
5
+ module Agent
6
+ module Samplers
7
+ # This sampler records the status of your delayed job table once a minute.
8
+ # It assumes jobs are cleared after being run, and failed jobs are not (otherwise
9
+ # the failed job metric is useless).
10
+ #
11
+ # In earlier versions it will break out the queue length by priority. In later
12
+ # versions of DJ where distinct queues are supported, it breaks it out by queue name.
13
+ #
14
+ class DelayedJobSampler < NewRelic::Agent::Sampler
15
+ def initialize
16
+ super :delayed_job_queue
17
+ raise Unsupported, "DJ instrumentation disabled" if NewRelic::Control.instance['disable_dj']
18
+ raise Unsupported, "No DJ worker present" unless NewRelic::DelayedJobInjection.worker_name
19
+ end
20
+
21
+ def error_stats
22
+ stats_engine.get_stats("Workers/DelayedJob/failed_jobs", false)
23
+ end
24
+ def locked_job_stats
25
+ stats_engine.get_stats("Workers/DelayedJob/locked_jobs", false)
26
+ end
27
+
28
+ def local_env
29
+ NewRelic::Control.instance.local_env
30
+ end
31
+
32
+ def worker_name
33
+ local_env.dispatcher_instance_id
34
+ end
35
+
36
+ def queued_jobs
37
+ Delayed::Job.count(:conditions => ['run_at < ? and failed_at is NULL', Time.now])
38
+ end
39
+ def failed_jobs
40
+ Delayed::Job.count(:conditions => 'failed_at is not NULL')
41
+ end
42
+ def locked_jobs
43
+ Delayed::Job.count(:conditions => 'locked_by is not NULL')
44
+ end
45
+
46
+ def self.supported_on_this_platform?
47
+ defined?(Delayed::Job)
48
+ end
49
+
50
+ def poll
51
+ record error_stats, failed_jobs
52
+ record locked_job_stats, locked_jobs
53
+
54
+ if @queue
55
+ record_queue_length_across_dimension('queue')
56
+ else
57
+ record_queue_length_across_dimension('priority')
58
+ end
59
+ end
60
+
61
+ private
62
+
63
+ def record_queue_length_across_dimension(column)
64
+ all_count = 0
65
+ Delayed::Job.count(:group => column).each do | column_val, count |
66
+ all_count += count
67
+ record stats_engine.get_stats("Workers/DelayedJob/queue_length/#{column == 'queue' ? 'name' : column}/#{column_val}", false), count
68
+ end
69
+ record(stats_engine.get_stats("Workers/DelayedJob/queue_length/all", false), all_count)
70
+ end
71
+
72
+ # Figure out if we get the queues.
73
+ def setup
74
+ return unless @queue.nil?
75
+ @setup = true
76
+ columns = Delayed::Job.columns
77
+ columns.each do | c |
78
+ @queue = true if c.name.to_s == 'priority'
79
+ end
80
+ @queue ||= false
81
+ end
82
+
83
+ def record(stat, size)
84
+ stat.record_data_point size
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
@@ -47,7 +47,7 @@ module Agent
47
47
  end
48
48
 
49
49
  def log_added_sampler(type, sampler)
50
- log.debug "Adding #{type} sampler: #{sampler.inspect}"
50
+ log.debug "Adding #{type} sampler: #{sampler.id}"
51
51
  end
52
52
 
53
53
  public
@@ -2,6 +2,7 @@ require 'yaml'
2
2
  require 'conditional_vendored_metric_parser'
3
3
  require 'conditional_vendored_dependency_detection'
4
4
  require 'new_relic/local_environment'
5
+ require 'new_relic/helper'
5
6
 
6
7
  require 'singleton'
7
8
  require 'erb'
@@ -0,0 +1,21 @@
1
+ module NewRelic
2
+ # A singleton for shared generic helper methods
3
+ module Helper
4
+ extend self
5
+
6
+ # confirm a string is correctly encoded (in >= 1.9)
7
+ # If not force the encoding to ASCII-8BIT (binary)
8
+ if RUBY_VERSION >= '1.9'
9
+ def correctly_encoded(string)
10
+ return string unless string.is_a? String
11
+ string.valid_encoding? ? string : string.force_encoding("ASCII-8BIT")
12
+ end
13
+ else
14
+ #noop
15
+ def correctly_encoded(string)
16
+ string
17
+ end
18
+ end
19
+
20
+ end
21
+ end
@@ -9,17 +9,6 @@ module NewRelic::Rack
9
9
 
10
10
  # method required by Rack interface
11
11
  def call(env)
12
- # Two experimental options for allowing TT capture based on http params
13
- #
14
- # if req.params['nr_capture_deep_tt']
15
- # NewRelic::Agent::TransactionInfo.get.force_persist = true
16
- # NewRelic::Agent::TransactionInfo.get.capture_deep_tt = true
17
- # end
18
-
19
- # if req.params['nr_capture_tt']
20
- # NewRelic::Agent::TransactionInfo.get.force_persist = true
21
- # end
22
-
23
12
  result = @app.call(env) # [status, headers, response]
24
13
 
25
14
  if (NewRelic::Agent.browser_timing_header != "") && should_instrument?(result[0], result[1])
@@ -46,19 +35,21 @@ module NewRelic::Rack
46
35
  response.each {|fragment| source ? (source << fragment.to_s) : (source = fragment.to_s)}
47
36
  return nil unless source
48
37
 
49
- body_start = source.index("<body")
50
- body_close = source.rindex("</body>")
51
38
 
52
- if body_start && body_close
39
+ # Only scan the first 50k (roughly) then give up.
40
+ beginning_of_source = source[0..50_000]
41
+ # Don't scan for body close unless we find body start
42
+ if (body_start = beginning_of_source.index("<body")) && (body_close = source.rindex("</body>"))
43
+
53
44
  footer = NewRelic::Agent.browser_timing_footer
54
45
  header = NewRelic::Agent.browser_timing_header
55
46
 
56
- if source.include?('X-UA-Compatible')
47
+ if beginning_of_source.include?('X-UA-Compatible')
57
48
  # put at end of header if UA-Compatible meta tag found
58
- head_pos = source.index("</head>")
59
- elsif head_open = source.index("<head")
49
+ head_pos = beginning_of_source.index("</head>")
50
+ elsif head_open = beginning_of_source.index("<head")
60
51
  # put at the beginning of the header
61
- head_pos = source.index(">", head_open) + 1
52
+ head_pos = beginning_of_source.index(">", head_open) + 1
62
53
  else
63
54
  # put the header right above body start
64
55
  head_pos = body_start
@@ -3,8 +3,8 @@ module NewRelic
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = 3
5
5
  MINOR = 3
6
- TINY = 4
7
- BUILD = 1 # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
6
+ TINY = 5
7
+ BUILD = 'beta1' # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
8
8
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
9
9
  end
10
10
 
@@ -5,14 +5,14 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "newrelic_rpm"
8
- s.version = "3.3.4.1"
8
+ s.version = "3.3.5.beta1"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bill Kayser", "Jon Guymon", "Justin George", "Darin Swanson"]
12
- s.date = "2012-04-24"
12
+ s.date = "2012-05-25"
13
13
  s.description = "New Relic is a performance management system, developed by New Relic,\nInc (http://www.newrelic.com). New Relic provides you with deep\ninformation about the performance of your web application as it runs\nin production. The New Relic Ruby Agent is dual-purposed as a either a\nGem or plugin, hosted on\nhttp://github.com/newrelic/rpm/\n"
14
14
  s.email = "support@newrelic.com"
15
- s.executables = ["newrelic_cmd", "mongrel_rpm", "newrelic"]
15
+ s.executables = ["newrelic", "newrelic_cmd", "mongrel_rpm"]
16
16
  s.extra_rdoc_files = [
17
17
  "CHANGELOG",
18
18
  "LICENSE",
@@ -68,7 +68,7 @@ Gem::Specification.new do |s|
68
68
  "lib/new_relic/agent/method_tracer.rb",
69
69
  "lib/new_relic/agent/sampler.rb",
70
70
  "lib/new_relic/agent/samplers/cpu_sampler.rb",
71
- "lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb",
71
+ "lib/new_relic/agent/samplers/delayed_job_sampler.rb",
72
72
  "lib/new_relic/agent/samplers/memory_sampler.rb",
73
73
  "lib/new_relic/agent/samplers/object_sampler.rb",
74
74
  "lib/new_relic/agent/shim_agent.rb",
@@ -103,6 +103,7 @@ Gem::Specification.new do |s|
103
103
  "lib/new_relic/control/server_methods.rb",
104
104
  "lib/new_relic/data_serialization.rb",
105
105
  "lib/new_relic/delayed_job_injection.rb",
106
+ "lib/new_relic/helper.rb",
106
107
  "lib/new_relic/language_support.rb",
107
108
  "lib/new_relic/local_environment.rb",
108
109
  "lib/new_relic/merbtasks.rb",
@@ -291,7 +292,6 @@ Gem::Specification.new do |s|
291
292
  s.summary = "New Relic Ruby Agent"
292
293
 
293
294
  if s.respond_to? :specification_version then
294
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
295
295
  s.specification_version = 3
296
296
 
297
297
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
@@ -9,7 +9,7 @@ ENV['RACK_ENV'] = 'test'
9
9
  # benefit from auto-rum, but the truth of the matter is that atm
10
10
  # we only support Rails >= 2.3
11
11
  def middleware_supported?
12
- ::Rails::VERSION::MAJOR >= 2 && ::Rails::VERSION::MINOR >= 3
12
+ ::Rails::VERSION::STRING >= '2.3'
13
13
  end
14
14
 
15
15
  if middleware_supported?
@@ -139,4 +139,7 @@ EOL
139
139
  assert(last_response.body.include?(guid), last_response.body)
140
140
  end
141
141
  end
142
+ else
143
+ warn "Skipping rum auto instrumentation tests"
142
144
  end
145
+
@@ -4,47 +4,37 @@
4
4
  # checking out test dependencies (currently rpm_test_app and it's dependencies)
5
5
  # and executing them.
6
6
  #
7
- # It relies on 3 environment variables:
7
+ # It relies on 2 environment variables:
8
8
  #
9
9
  # RUBY - The rvm ruby you want to use (e.g. 1.8.7, ree, jruby)
10
10
  #
11
11
  # BRANCH - The rpm_test_app branch you want to use (e.g. rails20, rails31)
12
12
  #
13
- # RPM_TEST_APP_CLONE_URL - where to clone the test app from (e.g.
14
- # git://github.com/newrelic/rpm_test_app.git, /path/in/my/filesystem)
15
- #
16
13
  # Example usage:
17
- # RPM_TEST_APP_CLONE_URL=git://github.com/newrelic/rpm_test_app.git \
18
14
  # RUBY=ree BRANCH=rails20 test/script/ci.sh
19
15
  #
20
- # RPM_TEST_APP_CLONE_URL=git://github.com/newrelic/rpm_test_app.git \
21
16
  # RUBY=ree BRANCH=rails20 test/script/ci.sh
22
17
  #
23
- # RPM_TEST_APP_CLONE_URL=~/dev/rpm_test_app/ \
24
18
  # RUBY=jruby BRANCH=rails22 test/script/ci.sh
25
19
 
26
20
  echo "Executing $0"
27
21
  echo "Running in $(pwd)"
28
22
 
29
-
30
-
31
23
  # print commands in this script as they're invoked
32
- # set -x
24
+ #set -x
33
25
  # fail if any command fails
34
26
  set -e
35
27
 
36
28
  # check for require environment variables
37
29
  if [ "x$RUBY" == "x" ]; then
38
30
  echo '$RUBY is undefined'
39
- exit 1
31
+ echo 'defaulting to 1.9.3'
32
+ RUBY=1.9.3
40
33
  fi
41
34
  if [ "x$BRANCH" == "x" ]; then
42
35
  echo '$BRANCH is undefined'
43
- exit 1
44
- fi
45
- if [ "x$RPM_TEST_APP_CLONE_URL" == "x" ]; then
46
- echo '$RPM_TEST_APP_CLONE_URL is undefined'
47
- exit 1
36
+ echo 'defaulting to rails31'
37
+ BRANCH=rails31
48
38
  fi
49
39
 
50
40
  . "$HOME/.rvm/scripts/rvm"
@@ -59,9 +49,58 @@ pwd
59
49
  rm -rf tmp
60
50
  mkdir -p tmp
61
51
  cd tmp
62
- git clone --depth=1 $RPM_TEST_APP_CLONE_URL rpm_test_app
63
- cd rpm_test_app
52
+
53
+
54
+ #rpm_test_app_cache=~/.rpm_test_app_cache
55
+ rpm_test_app_cache=~/workspace/.rpm_test_app_cache
56
+ (
57
+ echo "updating local cache of rpm_test_app in $rpm_test_app_cache"
58
+ git clone --mirror git://github.com/newrelic/rpm_test_app.git $rpm_test_app_cache || true
59
+ cd $rpm_test_app_cache
60
+ )
61
+
62
+ git clone $rpm_test_app_cache rpm_test_app
63
+ cd rpm_test_app || true # rvm overrides cd and it's f-ing up the build by exiting 2
64
+
64
65
  git checkout -t origin/$BRANCH || git checkout $BRANCH
66
+
67
+
68
+ # Re-write database.yml to this here doc
69
+ ( cat << "YAML" ) > config/database.yml
70
+ # Shared properties for mysql db
71
+ mysql: &mysql
72
+ adapter: mysql
73
+ socket: <%= (`uname -s` =~ /Linux/ ) ? "" :"/tmp/mysql.sock" %>
74
+ username: root
75
+ host: localhost
76
+ database: <%= [ 'rails_blog', ENV['BRANCH'], ENV['RUBY'] ].compact.join('_') %>
77
+
78
+ # Shared properties for postgres. This won't work with our schema but
79
+ # Does work with agent tests
80
+ sqlite3: &sqlite3
81
+ <% if defined?(JRuby) %>
82
+ adapter: jdbcsqlite3
83
+ <% else %>
84
+ adapter: sqlite3
85
+ <% end %>
86
+ database: db/all.sqlite3
87
+ pool: 5
88
+ timeout: 5000
89
+ host: localhost
90
+
91
+ # SQLite version 3.x
92
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
93
+ development:
94
+ <<: *sqlite3
95
+
96
+ test:
97
+ <<: *mysql
98
+
99
+ production:
100
+ <<: *mysql
101
+ YAML
102
+
103
+
65
104
  mkdir -p log
66
105
  mkdir -p tmp
67
106
  if [ "x$BRANCH" == "xrails20" ]; then
@@ -78,7 +117,7 @@ rvm gemset create ruby_agent_tests_$BRANCH
78
117
  rvm gemset use ruby_agent_tests_$BRANCH
79
118
 
80
119
  if [ "x$RUBY" == "x1.8.6" ]; then
81
- # Bundler 1.1 dropped support for ruby 1.8.6
120
+ # Bundler 0.1 dropped support for ruby 1.8.6
82
121
  gem install bundler -v'~>1.0.0' --no-rdoc --no-ri
83
122
  else
84
123
  gem install bundler --no-rdoc --no-ri
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 117
5
- prerelease:
4
+ hash: 2878966781
5
+ prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 3
9
- - 4
9
+ - 5
10
+ - beta
10
11
  - 1
11
- version: 3.3.4.1
12
+ version: 3.3.5.beta1
12
13
  platform: ruby
13
14
  authors:
14
15
  - Bill Kayser
@@ -19,7 +20,7 @@ autorequire:
19
20
  bindir: bin
20
21
  cert_chain: []
21
22
 
22
- date: 2012-04-24 00:00:00 Z
23
+ date: 2012-05-25 00:00:00 Z
23
24
  dependencies:
24
25
  - !ruby/object:Gem::Dependency
25
26
  name: jeweler
@@ -73,9 +74,9 @@ description: |
73
74
 
74
75
  email: support@newrelic.com
75
76
  executables:
77
+ - newrelic
76
78
  - newrelic_cmd
77
79
  - mongrel_rpm
78
- - newrelic
79
80
  extensions: []
80
81
 
81
82
  extra_rdoc_files:
@@ -132,7 +133,7 @@ files:
132
133
  - lib/new_relic/agent/method_tracer.rb
133
134
  - lib/new_relic/agent/sampler.rb
134
135
  - lib/new_relic/agent/samplers/cpu_sampler.rb
135
- - lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb
136
+ - lib/new_relic/agent/samplers/delayed_job_sampler.rb
136
137
  - lib/new_relic/agent/samplers/memory_sampler.rb
137
138
  - lib/new_relic/agent/samplers/object_sampler.rb
138
139
  - lib/new_relic/agent/shim_agent.rb
@@ -167,6 +168,7 @@ files:
167
168
  - lib/new_relic/control/server_methods.rb
168
169
  - lib/new_relic/data_serialization.rb
169
170
  - lib/new_relic/delayed_job_injection.rb
171
+ - lib/new_relic/helper.rb
170
172
  - lib/new_relic/language_support.rb
171
173
  - lib/new_relic/local_environment.rb
172
174
  - lib/new_relic/merbtasks.rb
@@ -391,16 +393,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
391
393
  required_rubygems_version: !ruby/object:Gem::Requirement
392
394
  none: false
393
395
  requirements:
394
- - - ">="
396
+ - - ">"
395
397
  - !ruby/object:Gem::Version
396
- hash: 3
398
+ hash: 25
397
399
  segments:
398
- - 0
399
- version: "0"
400
+ - 1
401
+ - 3
402
+ - 1
403
+ version: 1.3.1
400
404
  requirements: []
401
405
 
402
406
  rubyforge_project:
403
- rubygems_version: 1.8.10
407
+ rubygems_version: 1.8.21
404
408
  signing_key:
405
409
  specification_version: 3
406
410
  summary: New Relic Ruby Agent
@@ -1,40 +0,0 @@
1
- require 'new_relic/agent/sampler'
2
- require 'new_relic/delayed_job_injection'
3
-
4
- module NewRelic
5
- module Agent
6
- module Samplers
7
- class DelayedJobLockSampler < NewRelic::Agent::Sampler
8
- def initialize
9
- super :delayed_job_lock
10
- raise Unsupported, "DJ instrumentation disabled" if NewRelic::Control.instance['disable_dj']
11
- raise Unsupported, "No DJ worker present" unless NewRelic::DelayedJobInjection.worker_name
12
- end
13
-
14
- def stats
15
- stats_engine.get_stats("Custom/DJ Locked Jobs", false)
16
- end
17
-
18
- def local_env
19
- NewRelic::Control.instance.local_env
20
- end
21
-
22
- def worker_name
23
- local_env.dispatcher_instance_id
24
- end
25
-
26
- def locked_jobs
27
- Delayed::Job.count(:conditions => {:locked_by => NewRelic::DelayedJobInjection.worker_name})
28
- end
29
-
30
- def self.supported_on_this_platform?
31
- defined?(Delayed::Job)
32
- end
33
-
34
- def poll
35
- stats.record_data_point locked_jobs
36
- end
37
- end
38
- end
39
- end
40
- end