Sha256: de2cf356cfd676c1509130bc3557f976a630b541c12faceb50584d28540a090a

Contents?: true

Size: 1.21 KB

Versions: 11

Compression:

Stored size: 1.21 KB

Contents

require 'new_relic/agent/instrumentation/controller_instrumentation'

DependencyDetection.defer do
  depends_on do
    !NewRelic::Control.instance['disable_dj']
  end

  depends_on do
    defined?(::Delayed) && defined?(::Delayed::Job)
  end

  executes do
    Delayed::Job.class_eval do
      include NewRelic::Agent::Instrumentation::ControllerInstrumentation
      if self.instance_methods.include?('name')
        add_transaction_tracer "invoke_job", :category => 'OtherTransaction/DelayedJob', :path => '#{self.name}'
      else
        add_transaction_tracer "invoke_job", :category => 'OtherTransaction/DelayedJob'
      end
    end
  end

  executes do
    Delayed::Job.instance_eval do
      if self.respond_to?('after_fork')
        if method_defined?(:after_fork)
          def after_fork_with_newrelic
            NewRelic::Agent.after_fork(:force_reconnect => true)
            after_fork_without_newrelic
          end

          alias_method :after_fork_without_newrelic, :after_fork
          alias_method :after_fork, :after_fork_with_newrelic
        else
          def after_fork
            NewRelic::Agent.after_fork(:force_reconnect => true)
            super
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
ghazel-newrelic_rpm-3.1.0.1 lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb
newrelic_rpm-3.1.0 lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb
newrelic_rpm-3.1.0.beta5 lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb
newrelic_rpm-3.1.0.beta4 lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb
newrelic_rpm-3.1.0.beta3 lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb
newrelic_rpm-3.1.0.beta2 lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb
newrelic_rpm-3.0.1 lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb
newrelic_rpm-3.1.0.beta1 lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb
newrelic_rpm-3.0.0 lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb
newrelic_rpm-3.0.0.beta2 lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb
newrelic_rpm-3.0.0.beta1 lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb