Skip to content
Browse files

RUBY-669 moved Resque instrumentation to newrelic_rpm

  • Loading branch information...
1 parent 35521ff commit dde214b59f717dbcc1417ddd287a770dfde2f403 @gnarg gnarg committed May 25, 2012
Showing with 6 additions and 158 deletions.
  1. +3 −0 CHANGELOG
  2. +0 −8 README.md
  3. +0 −71 lib/rpm_contrib/instrumentation/resque.rb
  4. +3 −5 rpm_contrib.gemspec
  5. +0 −74 test/test_resque.rb
View
3 CHANGELOG
@@ -1,3 +1,6 @@
+* Version 2.1.11
+ - Removed Resque instrumentation in favor of instrumentation in main agent https://github.com/newrelic/rpm (version 3.4.0)
+
* Version 2.1.10
- Removed Workling instrumentation in favor of https://github.com/aurorafeint/newrelic-workling
View
8 README.md
@@ -156,14 +156,6 @@ Our instrumentation works on the underlying 'Mongo' library.
You can disable it by setting 'disable_mongodb' to true in your newrelic.yml file.
-### Resque
-
-To instrument jobs you no longer need to have your Job class inherit from Resque::Job or include
-the Resque::Plugins::NewRelicInstrumentation module. The module definition was left in for
-backward compatibility.
-
-To disable resque, set 'disable_resque' to true in your newrelic.yml file.
-
### Redis
Redis instrumentation has been removed from rpm_contrib.
View
71 lib/rpm_contrib/instrumentation/resque.rb
@@ -1,71 +0,0 @@
-require 'rpm_contrib/language_support'
-
-# call this now so it is memoized before potentially forking worker processes
-RPMContrib::LanguageSupport.can_fork?
-
-module Resque
- module Plugins
- module NewRelicInstrumentation
- include NewRelic::Agent::Instrumentation::ControllerInstrumentation
-
- def around_perform_with_monitoring(*args)
- begin
- perform_action_with_newrelic_trace(:name => 'perform',
- :class_name => self.name,
- :category => 'OtherTransaction/ResqueJob') do
- yield(*args)
- end
- ensure
- NewRelic::Agent.shutdown if RPMContrib::LanguageSupport.can_fork?
- end
- end
- end
- end
-end
-
-module RPMContrib
- module Instrumentation
- module ResqueInstrumentationInstaller
- def payload_class
- klass = super
- klass.instance_eval do
- extend ::Resque::Plugins::NewRelicInstrumentation
- end
- end
- end
- end
-end
-
-DependencyDetection.defer do
- @name = :resque
-
- depends_on do
- defined?(::Resque::Job) and not NewRelic::Control.instance['disable_resque']
- end
-
- executes do
- NewRelic::Agent.logger.debug 'Installing Resque instrumentation'
- end
-
- executes do
- # == Resque Instrumentation
- #
- # Installs a hook to ensure the agent starts manually when the worker
- # starts and also adds the tracer to the process method which executes
- # in the forked task.
- ::Resque::Job.class_eval do
- def self.new(*args)
- super(*args).extend RPMContrib::Instrumentation::ResqueInstrumentationInstaller
- end
- end
-
- ::Resque.before_first_fork do
- NewRelic::Agent.manual_start(:dispatcher => :resque,
- :sync_startup => true)
- end
-
- ::Resque.after_fork do
- NewRelic::Agent.after_fork(:force_reconnect => false)
- end
- end
-end
View
8 rpm_contrib.gemspec
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = "rpm_contrib"
- s.version = "2.1.10"
+ s.version = "2.1.11"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Bill Kayser", "Jon Guymon"]
- s.date = "2012-05-17"
+ s.date = "2012-05-25"
s.description = "Community contributed instrumentation for various frameworks based on\nthe New Relic Ruby monitoring gem newrelic_rpm.\n"
s.email = "support@newrelic.com"
s.extra_rdoc_files = [
@@ -41,7 +41,6 @@ Gem::Specification.new do |s|
"lib/rpm_contrib/instrumentation/mongoid.rb",
"lib/rpm_contrib/instrumentation/paperclip.rb",
"lib/rpm_contrib/instrumentation/picky.rb",
- "lib/rpm_contrib/instrumentation/resque.rb",
"lib/rpm_contrib/instrumentation/sinatra.rb",
"lib/rpm_contrib/instrumentation/thinking_sphinx.rb",
"lib/rpm_contrib/instrumentation/typhoeus.rb",
@@ -52,8 +51,7 @@ Gem::Specification.new do |s|
"test/helper.rb",
"test/schema.rb",
"test/test_curb.rb",
- "test/test_picky.rb",
- "test/test_resque.rb"
+ "test/test_picky.rb"
]
s.homepage = "http://github.com/newrelic/rpm_contrib"
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Contributed Instrumentation for New Relic RPM", "-m", "README.md"]
View
74 test/test_resque.rb
@@ -1,74 +0,0 @@
-require 'resque'
-require 'mocha'
-require File.expand_path(File.dirname(__FILE__) + "/helper")
-require File.expand_path(File.dirname(__FILE__) + "/../lib/rpm_contrib")
-
-class ResqueTest < Test::Unit::TestCase
- class ExtendoJorb < ::Resque::Job
- def self.perform
- true
- end
- end
-
- class GoodJorb
- def self.perform
- true
- end
- end
-
- class BadJorb
- def self.perform
- raise "I'm doing a bad jorb"
- end
- end
-
- def setup
- @worker = Resque::Worker.new(:test)
- NewRelic::Agent.manual_start
- @engine = NewRelic::Agent.instance.stats_engine
- end
-
- def teardown
- @engine.clear_stats
- end
-
- def test_should_instrument_job_extending_from_resque_job
- @worker.perform(Resque::Job.new(:test,
- 'class' => 'ResqueTest::ExtendoJorb'))
-
- metrics = [ 'OtherTransaction/all', 'OtherTransaction/ResqueJob/all',
- 'OtherTransaction/ResqueJob/ResqueTest::ExtendoJorb/perform' ]
- metrics.each do |metric|
- assert(@engine.metrics.include?(metric),
- "#{@engine.metrics.inspect} missing #{metric}")
- end
- assert !@engine.metrics.include?('Errors/all')
- end
-
- def test_should_instrument_poro_job
- @worker.perform(Resque::Job.new(:test, 'class' => 'ResqueTest::GoodJorb'))
-
- metrics = [ 'OtherTransaction/all', 'OtherTransaction/ResqueJob/all',
- 'OtherTransaction/ResqueJob/ResqueTest::GoodJorb/perform' ]
- metrics.each do |metric|
- assert(@engine.metrics.include?(metric),
- "#{@engine.metrics.inspect} missing #{metric}")
- end
- assert !@engine.metrics.include?('Errors/all')
- end
-
- def test_should_collect_job_errors
- begin
- @worker.perform(Resque::Job.new(:test, 'class' => 'ResqueTest::BadJorb'))
- rescue
- end
-
- metrics = [ 'OtherTransaction/all', 'OtherTransaction/ResqueJob/all',
- 'OtherTransaction/ResqueJob/ResqueTest::BadJorb/perform',
- 'Errors/all' ]
- metrics.each do |metric|
- assert(@engine.metrics.include?(metric),
- "#{@engine.metrics.inspect} missing #{metric}")
- end
- end
-end

