Class: RorVsWild::Plugin::Sidekiq
- Inherits:
-
Object
- Object
- RorVsWild::Plugin::Sidekiq
- Defined in:
- lib/rorvswild/plugin/sidekiq.rb
Constant Summary collapse
- INTERNAL_EXCEPTIONS =
["Sidekiq::JobRetry::Handled", "Sidekiq::JobRetry::Skip"]
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.setup(agent) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/rorvswild/plugin/sidekiq.rb', line 8 def self.setup(agent) if defined?(::Sidekiq) ::Sidekiq.configure_server do |config| config.server_middleware { |chain| chain.add(Sidekiq) } end # Prevent RailsError plugin from sending internal Sidekiq exceptions captured by ActiveSupport::ErrorReporter. agent.config[:ignore_exceptions].concat(INTERNAL_EXCEPTIONS) end end |
Instance Method Details
#call(worker, item, queue, &block) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rorvswild/plugin/sidekiq.rb', line 18 def call(worker, item, queue, &block) # Wrapped contains the real class name of the ActiveJob wrapper name = item["wrapped".freeze] || item["class".freeze] RorVsWild.agent.measure_job(name, parameters: item["args".freeze]) do section = RorVsWild::Section.start section.commands << "#{name}#perform" if perform_method = worker.method(:perform) section.file, section.line = worker.method(:perform).source_location section.file = RorVsWild.agent.locator.relative_path(section.file) end block.call RorVsWild::Section.stop end end |