Skip to content

Instantly share code, notes, and snippets.

@we4tech we4tech/boot.rb
Created Feb 7, 2018

Embed
What would you like to do?
Add TracePoint to find certain classes from the rails environment
# Add ruby tracepoint
EXCLUDED_CLASSES = %w(Sidekiq::Worker Delayed::Worker Unicorn::Worker Sidekiq::Worker Parallel::DeadWorker
Parallel::Worker Concurrent::RubyThreadPoolExecutor::Worker Twilio::REST::TaskRouter::Worker)
$__TRACE_WORKERS = []
trace = TracePoint.new(:class) do |tp|
class_name = tp.self.name
next if class_name.nil?
next if EXCLUDED_CLASSES.include?(class_name)
next unless class_name.match(/Worker$/)
$__TRACE_WORKERS << class_name
end
trace.enable
# End ruby tracepoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.