Sha256: f47ffb4ac7d0f56869202104336d62e99aa179d228e9bdc4aecffb31abaf5bd3

Contents?: true

Size: 1.39 KB

Versions: 11

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

# This Karafka component is a Pro component under a commercial license.
# This Karafka component is NOT licensed under LGPL.
#
# All of the commercial components are present in the lib/karafka/pro directory of this
# repository and their usage requires commercial license agreement.
#
# Karafka has also commercial-friendly license, commercial support and commercial components.
#
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
# your code to Maciej Mensfeld.

module Karafka
  module Web
    module Pro
      module Commanding
        # Namespace for commands the process can react to
        module Commands
          # Collects all backtraces from the available Ruby threads and publishes their details
          #   back to Kafka for debug.
          class Probe < Base
            # Runs probing and publishes result back to Kafka
            def call
              threads = {}

              Thread.list.each do |thread|
                tid = (thread.object_id ^ ::Process.pid).to_s(36)
                t_d = threads[tid] = {}
                t_d[:label] = "Thread TID-#{tid} #{thread.name}"
                t_d[:backtrace] = (thread.backtrace || ['<no backtrace available>']).join("\n")
              end

              Dispatcher.result(threads, process_id, 'probe')
            end
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
karafka-web-0.10.2 lib/karafka/web/pro/commanding/commands/probe.rb
karafka-web-0.10.1 lib/karafka/web/pro/commanding/commands/probe.rb
karafka-web-0.10.0 lib/karafka/web/pro/commanding/commands/probe.rb
karafka-web-0.10.0.rc2 lib/karafka/web/pro/commanding/commands/probe.rb
karafka-web-0.10.0.rc1 lib/karafka/web/pro/commanding/commands/probe.rb
karafka-web-0.10.0.beta1 lib/karafka/web/pro/commanding/commands/probe.rb
karafka-web-0.9.1 lib/karafka/web/pro/commanding/commands/probe.rb
karafka-web-0.9.0 lib/karafka/web/pro/commanding/commands/probe.rb
karafka-web-0.9.0.rc3 lib/karafka/web/pro/commanding/commands/probe.rb
karafka-web-0.9.0.rc2 lib/karafka/web/pro/commanding/commands/probe.rb
karafka-web-0.9.0.rc1 lib/karafka/web/pro/commanding/commands/probe.rb