4 comments on commit dde214b

@jlecour
jlecour commented on dde214b Jun 4, 2012

Hi,

You have removed the Resque support from the "stable" version of this gem, saying that it is now in the main RPM gem but as of now, it's only on the dev branch (that will become version 3.4.0) which is not published yet.

Does it mean that there is no Resque instrumentation in RPM if we have the latest version of the two gems ?

Thanks

@samg
New Relic member
samg commented on dde214b Jun 4, 2012

@jlecour, we're planning to release version 3.4.0 in a couple weeks, which, as you mention, adds resque support to the newrelic_rpm gem.

In the meantime you have a few options.

You can run 3.4.0.beta1 (http://rubygems.org/gems/newrelic_rpm/versions/3.4.0.beta1) which has the resque instrumentation included.

Alternatively, if you don't want to put a beta in production, I'd suggest running newrelic_rpm version 3.3.5 (the current GA) with the previous version of rpm_contrib (2.1.10). The only change made to rpm_contrib between 2.1.10 and 2.1.11 is to remove the resque instrumentation (and update the README).

Hopefully that will work for you. Sorry for the hassle.

@jlecour
jlecour commented on dde214b Jun 4, 2012

Hi @samg

That's exactly what I've done ; specify the rpm_contrib version to 2.1.10 until newrelic_rpm 3.4 is released.

Thanks

@jagthedrummer

In the mean time someone should update the Resque docs on NewRelic. I wasted a lot of time trying to get things working before coming across this comment thread attached to a commit in the git repo. It's not really where I'd expect to have to go for up to date installation info.

Please sign in to comment.
Something went wrong with that request. Please try again.