karafka-web 0.10.2 → 0.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +17 -0
- data/Gemfile.lock +12 -10
- data/config/locales/pro_errors.yml +7 -1
- data/docker-compose.yml +1 -1
- data/karafka-web.gemspec +8 -2
- data/lib/karafka/web/config.rb +6 -1
- data/lib/karafka/web/contracts/config.rb +1 -0
- data/lib/karafka/web/management/actions/create_topics.rb +1 -1
- data/lib/karafka/web/pro/commanding/commands/{probe.rb → trace.rb} +3 -3
- data/lib/karafka/web/pro/commanding/listener.rb +1 -1
- data/lib/karafka/web/pro/commanding/manager.rb +2 -2
- data/lib/karafka/web/pro/commanding.rb +1 -1
- data/lib/karafka/web/pro/loader.rb +23 -2
- data/lib/karafka/web/pro/ui/app.rb +12 -2
- data/lib/karafka/web/pro/ui/controllers/commanding_controller.rb +4 -4
- data/lib/karafka/web/pro/ui/controllers/routing_controller.rb +18 -1
- data/lib/karafka/web/pro/ui/controllers/scheduled_messages/messages_controller.rb +60 -0
- data/lib/karafka/web/pro/ui/lib/branding/config.rb +40 -0
- data/lib/karafka/web/pro/ui/lib/branding/contracts/config.rb +56 -0
- data/lib/karafka/web/pro/ui/lib/branding.rb +36 -0
- data/lib/karafka/web/pro/ui/views/commands/_command.erb +1 -1
- data/lib/karafka/web/pro/ui/views/consumers/_consumer_controls.erb +3 -3
- data/lib/karafka/web/pro/ui/views/consumers/consumer/_commands.erb +4 -4
- data/lib/karafka/web/pro/ui/views/recurring_tasks/_actions.erb +2 -2
- data/lib/karafka/web/pro/ui/views/routing/_consumer_group.erb +2 -0
- data/lib/karafka/web/pro/ui/views/routing/_topic.erb +10 -0
- data/lib/karafka/web/pro/ui/views/scheduled_messages/explorer/_key.erb +9 -0
- data/lib/karafka/web/pro/ui/views/scheduled_messages/explorer/_message.erb +51 -13
- data/lib/karafka/web/pro/ui/views/shared/_navigation.erb +20 -15
- data/lib/karafka/web/pro/ui/views/shared/branding/_label.erb +20 -0
- data/lib/karafka/web/pro/ui/views/shared/branding/_notice.erb +13 -0
- data/lib/karafka/web/tracking/consumers/listeners/errors.rb +38 -9
- data/lib/karafka/web/tracking/producers/reporter.rb +1 -8
- data/lib/karafka/web/ui/helpers/tailwind_helper.rb +5 -4
- data/lib/karafka/web/ui/public/javascripts/application.js +1 -0
- data/lib/karafka/web/ui/public/javascripts/application.min.js +4 -3
- data/lib/karafka/web/ui/public/javascripts/application.min.js.br +0 -0
- data/lib/karafka/web/ui/public/javascripts/application.min.js.gz +0 -0
- data/lib/karafka/web/ui/public/javascripts/components/btn_toggle_manager.js +31 -11
- data/lib/karafka/web/ui/public/stylesheets/application.css +21 -0
- data/lib/karafka/web/ui/public/stylesheets/application.min.css +2 -1
- data/lib/karafka/web/ui/public/stylesheets/application.min.css.br +0 -0
- data/lib/karafka/web/ui/public/stylesheets/application.min.css.gz +0 -0
- data/lib/karafka/web/ui/public/stylesheets/libs/tailwind.css +69 -2
- data/lib/karafka/web/ui/views/layout.erb +5 -2
- data/lib/karafka/web/ui/views/shared/_brand.erb +3 -2
- data/lib/karafka/web/ui/views/shared/_navigation.erb +19 -15
- data/lib/karafka/web/ui/views/shared/alerts/_error.erb +3 -1
- data/lib/karafka/web/ui/views/shared/alerts/_info.erb +1 -1
- data/lib/karafka/web/ui/views/shared/alerts/_primary.erb +3 -1
- data/lib/karafka/web/ui/views/shared/alerts/_secondary.erb +3 -1
- data/lib/karafka/web/ui/views/shared/alerts/_success.erb +3 -1
- data/lib/karafka/web/ui/views/shared/alerts/_warning.erb +3 -1
- data/lib/karafka/web/ui/views/shared/icons/_chevron.erb +4 -0
- data/lib/karafka/web/version.rb +1 -1
- data/lib/karafka/web.rb +6 -1
- data/package-lock.json +40 -35
- data.tar.gz.sig +0 -0
- metadata +13 -15
- metadata.gz.sig +0 -0
- data/.coditsu/ci.yml +0 -3
- data/.diffend.yml +0 -3
- data/.github/FUNDING.yml +0 -1
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -50
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- data/.github/workflows/ci.yml +0 -133
- data/.gitignore +0 -71
- data/.rspec +0 -1
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13c431e0fa6d1b8927bd419298bc0ea522f0e823f91197fe989f72a9a08479ad
|
4
|
+
data.tar.gz: 6424f804a013bc34d1393fa79962cfacab6e6d5028726b7e90e93ada457b7a48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3ccb77dcf9624e1ca23473a963ea59cd8efc227feae098c7a80898b45c573eb70b564fd963abc6d3b0dd01a4b9e0577c1708bc2904afa6c5523360fc3880362
|
7
|
+
data.tar.gz: 60f20e2ed98fb8818164157e91ce117c5fb2d6b60f5c1371abef787f0f637269f27ed378a0ca8ffe7e95c43defddfc4749cfe1c06cbf905c8e591f8b171c2c36
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# Karafka Web Changelog
|
2
2
|
|
3
|
+
## 0.10.4 (2024-11-26)
|
4
|
+
- **[Breaking]** Drop Ruby `3.0` support according to the EOL schedule.
|
5
|
+
- [Enhancement] Extract producers tracking `sync_threshold` into an internal config.
|
6
|
+
- [Enhancement] Support complex Pro license loading strategies (Pro).
|
7
|
+
- [Enhancement] Change default `retention.ms` for the metrics topic to support Redpanda Cloud defaults (#450).
|
8
|
+
- [Enhancement] Include subscription group id in the consumers error tracking metadata.
|
9
|
+
- [Enhancement] Collect metadata details of low level client errors when error tracking.
|
10
|
+
- [Enhancement] Collect metadata details of low level listener errors when error tracking.
|
11
|
+
- [Fix] Toggle menu button post-turbo refresh stops working.
|
12
|
+
|
13
|
+
## 0.10.3 (2024-09-17)
|
14
|
+
- **[Feature]** Introduce ability to brand Web UI with environment (Pro).
|
15
|
+
- [Enhancement] Provide assignment status in the routing (Pro).
|
16
|
+
- [Enhancement] Support schedule cancellation via Web UI.
|
17
|
+
- [Enhancement] Rename "probing" to "tracing" to better reflect what this commanding option does.
|
18
|
+
- [Fix] Fix not working primary and secondary alert styles.
|
19
|
+
|
3
20
|
## 0.10.2 (2024-09-03)
|
4
21
|
- **[Feature]** Support Future Messages management (Pro).
|
5
22
|
- [Enhancement] Do not live-reload when form active.
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
karafka-web (0.10.
|
4
|
+
karafka-web (0.10.4)
|
5
5
|
erubi (~> 1.4)
|
6
6
|
karafka (>= 2.4.10, < 2.5.0)
|
7
7
|
karafka-core (>= 2.4.0, < 2.5.0)
|
@@ -11,20 +11,21 @@ PATH
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
activesupport (7.1
|
14
|
+
activesupport (7.2.1)
|
15
15
|
base64
|
16
16
|
bigdecimal
|
17
|
-
concurrent-ruby (~> 1.0, >= 1.
|
17
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
18
18
|
connection_pool (>= 2.2.5)
|
19
19
|
drb
|
20
20
|
i18n (>= 1.6, < 2)
|
21
|
+
logger (>= 1.4.2)
|
21
22
|
minitest (>= 5.1)
|
22
|
-
|
23
|
-
tzinfo (~> 2.0)
|
23
|
+
securerandom (>= 0.3)
|
24
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
24
25
|
base64 (0.2.0)
|
25
26
|
bigdecimal (3.1.8)
|
26
27
|
byebug (11.1.3)
|
27
|
-
concurrent-ruby (1.3.
|
28
|
+
concurrent-ruby (1.3.4)
|
28
29
|
connection_pool (2.4.1)
|
29
30
|
diff-lcs (1.5.1)
|
30
31
|
docile (1.4.0)
|
@@ -32,7 +33,7 @@ GEM
|
|
32
33
|
erubi (1.13.0)
|
33
34
|
et-orbi (1.2.11)
|
34
35
|
tzinfo
|
35
|
-
factory_bot (6.
|
36
|
+
factory_bot (6.5.0)
|
36
37
|
activesupport (>= 5.0.0)
|
37
38
|
ffi (1.17.0)
|
38
39
|
fugit (1.11.1)
|
@@ -52,10 +53,10 @@ GEM
|
|
52
53
|
ffi (~> 1.15)
|
53
54
|
mini_portile2 (~> 2.6)
|
54
55
|
rake (> 12)
|
56
|
+
logger (1.6.1)
|
55
57
|
mini_portile2 (2.8.7)
|
56
|
-
minitest (5.
|
57
|
-
|
58
|
-
ostruct (0.6.0)
|
58
|
+
minitest (5.25.1)
|
59
|
+
ostruct (0.6.1)
|
59
60
|
raabro (1.4.0)
|
60
61
|
rack (3.1.4)
|
61
62
|
rack-test (2.1.0)
|
@@ -79,6 +80,7 @@ GEM
|
|
79
80
|
diff-lcs (>= 1.2.0, < 2.0)
|
80
81
|
rspec-support (~> 3.13.0)
|
81
82
|
rspec-support (3.13.1)
|
83
|
+
securerandom (0.3.1)
|
82
84
|
simplecov (0.22.0)
|
83
85
|
docile (~> 1.1)
|
84
86
|
simplecov-html (~> 0.11)
|
@@ -2,21 +2,27 @@ en:
|
|
2
2
|
validations:
|
3
3
|
config:
|
4
4
|
missing: needs to be present
|
5
|
+
key_must_be_a_symbol: All keys under the kafka settings scope need to be symbols
|
5
6
|
|
6
7
|
commanding.active_format: needs to be either true or false
|
7
8
|
commanding.consumer_group_format: 'needs to be a string with a Kafka accepted format'
|
8
9
|
commanding.max_wait_time_format: needs to be an integer bigger than 0
|
9
10
|
commanding.pause_timeout_format: needs to be an integer bigger than 0
|
10
|
-
key_must_be_a_symbol: All keys under the kafka settings scope need to be symbols
|
11
11
|
commanding.kafka_format: needs to be a filled hash
|
12
|
+
|
12
13
|
ui.search.matchers_must_have_name_and_call: 'must respond to #name and its instance to #call'
|
13
14
|
ui.search.matchers_format: must be an array with matchers
|
14
15
|
ui.search.matchers_name_must_be_valid: all matchers names must be non-empty strings
|
15
16
|
ui.search.limits_format: all limits need to be integers bigger than 0
|
16
17
|
ui.search.timeout_format: must be at least 1 ms
|
18
|
+
|
17
19
|
ui.policies.messages_format: cannot be nil
|
18
20
|
ui.policies.requests_format: cannot be nil
|
19
21
|
|
22
|
+
ui.branding.type_format: 'must be :info, :error, :warning, :success, :primary or :secondary'
|
23
|
+
ui.branding.label_format: must be false or non-empty string
|
24
|
+
ui.branding.notice_format: must be false or non-empty string
|
25
|
+
|
20
26
|
search_form:
|
21
27
|
missing: needs to be present
|
22
28
|
timestamp_key_must_be_large_enough: 'must be a Kafka message timestamp with ms precision'
|
data/docker-compose.yml
CHANGED
data/karafka-web.gemspec
CHANGED
@@ -24,17 +24,23 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.add_development_dependency 'rackup', '~> 0.2'
|
26
26
|
|
27
|
-
spec.required_ruby_version = '>= 3.
|
27
|
+
spec.required_ruby_version = '>= 3.1.0'
|
28
28
|
|
29
29
|
if $PROGRAM_NAME.end_with?('gem')
|
30
30
|
spec.signing_key = File.expand_path('~/.ssh/gem-private_key.pem')
|
31
31
|
end
|
32
32
|
|
33
33
|
spec.cert_chain = %w[certs/cert.pem]
|
34
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
|
35
34
|
spec.executables = %w[karafka-web]
|
36
35
|
spec.require_paths = %w[lib]
|
37
36
|
|
37
|
+
spec.files = `git ls-files -z`
|
38
|
+
.split("\x0")
|
39
|
+
.reject { |f| f.match(%r{^(spec)/}) }
|
40
|
+
.reject { |f| f.include?('.github') }
|
41
|
+
.reject { |f| f.start_with?('.') }
|
42
|
+
.reject { |f| f.end_with?('.map') }
|
43
|
+
|
38
44
|
spec.metadata = {
|
39
45
|
'funding_uri' => 'https://karafka.io/#become-pro',
|
40
46
|
'homepage_uri' => 'https://karafka.io',
|
data/lib/karafka/web/config.rb
CHANGED
@@ -76,7 +76,7 @@ module Karafka
|
|
76
76
|
# Reports the metrics collected in the consumer sampler
|
77
77
|
setting :reporter, default: Tracking::Consumers::Reporter.new
|
78
78
|
|
79
|
-
# Minimum number of messages to produce
|
79
|
+
# Minimum number of messages to produce them in sync mode
|
80
80
|
# This acts as a small back-off not to overload the system in case we would have
|
81
81
|
# extremely big number of errors and reports happening
|
82
82
|
setting :sync_threshold, default: 50
|
@@ -98,6 +98,11 @@ module Karafka
|
|
98
98
|
end
|
99
99
|
|
100
100
|
setting :producers do
|
101
|
+
# Minimum number of messages to produce them in sync mode
|
102
|
+
# This acts as a small back-off not to overload the system in case we would have
|
103
|
+
# extremely big number of errors happening
|
104
|
+
setting :sync_threshold, default: 25
|
105
|
+
|
101
106
|
# Reports the metrics collected in the producer sampler
|
102
107
|
setting :reporter, default: Tracking::Producers::Reporter.new
|
103
108
|
|
@@ -19,8 +19,8 @@ module Karafka
|
|
19
19
|
module Commands
|
20
20
|
# Collects all backtraces from the available Ruby threads and publishes their details
|
21
21
|
# back to Kafka for debug.
|
22
|
-
class
|
23
|
-
# Runs
|
22
|
+
class Trace < Base
|
23
|
+
# Runs tracing and publishes result back to Kafka
|
24
24
|
def call
|
25
25
|
threads = {}
|
26
26
|
|
@@ -31,7 +31,7 @@ module Karafka
|
|
31
31
|
t_d[:backtrace] = (thread.backtrace || ['<no backtrace available>']).join("\n")
|
32
32
|
end
|
33
33
|
|
34
|
-
Dispatcher.result(threads, process_id, '
|
34
|
+
Dispatcher.result(threads, process_id, 'trace')
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -16,7 +16,7 @@ module Karafka
|
|
16
16
|
module Pro
|
17
17
|
# Namespace for things related to consumers commanding (management)
|
18
18
|
#
|
19
|
-
# This feature allows for basic of consumers. They can be stopped, moved to quiet or
|
19
|
+
# This feature allows for basic of consumers. They can be stopped, moved to quiet or traced
|
20
20
|
# via the Web UI
|
21
21
|
module Commanding
|
22
22
|
# Wrapper around the Pro Iterator that yields messages with commands when needed for
|
@@ -16,7 +16,7 @@ module Karafka
|
|
16
16
|
module Pro
|
17
17
|
# Namespace for things related to consumers commanding (management)
|
18
18
|
#
|
19
|
-
# This feature allows for basic of consumers. They can be stopped, moved to quiet or
|
19
|
+
# This feature allows for basic of consumers. They can be stopped, moved to quiet or traced
|
20
20
|
# via the Web UI
|
21
21
|
module Commanding
|
22
22
|
class << self
|
@@ -17,6 +17,25 @@ module Karafka
|
|
17
17
|
# Loader requires and loads all the pro components only when they are needed
|
18
18
|
class Loader
|
19
19
|
class << self
|
20
|
+
# This loads the pro components into memory in case someone required karafka-web prior
|
21
|
+
# to the license usage. This can happen for users with complex require flows, where
|
22
|
+
# Karafka license is not part of the standard flow
|
23
|
+
#
|
24
|
+
# In such cases Web may not notice that Karafka should operate in a Pro mode when it is
|
25
|
+
# being required via Zeitwerk. In such cases we load Pro components prior to the setup.
|
26
|
+
def load_on_late_setup
|
27
|
+
return if defined?(Karafka::Web::Pro::Commanding)
|
28
|
+
|
29
|
+
loader = Zeitwerk::Loader.new
|
30
|
+
loader.push_dir(
|
31
|
+
File.join(Karafka::Web.gem_root, 'lib/karafka/web/pro'),
|
32
|
+
namespace: Karafka::Web::Pro
|
33
|
+
)
|
34
|
+
|
35
|
+
loader.setup
|
36
|
+
loader.eager_load
|
37
|
+
end
|
38
|
+
|
20
39
|
# Loads all the Web UI pro components and configures them wherever it is expected
|
21
40
|
# @param config [Karafka::Core::Configurable::Node] web config that we can alter with pro
|
22
41
|
# components
|
@@ -28,8 +47,9 @@ module Karafka
|
|
28
47
|
|
29
48
|
# Expand UI config with extra search capabilities settings
|
30
49
|
config.ui.instance_eval do
|
31
|
-
setting(:
|
50
|
+
setting(:branding, default: Ui::Lib::Branding::Config.config)
|
32
51
|
setting(:policies, default: Ui::Lib::Policies::Config.config)
|
52
|
+
setting(:search, default: Ui::Lib::Search::Config.config)
|
33
53
|
end
|
34
54
|
end
|
35
55
|
|
@@ -38,8 +58,9 @@ module Karafka
|
|
38
58
|
# @param config [Karafka::Core::Configurable::Node]
|
39
59
|
def post_setup_all(config)
|
40
60
|
Commanding.post_setup(config)
|
41
|
-
Ui::Lib::
|
61
|
+
Ui::Lib::Branding.post_setup(config)
|
42
62
|
Ui::Lib::Policies.post_setup(config)
|
63
|
+
Ui::Lib::Search.post_setup(config)
|
43
64
|
end
|
44
65
|
end
|
45
66
|
end
|
@@ -126,8 +126,8 @@ module Karafka
|
|
126
126
|
end
|
127
127
|
|
128
128
|
r.on String do |process_id|
|
129
|
-
r.post '
|
130
|
-
controller.
|
129
|
+
r.post 'trace' do
|
130
|
+
controller.trace(process_id)
|
131
131
|
end
|
132
132
|
|
133
133
|
r.post 'quiet' do
|
@@ -302,6 +302,16 @@ module Karafka
|
|
302
302
|
end
|
303
303
|
end
|
304
304
|
|
305
|
+
r.on 'messages' do
|
306
|
+
controller = Controllers::ScheduledMessages::MessagesController.new(params)
|
307
|
+
|
308
|
+
r.post(
|
309
|
+
String, Integer, Integer, 'cancel'
|
310
|
+
) do |topic_id, partition_id, message_offset|
|
311
|
+
controller.cancel(topic_id, partition_id, message_offset)
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
305
315
|
r.get do
|
306
316
|
r.redirect root_path('scheduled_messages/schedules')
|
307
317
|
end
|
@@ -19,15 +19,15 @@ module Karafka
|
|
19
19
|
# Controller responsible for handling requests that should trigger some action on the
|
20
20
|
# consumers.
|
21
21
|
class CommandingController < BaseController
|
22
|
-
# Dispatches the
|
22
|
+
# Dispatches the trace request to a given process
|
23
23
|
#
|
24
24
|
# @param process_id [String]
|
25
|
-
def
|
26
|
-
command(:
|
25
|
+
def trace(process_id)
|
26
|
+
command(:trace, process_id)
|
27
27
|
|
28
28
|
redirect(
|
29
29
|
:back,
|
30
|
-
success: dispatched_to_one(:
|
30
|
+
success: dispatched_to_one(:trace, process_id)
|
31
31
|
)
|
32
32
|
end
|
33
33
|
|
@@ -28,11 +28,28 @@ module Karafka
|
|
28
28
|
detect_patterns_routes
|
29
29
|
|
30
30
|
@routes = Karafka::App.routes
|
31
|
-
|
32
31
|
@routes.each do |consumer_group|
|
33
32
|
refine(consumer_group.topics)
|
34
33
|
end
|
35
34
|
|
35
|
+
current_state = Models::ConsumersState.current
|
36
|
+
@assigned = Hash.new { |h, k| h[k] = Set.new }
|
37
|
+
|
38
|
+
# If there are active processes, we can use their data to mark certain topics as
|
39
|
+
# assigned. This does not cover the full scope as some partitions may be assigned
|
40
|
+
# and some not, but provides general overview
|
41
|
+
if current_state
|
42
|
+
Models::Processes.active(current_state).each do |process|
|
43
|
+
process.consumer_groups.each do |consumer_group|
|
44
|
+
consumer_group.subscription_groups.each do |subscription_group|
|
45
|
+
subscription_group.topics.each do |topic|
|
46
|
+
@assigned[consumer_group.id.to_s] << topic.name
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
36
53
|
render
|
37
54
|
end
|
38
55
|
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This Karafka component is a Pro component under a commercial license.
|
4
|
+
# This Karafka component is NOT licensed under LGPL.
|
5
|
+
#
|
6
|
+
# All of the commercial components are present in the lib/karafka/pro directory of this
|
7
|
+
# repository and their usage requires commercial license agreement.
|
8
|
+
#
|
9
|
+
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
10
|
+
#
|
11
|
+
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
12
|
+
# your code to Maciej Mensfeld.
|
13
|
+
|
14
|
+
module Karafka
|
15
|
+
module Web
|
16
|
+
module Pro
|
17
|
+
module Ui
|
18
|
+
module Controllers
|
19
|
+
module ScheduledMessages
|
20
|
+
# Provides management of schedules related messages
|
21
|
+
class MessagesController < BaseController
|
22
|
+
# Generates a cancel request for a given schedule message
|
23
|
+
# @param topic_id [String]
|
24
|
+
# @param partition_id [Integer]
|
25
|
+
# @param message_offset [Integer]
|
26
|
+
def cancel(topic_id, partition_id, message_offset)
|
27
|
+
# Fetches the message we want to cancel to get its key
|
28
|
+
scheduled_message = Karafka::Admin.read_topic(
|
29
|
+
topic_id,
|
30
|
+
partition_id,
|
31
|
+
1,
|
32
|
+
message_offset
|
33
|
+
).first
|
34
|
+
|
35
|
+
cancel_message = ::Karafka::Pro::ScheduledMessages.cancel(
|
36
|
+
key: scheduled_message.key,
|
37
|
+
envelope: {
|
38
|
+
topic: topic_id,
|
39
|
+
partition: partition_id
|
40
|
+
}
|
41
|
+
)
|
42
|
+
|
43
|
+
Karafka::Web.producer.produce_sync(cancel_message)
|
44
|
+
|
45
|
+
redirect(
|
46
|
+
:back,
|
47
|
+
success: <<~MESSAGE
|
48
|
+
A scheduled message with offset #{message_offset}
|
49
|
+
from #{topic_id} partition #{partition_id}
|
50
|
+
had a cancel request message successfully created.
|
51
|
+
MESSAGE
|
52
|
+
)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This Karafka component is a Pro component under a commercial license.
|
4
|
+
# This Karafka component is NOT licensed under LGPL.
|
5
|
+
#
|
6
|
+
# All of the commercial components are present in the lib/karafka/pro directory of this
|
7
|
+
# repository and their usage requires commercial license agreement.
|
8
|
+
#
|
9
|
+
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
10
|
+
#
|
11
|
+
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
12
|
+
# your code to Maciej Mensfeld.
|
13
|
+
|
14
|
+
module Karafka
|
15
|
+
module Web
|
16
|
+
module Pro
|
17
|
+
module Ui
|
18
|
+
module Lib
|
19
|
+
module Branding
|
20
|
+
# Extra configuration for pro UI branding feature
|
21
|
+
class Config
|
22
|
+
extend ::Karafka::Core::Configurable
|
23
|
+
|
24
|
+
# Type of styling aligned with Daisy. info, error, warning, success, primary
|
25
|
+
setting :type, default: :info
|
26
|
+
|
27
|
+
# String label with env name. Will be displayed below the logo
|
28
|
+
setting :label, default: false
|
29
|
+
|
30
|
+
# Additional wide alert notice to highlight extra details. Nothing if false
|
31
|
+
setting :notice, default: false
|
32
|
+
|
33
|
+
configure
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This Karafka component is a Pro component under a commercial license.
|
4
|
+
# This Karafka component is NOT licensed under LGPL.
|
5
|
+
#
|
6
|
+
# All of the commercial components are present in the lib/karafka/pro directory of this
|
7
|
+
# repository and their usage requires commercial license agreement.
|
8
|
+
#
|
9
|
+
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
10
|
+
#
|
11
|
+
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
12
|
+
# your code to Maciej Mensfeld.
|
13
|
+
|
14
|
+
module Karafka
|
15
|
+
module Web
|
16
|
+
module Pro
|
17
|
+
module Ui
|
18
|
+
module Lib
|
19
|
+
module Branding
|
20
|
+
# Contracts for checking branding related setup
|
21
|
+
module Contracts
|
22
|
+
# Makes sure, all the expected UI branding config is defined as it should be
|
23
|
+
class Config < ::Karafka::Contracts::Base
|
24
|
+
configure do |config|
|
25
|
+
config.error_messages = YAML.safe_load(
|
26
|
+
File.read(
|
27
|
+
File.join(Karafka::Web.gem_root, 'config', 'locales', 'pro_errors.yml')
|
28
|
+
)
|
29
|
+
).fetch('en').fetch('validations').fetch('config')
|
30
|
+
end
|
31
|
+
|
32
|
+
nested(:ui) do
|
33
|
+
nested(:branding) do
|
34
|
+
required(:type) do |val|
|
35
|
+
# Type of branding style wrapping needs to align with what we support
|
36
|
+
# in other places
|
37
|
+
::Karafka::Web::Ui::Helpers::TailwindHelper::TYPES.include?(val)
|
38
|
+
end
|
39
|
+
|
40
|
+
required(:label) do |val|
|
41
|
+
val == false || (val.is_a?(String) && val.size.positive?)
|
42
|
+
end
|
43
|
+
|
44
|
+
required(:notice) do |val|
|
45
|
+
val == false || (val.is_a?(String) && val.size.positive?)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This Karafka component is a Pro component under a commercial license.
|
4
|
+
# This Karafka component is NOT licensed under LGPL.
|
5
|
+
#
|
6
|
+
# All of the commercial components are present in the lib/karafka/pro directory of this
|
7
|
+
# repository and their usage requires commercial license agreement.
|
8
|
+
#
|
9
|
+
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
10
|
+
#
|
11
|
+
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
12
|
+
# your code to Maciej Mensfeld.
|
13
|
+
|
14
|
+
module Karafka
|
15
|
+
module Web
|
16
|
+
module Pro
|
17
|
+
module Ui
|
18
|
+
module Lib
|
19
|
+
# Namespace for UI branding related stuff
|
20
|
+
# Branding allows users to set an extra label and notice per env so users won't be
|
21
|
+
# confused by dev vs prod etc.
|
22
|
+
module Branding
|
23
|
+
class << self
|
24
|
+
# Validates that the UI branding config is correct
|
25
|
+
#
|
26
|
+
# @param config [Karafka::Core::Configurable::Node] web config
|
27
|
+
def post_setup(config)
|
28
|
+
Branding::Contracts::Config.new.validate!(config.to_h)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -45,11 +45,11 @@
|
|
45
45
|
|
46
46
|
<td class="commands-inline-3">
|
47
47
|
<%
|
48
|
-
|
48
|
+
trace_path = root_path('commanding', process.id, 'trace')
|
49
49
|
disabled_class = process.status != 'stopped' ? '' : 'btn-disabled'
|
50
50
|
%>
|
51
|
-
<form action="<%=
|
52
|
-
<%== csrf_tag(
|
51
|
+
<form action="<%= trace_path %>" method="post" class="inline" title="Trace">
|
52
|
+
<%== csrf_tag(trace_path) %>
|
53
53
|
|
54
54
|
<button type="submit" class="btn btn-info btn-sm <%= disabled_class %>">
|
55
55
|
<%== icon(:gear) %>
|
@@ -1,21 +1,21 @@
|
|
1
1
|
<% if Karafka::Web.config.commanding.active && !process.tags.include?('embedded') %>
|
2
2
|
<div class="col-span-12 flex justify-end space-x-2 mb-6">
|
3
3
|
<%
|
4
|
-
|
4
|
+
trace_path = root_path('commanding', process.id, 'trace')
|
5
5
|
disabled_class = process.status != 'stopped' ? '' : 'btn-disabled'
|
6
6
|
%>
|
7
7
|
<form
|
8
|
-
action="<%=
|
8
|
+
action="<%= trace_path %>"
|
9
9
|
method="post"
|
10
10
|
class="inline-flex items-center"
|
11
11
|
>
|
12
|
-
<%== csrf_tag(
|
12
|
+
<%== csrf_tag(trace_path) %>
|
13
13
|
<button
|
14
14
|
type="submit"
|
15
15
|
class="btn btn-info btn-sm <%= disabled_class %>"
|
16
16
|
>
|
17
17
|
<%== icon(:gear) %>
|
18
|
-
|
18
|
+
Trace
|
19
19
|
</button>
|
20
20
|
</form>
|
21
21
|
|
@@ -30,7 +30,7 @@
|
|
30
30
|
<%== csrf_tag(enable_path) %>
|
31
31
|
<button
|
32
32
|
type="submit"
|
33
|
-
class="btn btn-success btn-sm
|
33
|
+
class="btn btn-success btn-sm <%= disabled_class %>"
|
34
34
|
>
|
35
35
|
<%== icon(:check) %>
|
36
36
|
</button>
|
@@ -50,7 +50,7 @@
|
|
50
50
|
<%== csrf_tag(disable_path) %>
|
51
51
|
<button
|
52
52
|
type="submit"
|
53
|
-
class="btn btn-warning btn-sm
|
53
|
+
class="btn btn-warning btn-sm <%= disabled_class %>"
|
54
54
|
|
55
55
|
>
|
56
56
|
<%== icon(:pause) %>
|