Sha256: 7f6363c78d5c84612c5ee36d5d02a38644b6b91df21a23e68b39bbc1e07adfd6

Contents?: true

Size: 866 Bytes

Versions: 5

Compression:

Stored size: 866 Bytes

Contents

module RorVsWild
  module Plugin
    class ActiveJob
      def self.setup
        return if @installed
        return unless defined?(::ActiveJob::Base)
        ::ActiveJob::Base.around_perform(&method(:around_perform))
        @installed = true
      end

      def self.around_perform(job, block)
        RorVsWild.agent.measure_job(job.class.name, parameters: job.arguments) do
          begin
            section = RorVsWild::Section.start
            section.command = "#{job.class}#perform"
            section.file, section.line = job.method(:perform).source_location
            section.file = RorVsWild.agent.locator.relative_path(section.file)
            block.call
          rescue Exception => ex
            job.rescue_with_handler(ex) or raise
          ensure
            RorVsWild::Section.stop
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rorvswild-1.7.1 lib/rorvswild/plugin/active_job.rb
rorvswild-1.7.0 lib/rorvswild/plugin/active_job.rb
rorvswild-1.6.5 lib/rorvswild/plugin/active_job.rb
rorvswild-1.6.4 lib/rorvswild/plugin/active_job.rb
rorvswild-1.6.3 lib/rorvswild/plugin/active_job.rb