Sha256: 810b35b0adc2f60d11488ae86b038efa27297d225672065a8d98e8b5642e032e

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

module Appsignal
  module Integrations
    # @api private
    module ResqueActiveJobPlugin
      include Appsignal::Hooks::Helpers

      def self.included(base)
        base.class_eval do
          around_perform do |job, block|
            params = Appsignal::Utils::HashSanitizer.sanitize(
              job.arguments,
              Appsignal.config[:filter_parameters]
            )

            queue_start =
              if job.respond_to?(:enqueued_at) && job.enqueued_at
                Time.parse(job.enqueued_at).utc
              end

            Appsignal.monitor_single_transaction(
              "perform_job.resque",
              :class       => job.class.to_s,
              :method      => "perform",
              :params      => params,
              :queue_start => queue_start,
              :metadata    => {
                :id       => job.job_id,
                :queue    => job.queue_name
              }
            ) do
              block.call
            end
          end
        end

        Appsignal::Environment.report("ruby_active_job_resque_enabled") { true }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
appsignal-2.11.0.alpha.2 lib/appsignal/integrations/resque_active_job.rb
appsignal-2.11.0.alpha.2-java lib/appsignal/integrations/resque_active_job.rb
appsignal-2.11.0.alpha.1 lib/appsignal/integrations/resque_active_job.rb
appsignal-2.11.0.alpha.1-java lib/appsignal/integrations/resque_active_job.rb