Skip to content

Instantly share code, notes, and snippets.

@we4tech
Created February 7, 2018 20:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save we4tech/f6e780047820ba6e3eabedb1d26cb66d to your computer and use it in GitHub Desktop.
Save we4tech/f6e780047820ba6e3eabedb1d26cb66d to your computer and use it in GitHub Desktop.
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