Last active
March 31, 2020 01:38
-
-
Save qrush/e454c23a4b1212650494e2a65f2d854a to your computer and use it in GitHub Desktop.
Use Honeycomb to trace ActiveRecord calls inside of ActiveJob
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationJob < ActiveJob::Base | |
around_perform do |job, block| | |
Honeycomb.start_span(name: job.class.name) do |span| | |
span.add_field 'type', 'worker' | |
span.add_field 'queue.name', job.queue_name | |
block.call | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This gist adds a new trace for each job your Sidekiq (or whatever runs your jobs) runs: