Sha256: 2e0e5b91bb7562502b8ced9ad2de8d6d27603a03d557708fea233d3c70ddc046

Contents?: true

Size: 870 Bytes

Versions: 6

Compression:

Stored size: 870 Bytes

Contents

require 'tracebin/background_timer'
require 'tracebin/puppet_master'

module Resque
  module Plugins
    module TracebinInstrumentation
      module Job
        def before_perform_with_tracebin(*args)
          @tracebin_timer = ::Tracebin::BackgroundTimer.new
          @tracebin_timer.start!

          yield *args if block_given?
        end

        def after_perform_with_tracebin(*args)
          @tracebin_timer.stop!
          ::Tracebin::PuppetMaster.new(@tracebin_timer, logger: Resque.logger).process

          yield *args if block_given?
        end
      end
    end
  end
end

module Tracebin
  module BackgroundJobInstrumentation
    module ResqueInstrumentationInstaller
      def payload_class
        klass = super
        klass.instance_eval do
          extend ::Resque::Plugins::TracebinInstrumentation::Job
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tracebin-0.0.13 lib/tracebin/background_job_instrumentation/resque.rb
tracebin-0.0.12 lib/tracebin/background_job_instrumentation/resque.rb
tracebin-0.0.11 lib/tracebin/background_job_instrumentation/resque.rb
tracebin-0.0.10 lib/tracebin/background_job_instrumentation/resque.rb
tracebin-0.0.9 lib/tracebin/background_job_instrumentation/resque.rb
tracebin-0.0.8 lib/tracebin/background_job_instrumentation/resque.rb