contribsys / faktory_worker_ruby

Faktory worker for Ruby
GNU Lesser General Public License v3.0
214 stars 31 forks source link

New Relic instrumentation? #81

Closed Deekor closed 6 months ago

Deekor commented 8 months ago

Looks like new relic auto detects sidekiq workers but im not seeing any way to instrument a faktory worker, is there any known way to accomplish this?

mperham commented 8 months ago

Seems like this is a better question for New Relic. I don’t know anything about their APIs or usage but I’d be happy to provide advice or change FWR to make this as easy as possible.

Deekor commented 8 months ago

Ya, figured I'd ask the community here to check if its been done, before I dive into trying to request a feature from them.

Deekor commented 6 months ago

Turns out this is as easy as

class MyWorker
  include Faktory::Job
  include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation # include new relic 

  def perform
   ...
  end

  add_transaction_tracer :perform, category: :task # trace the perform method
end