Created
February 7, 2018 20:51
-
-
Save we4tech/f6e780047820ba6e3eabedb1d26cb66d to your computer and use it in GitHub Desktop.
Add TracePoint to find certain classes from the rails environment
This file contains hidden or 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
# 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