OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/lib/open_project/logging/thread_pool_context_builder.rb

24 lines
565 B

module OpenProject
module Logging
class ThreadPoolContextBuilder
##
# Build an object informing about current Rails connection pool
# and active thread usage and their traces
def self.build!
thread_info = {}
Thread.list.each_with_index do |t, i|
thread_info[i] = {
info: t.inspect,
trace: t.backtrace.take(2)
}
end
{
connection_pool: ActiveRecord::Base.connection_pool.stat,
thread_info: thread_info
}
end
end
end
end