Sha256: 5dfb4d951aeeb490c3c34fcbed867320756bde15808566f3a1612d73cdebe48c

Contents?: true

Size: 1.07 KB

Versions: 11

Compression:

Stored size: 1.07 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

DependencyDetection.defer do
  @name = :sidekiq

  depends_on do
    defined?(::Sidekiq) && !NewRelic::Agent.config[:disable_sidekiq]
  end

  executes do
    ::NewRelic::Agent.logger.info 'Installing Sidekiq instrumentation'
  end

  executes do
    class NewRelic::SidekiqInstrumentation
      include NewRelic::Agent::Instrumentation::ControllerInstrumentation

      def call(worker, msg, queue)
        perform_action_with_newrelic_trace(
          :name => 'perform',
          :class_name => msg['class'],
          :category => 'OtherTransaction/SidekiqJob') do

          if NewRelic::Agent.config[:'sidekiq.capture_params']
            NewRelic::Agent.add_custom_parameters(:job_arguments => msg['args'])
          end

          yield
        end
      end
    end

    Sidekiq.configure_server do |config|
      config.server_middleware do |chain|
        chain.add NewRelic::SidekiqInstrumentation
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
newrelic_rpm-3.7.3.204 lib/new_relic/agent/instrumentation/sidekiq.rb
newrelic_rpm-3.7.3.199 lib/new_relic/agent/instrumentation/sidekiq.rb
newrelic_rpm-3.7.2.195 lib/new_relic/agent/instrumentation/sidekiq.rb
newrelic_rpm-3.7.2.192 lib/new_relic/agent/instrumentation/sidekiq.rb
newrelic_rpm-3.7.2.190.beta lib/new_relic/agent/instrumentation/sidekiq.rb
newrelic_rpm-3.7.1.188 lib/new_relic/agent/instrumentation/sidekiq.rb
newrelic_rpm-3.7.1.182 lib/new_relic/agent/instrumentation/sidekiq.rb
newrelic_rpm-3.7.1.180 lib/new_relic/agent/instrumentation/sidekiq.rb
newrelic_rpm-3.7.0.177 lib/new_relic/agent/instrumentation/sidekiq.rb
newrelic_rpm-3.7.0.174.beta lib/new_relic/agent/instrumentation/sidekiq.rb
newrelic_rpm-3.6.9.171 lib/new_relic/agent/instrumentation/sidekiq.rb