Sha256: 3ee082dccb9b2572b1f109eefd969a958c551f719831b2c479671844ed5bd474

Contents?: true

Size: 1.16 KB

Versions: 24

Compression:

Stored size: 1.16 KB

Contents

# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
# frozen_string_literal: true

# TODO: remove this class once Sidekiq v6 is no longer supported.
#       Delayed extensions are disabled by default in Sidekiq 5 and 6 and
#       were removed entirely in Sidekiq 7.
#
#       see https://github.com/mperham/sidekiq/issues/5076 for the discussion
#       of the removal, which includes mentions of alternatives
if defined?(Sidekiq::VERSION) && Sidekiq::VERSION < '7.0.0'
  class Sidekiq::Extensions::DelayedClass
    def newrelic_trace_args(msg, queue)
      (target, method_name, _args) = if YAML.respond_to?(:unsafe_load)
        YAML.unsafe_load(msg['args'][0])
      else
        YAML.load(msg['args'][0])
      end

      {
        :name => method_name,
        :class_name => target.name,
        :category => 'OtherTransaction/SidekiqJob'
      }
    rescue => e
      NewRelic::Agent.logger.error('Failure during deserializing YAML for Sidekiq::Extensions::DelayedClass', e)
      NewRelic::Agent::Instrumentation::Sidekiq::Server.default_trace_args(msg)
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
newrelic_rpm-9.16.0 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
newrelic_rpm-9.15.0 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
newrelic_rpm-9.14.0 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
newrelic_rpm-9.13.0 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
newrelic_rpm-9.12.0 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
newrelic_rpm-9.11.0 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
newrelic_rpm-9.10.2 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
newrelic_rpm-9.10.1 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
newrelic_rpm-9.10.0 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
newrelic_rpm-9.9.0 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
newrelic_rpm-9.8.0 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
newrelic_rpm-9.7.1 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
newrelic_rpm-9.7.0 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
newrelic_rpm-9.6.0 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
newrelic_rpm-9.5.0 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
newrelic_rpm-9.4.2 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
newrelic_rpm-9.4.1 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
newrelic_rpm-9.4.0 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
newrelic_rpm-9.3.1 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
newrelic_rpm-9.3.0 lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb