diff --git a/CHANGELOG.md b/CHANGELOG.md index 8328d642..5cbcbaa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 0.10.3 (Unreleased) - **[Feature]** Introduce ability to brand Web UI with environment (Pro). - [Enhancement] Support schedule cancellation via Web UI. +- [Enhancement] Rename "probing" to "tracing" to better reflect what this commanding option does. - [Fix] Fix not working primary and secondary alert styles. ## 0.10.2 (2024-09-03) diff --git a/lib/karafka/web/pro/commanding.rb b/lib/karafka/web/pro/commanding.rb index 2315d086..bddd3487 100644 --- a/lib/karafka/web/pro/commanding.rb +++ b/lib/karafka/web/pro/commanding.rb @@ -16,7 +16,7 @@ module Web module Pro # Namespace for things related to consumers commanding (management) # - # This feature allows for basic of consumers. They can be stopped, moved to quiet or probed + # This feature allows for basic of consumers. They can be stopped, moved to quiet or traced # via the Web UI module Commanding class << self diff --git a/lib/karafka/web/pro/commanding/commands/probe.rb b/lib/karafka/web/pro/commanding/commands/trace.rb similarity index 89% rename from lib/karafka/web/pro/commanding/commands/probe.rb rename to lib/karafka/web/pro/commanding/commands/trace.rb index 0db82243..00cef892 100644 --- a/lib/karafka/web/pro/commanding/commands/probe.rb +++ b/lib/karafka/web/pro/commanding/commands/trace.rb @@ -19,8 +19,8 @@ module Commanding 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 + class Trace < Base + # Runs tracing and publishes result back to Kafka def call threads = {} @@ -31,7 +31,7 @@ def call t_d[:backtrace] = (thread.backtrace || ['']).join("\n") end - Dispatcher.result(threads, process_id, 'probe') + Dispatcher.result(threads, process_id, 'trace') end end end diff --git a/lib/karafka/web/pro/commanding/listener.rb b/lib/karafka/web/pro/commanding/listener.rb index f47bc363..03cd9d15 100644 --- a/lib/karafka/web/pro/commanding/listener.rb +++ b/lib/karafka/web/pro/commanding/listener.rb @@ -16,7 +16,7 @@ module Web module Pro # Namespace for things related to consumers commanding (management) # - # This feature allows for basic of consumers. They can be stopped, moved to quiet or probed + # This feature allows for basic of consumers. They can be stopped, moved to quiet or traced # via the Web UI module Commanding # Wrapper around the Pro Iterator that yields messages with commands when needed for diff --git a/lib/karafka/web/pro/commanding/manager.rb b/lib/karafka/web/pro/commanding/manager.rb index d632b475..55cc97f1 100644 --- a/lib/karafka/web/pro/commanding/manager.rb +++ b/lib/karafka/web/pro/commanding/manager.rb @@ -79,8 +79,8 @@ def call # @param command [String] command expected to run def control(command) case command - when 'probe' - Commands::Probe.new.call + when 'trace' + Commands::Trace.new.call when 'stop' Commands::Stop.new.call when 'quiet' diff --git a/lib/karafka/web/pro/ui/app.rb b/lib/karafka/web/pro/ui/app.rb index 03b699dd..630b14fa 100644 --- a/lib/karafka/web/pro/ui/app.rb +++ b/lib/karafka/web/pro/ui/app.rb @@ -126,8 +126,8 @@ class App < Web::Ui::Base end r.on String do |process_id| - r.post 'probe' do - controller.probe(process_id) + r.post 'trace' do + controller.trace(process_id) end r.post 'quiet' do diff --git a/lib/karafka/web/pro/ui/controllers/commanding_controller.rb b/lib/karafka/web/pro/ui/controllers/commanding_controller.rb index 4c860195..2ec0708c 100644 --- a/lib/karafka/web/pro/ui/controllers/commanding_controller.rb +++ b/lib/karafka/web/pro/ui/controllers/commanding_controller.rb @@ -19,15 +19,15 @@ module Controllers # Controller responsible for handling requests that should trigger some action on the # consumers. class CommandingController < BaseController - # Dispatches the probe request to a given process + # Dispatches the trace request to a given process # # @param process_id [String] - def probe(process_id) - command(:probe, process_id) + def trace(process_id) + command(:trace, process_id) redirect( :back, - success: dispatched_to_one(:probe, process_id) + success: dispatched_to_one(:trace, process_id) ) end diff --git a/lib/karafka/web/pro/ui/views/commands/_command.erb b/lib/karafka/web/pro/ui/views/commands/_command.erb index 2efc90b4..a597ed64 100644 --- a/lib/karafka/web/pro/ui/views/commands/_command.erb +++ b/lib/karafka/web/pro/ui/views/commands/_command.erb @@ -15,7 +15,7 @@ <% color = case command[:command][:name] - when 'probe' + when 'trace' 'info' when 'quiet' 'warning' diff --git a/lib/karafka/web/pro/ui/views/consumers/_consumer_controls.erb b/lib/karafka/web/pro/ui/views/consumers/_consumer_controls.erb index 3e487836..97f17b2b 100644 --- a/lib/karafka/web/pro/ui/views/consumers/_consumer_controls.erb +++ b/lib/karafka/web/pro/ui/views/consumers/_consumer_controls.erb @@ -45,11 +45,11 @@ <% - probe_path = root_path('commanding', process.id, 'probe') + trace_path = root_path('commanding', process.id, 'trace') disabled_class = process.status != 'stopped' ? '' : 'btn-disabled' %> -
- <%== csrf_tag(probe_path) %> + + <%== csrf_tag(trace_path) %>
diff --git a/spec/fixtures/consumers_commands/v1.0.0_probe.json b/spec/fixtures/consumers_commands/v1.0.0_trace.json similarity index 89% rename from spec/fixtures/consumers_commands/v1.0.0_probe.json rename to spec/fixtures/consumers_commands/v1.0.0_trace.json index f39e5932..d492748d 100644 --- a/spec/fixtures/consumers_commands/v1.0.0_probe.json +++ b/spec/fixtures/consumers_commands/v1.0.0_trace.json @@ -2,7 +2,7 @@ "schema_version": "1.0.0", "type": "command", "command": { - "name": "probe" + "name": "trace" }, "dispatched_at": 1712518179.6275373, "process": { diff --git a/spec/fixtures/consumers_commands/v1.0.0_probe_result.json b/spec/fixtures/consumers_commands/v1.0.0_trace_result.json similarity index 98% rename from spec/fixtures/consumers_commands/v1.0.0_probe_result.json rename to spec/fixtures/consumers_commands/v1.0.0_trace_result.json index 5df0f39e..d1e44592 100644 --- a/spec/fixtures/consumers_commands/v1.0.0_probe_result.json +++ b/spec/fixtures/consumers_commands/v1.0.0_trace_result.json @@ -2,7 +2,7 @@ "schema_version": "1.0.0", "type": "result", "command": { - "name": "probe" + "name": "trace" }, "result": { "8l51": { @@ -15,7 +15,7 @@ }, "8ly9": { "label": "Thread TID-8ly9 karafka.web.pro.commanding.manager", - "backtrace": "/mnt/software/Karafka/karafka-web/lib/karafka/web/pro/commanding/manager.rb:126:in `backtrace'\n/mnt/software/Karafka/karafka-web/lib/karafka/web/pro/commanding/manager.rb:126:in `block in probe'\n/mnt/software/Karafka/karafka-web/lib/karafka/web/pro/commanding/manager.rb:122:in `each'\n/mnt/software/Karafka/karafka-web/lib/karafka/web/pro/commanding/manager.rb:122:in `probe'\n/mnt/software/Karafka/karafka-web/lib/karafka/web/pro/commanding/manager.rb:105:in `control'\n/mnt/software/Karafka/karafka-web/lib/karafka/web/pro/commanding/manager.rb:81:in `block in call'\n/mnt/software/Karafka/karafka/lib/karafka/pro/iterator.rb:91:in `block in each'\n/mnt/software/Karafka/karafka/lib/karafka/admin.rb:395:in `with_consumer'\n/mnt/software/Karafka/karafka/lib/karafka/pro/iterator.rb:73:in `each'\n/mnt/software/Karafka/karafka-web/lib/karafka/web/pro/commanding/manager.rb:75:in `call'\n/mnt/software/Karafka/karafka/lib/karafka/helpers/async.rb:40:in `block (2 levels) in async_call'" + "backtrace": "/mnt/software/Karafka/karafka-web/lib/karafka/web/pro/commanding/manager.rb:126:in `backtrace'\n/mnt/software/Karafka/karafka-web/lib/karafka/web/pro/commanding/manager.rb:126:in `block in trace'\n/mnt/software/Karafka/karafka-web/lib/karafka/web/pro/commanding/manager.rb:122:in `each'\n/mnt/software/Karafka/karafka-web/lib/karafka/web/pro/commanding/manager.rb:122:in `trace'\n/mnt/software/Karafka/karafka-web/lib/karafka/web/pro/commanding/manager.rb:105:in `control'\n/mnt/software/Karafka/karafka-web/lib/karafka/web/pro/commanding/manager.rb:81:in `block in call'\n/mnt/software/Karafka/karafka/lib/karafka/pro/iterator.rb:91:in `block in each'\n/mnt/software/Karafka/karafka/lib/karafka/admin.rb:395:in `with_consumer'\n/mnt/software/Karafka/karafka/lib/karafka/pro/iterator.rb:73:in `each'\n/mnt/software/Karafka/karafka-web/lib/karafka/web/pro/commanding/manager.rb:75:in `call'\n/mnt/software/Karafka/karafka/lib/karafka/helpers/async.rb:40:in `block (2 levels) in async_call'" }, "8lyt": { "label": "Thread TID-8lyt karafka.web.tracking.scheduler", diff --git a/spec/lib/karafka/web/pro/commanding/commands/probe_spec.rb b/spec/lib/karafka/web/pro/commanding/commands/trace_spec.rb similarity index 88% rename from spec/lib/karafka/web/pro/commanding/commands/probe_spec.rb rename to spec/lib/karafka/web/pro/commanding/commands/trace_spec.rb index 582b4de2..8a8df519 100644 --- a/spec/lib/karafka/web/pro/commanding/commands/probe_spec.rb +++ b/spec/lib/karafka/web/pro/commanding/commands/trace_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe_current do - subject(:probe_command) { described_class.new } + subject(:trace_command) { described_class.new } let(:dispatcher) { Karafka::Web::Pro::Commanding::Dispatcher } let(:test_thread) { Thread.new { sleep(0.5) } } @@ -19,12 +19,12 @@ end it 'expect to collect and publish threads backtraces to Kafka' do - probe_command.call + trace_command.call expect(dispatcher).to have_received(:result) do |threads_info, pid, action| expect(threads_info).to be_a(Hash) expect(pid).to include(mock_pid.to_s) - expect(action).to eq('probe') + expect(action).to eq('trace') thread_info = threads_info.values.first expect(thread_info[:label]).to include('Thread TID-') @@ -36,12 +36,12 @@ before { allow(Karafka::Process).to receive(:tags).and_return(%w[embedded]) } it 'expect to handle it without any issues' do - probe_command.call + trace_command.call expect(dispatcher).to have_received(:result) do |threads_info, pid, action| expect(threads_info).to be_a(Hash) expect(pid).to include(mock_pid.to_s) - expect(action).to eq('probe') + expect(action).to eq('trace') thread_info = threads_info.values.first expect(thread_info[:label]).to include('Thread TID-') diff --git a/spec/lib/karafka/web/pro/commanding/manager_spec.rb b/spec/lib/karafka/web/pro/commanding/manager_spec.rb index b4e81dce..79cb39d5 100644 --- a/spec/lib/karafka/web/pro/commanding/manager_spec.rb +++ b/spec/lib/karafka/web/pro/commanding/manager_spec.rb @@ -62,18 +62,18 @@ allow(matcher).to receive(:matches?).with(message).and_return(true) end - context 'when command is probe' do - let(:probe_command) { Karafka::Web::Pro::Commanding::Commands::Probe.new } - let(:command_name) { 'probe' } + context 'when command is trace' do + let(:trace_command) { Karafka::Web::Pro::Commanding::Commands::Trace.new } + let(:command_name) { 'trace' } before do - allow(probe_command.class).to receive(:new).and_return(probe_command) - allow(probe_command).to receive(:call) + allow(trace_command.class).to receive(:new).and_return(trace_command) + allow(trace_command).to receive(:call) end - it 'executes probe command' do + it 'executes trace command' do manager.send(:call) - expect(probe_command).to have_received(:call) + expect(trace_command).to have_received(:call) end end diff --git a/spec/lib/karafka/web/pro/ui/controllers/commanding_controller_spec.rb b/spec/lib/karafka/web/pro/ui/controllers/commanding_controller_spec.rb index 032942e6..5416f4f9 100644 --- a/spec/lib/karafka/web/pro/ui/controllers/commanding_controller_spec.rb +++ b/spec/lib/karafka/web/pro/ui/controllers/commanding_controller_spec.rb @@ -8,8 +8,8 @@ before { topics_config.consumers.commands = commands_topic } - describe '#probe' do - before { post "commanding/#{process_id}/probe" } + describe '#trace' do + before { post "commanding/#{process_id}/trace" } it do expect(response.status).to eq(302) @@ -25,7 +25,7 @@ expect(message.payload[:schema_version]).to eq('1.0.0') expect(message.payload[:type]).to eq('command') expect(message.payload[:dispatched_at]).not_to be_nil - expect(message.payload[:command]).to eq(name: 'probe') + expect(message.payload[:command]).to eq(name: 'trace') expect(message.payload[:process]).to eq(id: process_id) end end diff --git a/spec/lib/karafka/web/pro/ui/controllers/commands_controller_spec.rb b/spec/lib/karafka/web/pro/ui/controllers/commands_controller_spec.rb index edba6889..4071005e 100644 --- a/spec/lib/karafka/web/pro/ui/controllers/commands_controller_spec.rb +++ b/spec/lib/karafka/web/pro/ui/controllers/commands_controller_spec.rb @@ -81,7 +81,7 @@ 34.times do %w[ - probe + trace stop quiet ].each do |type| @@ -102,7 +102,7 @@ expect(body).not_to include(support_message) expect(body).to include('commands/99') expect(body).to include('