Skip to content

Instantly share code, notes, and snippets.

@qrush
Last active March 31, 2020 01:38
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qrush/e454c23a4b1212650494e2a65f2d854a to your computer and use it in GitHub Desktop.
Save qrush/e454c23a4b1212650494e2a65f2d854a to your computer and use it in GitHub Desktop.
Use Honeycomb to trace ActiveRecord calls inside of ActiveJob
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
@qrush
Copy link
Author

qrush commented Jun 10, 2019

This gist adds a new trace for each job your Sidekiq (or whatever runs your jobs) runs:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment