Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

572 B
Raw Blame
module OpenProject
  module Logging
    module ThreadPoolContextBuilder
      module_function

      ##
      # Build an object informing about current Rails connection pool
      # and active thread usage and their traces
      def 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:
        }
      end
    end
  end
end