Class: Karafka::Web::Pro::Commanding::Commands::Consumers::Trace
- Defined in:
- lib/karafka/web/pro/commanding/commands/consumers/trace.rb
Overview
Collects all backtraces from the available Ruby threads and publishes their details back to Kafka for debug.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#call ⇒ Object
Runs tracing and publishes result back to Kafka.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Karafka::Web::Pro::Commanding::Commands::Base
Instance Method Details
#call ⇒ Object
Runs tracing and publishes result back to Kafka
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/karafka/web/pro/commanding/commands/consumers/trace.rb', line 19 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 result(threads) end |