karafka-web 0.11.0.beta1 → 0.11.0.beta2
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 +1 -1
- data/Gemfile.lock +1 -1
- data/lib/karafka/web/errors.rb +0 -12
- data/lib/karafka/web/pro/ui/controllers/consumers/consumers_controller.rb +1 -3
- data/lib/karafka/web/pro/ui/views/consumers/consumers/_consumer.erb +47 -56
- data/lib/karafka/web/pro/ui/views/consumers/consumers/_consumer_performance.erb +59 -68
- data/lib/karafka/web/pro/ui/views/consumers/controls/_controls.erb +82 -91
- data/lib/karafka/web/pro/ui/views/jobs/_job.erb +38 -47
- data/lib/karafka/web/processing/consumer.rb +7 -7
- data/lib/karafka/web/processing/consumers/aggregators/state.rb +14 -14
- data/lib/karafka/web/ui/base.rb +1 -5
- data/lib/karafka/web/ui/models/process.rb +3 -1
- data/lib/karafka/web/ui/models/processes.rb +27 -6
- data/lib/karafka/web/ui/models/status.rb +1 -1
- data/lib/karafka/web/ui/public/stylesheets/libs/tailwind.css +0 -6
- data/lib/karafka/web/ui/views/consumers/_consumer.erb +30 -39
- data/lib/karafka/web/ui/views/jobs/_job.erb +29 -38
- data/lib/karafka/web/ui/views/ux/_status_rows.erb +0 -6
- data/lib/karafka/web/version.rb +1 -1
- data/package-lock.json +3 -3
- data.tar.gz.sig +0 -0
- metadata +5 -10
- metadata.gz.sig +0 -0
- data/lib/karafka/web/ui/views/consumers/_incompatible.erb +0 -13
- data/lib/karafka/web/ui/views/shared/exceptions/incompatible_schema.erb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9602c38ed3a77f91e9df0a84639567c4e36742a779cf71ae9b122d8c03be57d8
|
4
|
+
data.tar.gz: 983b13133ce81341541b39cf1ec2643de93031341cbb27277acac85d1ffbef9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 714b29c785415a9ebe46e5e823bd6eeda026b9d60267dde2d77ebd5a5ef68a278a15d4ba0cc37cbe8b6d2a55c66209e145e41e49d87d848bf6310729b5207a82
|
7
|
+
data.tar.gz: da5e93e43875cf1a625d23872f8157f11f98eb92802c692b33265447bb96f2ced2b264e6f5a933e46663060dfb94c871d6193b2e3411cfd7612cc29fb45510b4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
## 0.11.0 (Unreleased)
|
4
4
|
- **[Feature]** Provide ability to pause/resume partitions on running consumers via the UI (Pro).
|
5
5
|
- **[Feature]** Provide ability to edit offsets of running consumers (Pro).
|
6
|
-
- **[Feature]** Support consumers that have mismatching schema.
|
6
|
+
- **[Feature]** Support consumers that have mismatching schema in the Status page.
|
7
7
|
- **[Feature]** Provide ability to navigate to a timestamp in the Explorer (Pro).
|
8
8
|
- **[Feature]** Provide ability to create and delete topics from the Web UI (Pro).
|
9
9
|
- **[Feature]** Provide ability to manage topics configuration from the Web UI (Pro).
|
data/Gemfile.lock
CHANGED
data/lib/karafka/web/errors.rb
CHANGED
@@ -54,18 +54,6 @@ module Karafka
|
|
54
54
|
|
55
55
|
# Similar to the one related to consumers states
|
56
56
|
MissingConsumersMetricsTopicError = Class.new(BaseError)
|
57
|
-
|
58
|
-
# This error occurs when consumer running older version of the web-ui tries to materialize
|
59
|
-
# states from newer versions. Karafka Web-UI provides only backwards compatibility, so
|
60
|
-
# you need to have an up-to-date consumer materializing reported states.
|
61
|
-
#
|
62
|
-
# If you see this error, please make sure that the consumer process that is materializing
|
63
|
-
# your states is running at least the same version as the consumers that are reporting
|
64
|
-
# the states
|
65
|
-
#
|
66
|
-
# If you see this error do not worry. When you get a consumer with up-to-date version,
|
67
|
-
# all the historical metrics will catch up.
|
68
|
-
IncompatibleSchemaError = Class.new(BaseError)
|
69
57
|
end
|
70
58
|
|
71
59
|
# Ui related errors
|
@@ -71,9 +71,7 @@ module Karafka
|
|
71
71
|
current_state = Models::ConsumersState.current!
|
72
72
|
@process = Models::Process.find(current_state, process_id)
|
73
73
|
|
74
|
-
|
75
|
-
|
76
|
-
raise Errors::Ui::IncompatibleSchemaError
|
74
|
+
render
|
77
75
|
end
|
78
76
|
|
79
77
|
# @param process_id [String] id of the process we're interested in
|
@@ -1,59 +1,50 @@
|
|
1
1
|
<%# This code is part of Karafka Pro, a commercial component not licensed under LGPL. %>
|
2
2
|
<%# See LICENSE for details. %>
|
3
3
|
|
4
|
-
|
5
|
-
<
|
6
|
-
<
|
7
|
-
<
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
<
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
</tr>
|
52
|
-
<% else %>
|
53
|
-
<%==
|
54
|
-
partial(
|
55
|
-
'consumers/incompatible',
|
56
|
-
locals: { colspan: 5, process: process }
|
57
|
-
)
|
58
|
-
%>
|
59
|
-
<% end %>
|
4
|
+
<tr class="status-row-<%= process.status %>">
|
5
|
+
<td>
|
6
|
+
<p>
|
7
|
+
<a href="<%= consumer_path(process.id, 'subscriptions') %>">
|
8
|
+
<%== truncate(process.id, strategy: :middle) %>
|
9
|
+
</a>
|
10
|
+
</p>
|
11
|
+
|
12
|
+
<p class="mt-1">
|
13
|
+
<%== partial 'consumers/assignments_badges', locals: { process: process } %>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<p>
|
17
|
+
<%== tags(process.tags) %>
|
18
|
+
</p>
|
19
|
+
</td>
|
20
|
+
|
21
|
+
<td>
|
22
|
+
<%== relative_time process.started_at %>
|
23
|
+
</td>
|
24
|
+
|
25
|
+
<td>
|
26
|
+
<%== badge_primary_sm format_memory process.memory_usage %>
|
27
|
+
<%== badge_primary_sm format_memory process.memory_total_usage %>
|
28
|
+
<%== badge_primary_sm format_memory process.memory_size %>
|
29
|
+
</td>
|
30
|
+
|
31
|
+
<td>
|
32
|
+
<span class="badge badge-primary">
|
33
|
+
<%= process.utilization.round(1) %>%
|
34
|
+
</span>
|
35
|
+
<span class="badge badge-primary">
|
36
|
+
<%= process.workers %> /
|
37
|
+
<%= process.busy %>
|
38
|
+
</span>
|
39
|
+
</td>
|
40
|
+
|
41
|
+
<td>
|
42
|
+
<% process.cpu_usage.each do |metric| %>
|
43
|
+
<%== badge_primary_sm metric %>
|
44
|
+
<% end %>
|
45
|
+
</td>
|
46
|
+
|
47
|
+
<td>
|
48
|
+
<%= process.lag_hybrid %>
|
49
|
+
</td>
|
50
|
+
</tr>
|
@@ -1,71 +1,62 @@
|
|
1
1
|
<%# This code is part of Karafka Pro, a commercial component not licensed under LGPL. %>
|
2
2
|
<%# See LICENSE for details. %>
|
3
3
|
|
4
|
-
|
5
|
-
<
|
6
|
-
<
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
</tr>
|
64
|
-
<% else %>
|
65
|
-
<%==
|
66
|
-
partial(
|
67
|
-
'consumers/incompatible',
|
68
|
-
locals: { colspan: 12, process: process }
|
69
|
-
)
|
70
|
-
%>
|
71
|
-
<% end %>
|
4
|
+
<tr class="status-row-<%= process.status %>">
|
5
|
+
<td>
|
6
|
+
<a href="<%= consumer_path(process.id, 'subscriptions') %>">
|
7
|
+
<%== truncate(process.id, strategy: :middle) %>
|
8
|
+
</a>
|
9
|
+
|
10
|
+
<p class="mt-1">
|
11
|
+
<%== tags(process.tags) %>
|
12
|
+
</p>
|
13
|
+
</td>
|
14
|
+
|
15
|
+
<td>
|
16
|
+
<%= format_memory process.memory_usage %>
|
17
|
+
</td>
|
18
|
+
|
19
|
+
<td>
|
20
|
+
<%= process.utilization.round(1) %>%
|
21
|
+
</td>
|
22
|
+
|
23
|
+
<td>
|
24
|
+
<%= process.threads %>
|
25
|
+
</td>
|
26
|
+
|
27
|
+
<td>
|
28
|
+
<%= process.cpu_usage[0].to_f %>
|
29
|
+
</td>
|
30
|
+
|
31
|
+
<td>
|
32
|
+
<%= process.cpu_usage[1].to_f %>
|
33
|
+
</td>
|
34
|
+
|
35
|
+
<td>
|
36
|
+
<%= process.cpu_usage[2].to_f %>
|
37
|
+
</td>
|
38
|
+
|
39
|
+
<td>
|
40
|
+
<%= process.workers %>
|
41
|
+
</td>
|
42
|
+
|
43
|
+
<td>
|
44
|
+
<%= process.busy %>
|
45
|
+
</td>
|
46
|
+
|
47
|
+
<td>
|
48
|
+
<%= process.listeners.fetch(:active) %>
|
49
|
+
</td>
|
50
|
+
|
51
|
+
<td>
|
52
|
+
<%= process.listeners.fetch(:standby) %>
|
53
|
+
</td>
|
54
|
+
|
55
|
+
<td>
|
56
|
+
<%= process.jobs.running.count %>
|
57
|
+
</td>
|
58
|
+
|
59
|
+
<td>
|
60
|
+
<%= process.jobs.pending.count %>
|
61
|
+
</td>
|
62
|
+
</tr>
|
@@ -1,107 +1,98 @@
|
|
1
1
|
<%# This code is part of Karafka Pro, a commercial component not licensed under LGPL. %>
|
2
2
|
<%# See LICENSE for details. %>
|
3
3
|
|
4
|
-
|
5
|
-
<
|
6
|
-
<
|
7
|
-
|
8
|
-
|
9
|
-
</a>
|
4
|
+
<tr class="status-row-<%= process.status %>">
|
5
|
+
<td>
|
6
|
+
<a href="<%= consumer_path(process.id, 'subscriptions') %>">
|
7
|
+
<%== truncate(process.id, strategy: :middle) %>
|
8
|
+
</a>
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
<p class="mt-1">
|
11
|
+
<%== tags(process.tags) %>
|
12
|
+
</p>
|
13
|
+
</td>
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
<td>
|
16
|
+
<div class="badge <%= status_badge(process.status) %>">
|
17
|
+
<%= process.status %>
|
18
|
+
</div>
|
19
|
+
</td>
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
<td>
|
22
|
+
<%== partial 'consumers/assignments_badges', locals: { process: process } %>
|
23
|
+
</td>
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
<td>
|
26
|
+
<%== relative_time process.started_at %>
|
27
|
+
</td>
|
29
28
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
29
|
+
<td>
|
30
|
+
<span class="badge badge-primary">
|
31
|
+
<%= format_memory process.memory_usage %>
|
32
|
+
</span>
|
33
|
+
</td>
|
35
34
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
35
|
+
<td>
|
36
|
+
<span class="badge badge-primary">
|
37
|
+
<%= process.utilization.round(1) %>%
|
38
|
+
</span>
|
39
|
+
<span class="badge badge-primary">
|
40
|
+
<%= process.workers %> /
|
41
|
+
<%= process.busy %>
|
42
|
+
</span>
|
43
|
+
</td>
|
45
44
|
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
<td>
|
46
|
+
<%= process.lag_hybrid %>
|
47
|
+
</td>
|
49
48
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
49
|
+
<td class="commands-inline-3">
|
50
|
+
<%
|
51
|
+
trace_path = consumers_path('commanding', process.id, 'trace')
|
52
|
+
disabled_class = process.status != 'stopped' ? '' : 'btn-disabled'
|
53
|
+
%>
|
54
|
+
<form action="<%= trace_path %>" method="post" class="inline" title="Trace">
|
55
|
+
<%== csrf_tag(trace_path) %>
|
57
56
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
57
|
+
<button type="submit" class="btn btn-info btn-sm btn-lockable <%= disabled_class %>">
|
58
|
+
<%== icon(:gear) %>
|
59
|
+
</button>
|
60
|
+
</form>
|
62
61
|
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
<%
|
63
|
+
quiet_path = consumers_path('commanding', process.id, 'quiet')
|
64
|
+
disabled_class = process.status == 'running' ? '' : 'btn-disabled'
|
66
65
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
66
|
+
if process.execution_mode == 'standalone'
|
67
|
+
title = 'Quiet'
|
68
|
+
else
|
69
|
+
disabled_class = 'btn-disabled'
|
70
|
+
title = 'Supported only in standalone consumer processes'
|
71
|
+
end
|
72
|
+
%>
|
73
|
+
<form action="<%= quiet_path %>" method="post" class="inline" title="<%= title %>">
|
74
|
+
<%== csrf_tag(quiet_path) %>
|
75
|
+
<button type="submit" class="btn btn-warning btn-sm btn-lockable <%= disabled_class %>">
|
76
|
+
<%== icon(:pause) %>
|
77
|
+
</button>
|
78
|
+
</form>
|
80
79
|
|
81
|
-
|
82
|
-
|
83
|
-
|
80
|
+
<%
|
81
|
+
stop_path = consumers_path('commanding', process.id, 'stop')
|
82
|
+
disabled_class = process.status != 'stopping' && process.status != 'stopped' ? '' : 'btn-disabled'
|
84
83
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
<% else %>
|
101
|
-
<%==
|
102
|
-
partial(
|
103
|
-
'consumers/incompatible',
|
104
|
-
locals: { colspan: 7, process: process }
|
105
|
-
)
|
106
|
-
%>
|
107
|
-
<% end %>
|
84
|
+
if process.execution_mode == 'standalone'
|
85
|
+
title = 'Stop'
|
86
|
+
else
|
87
|
+
disabled_class = 'btn-disabled'
|
88
|
+
title = 'Supported only in standalone consumer processes'
|
89
|
+
end
|
90
|
+
%>
|
91
|
+
<form action="<%= stop_path %>" method="post" class="inline" title="<%= title %>">
|
92
|
+
<%== csrf_tag(stop_path) %>
|
93
|
+
<button type="submit" class="btn btn-error btn-sm btn-lockable <%= disabled_class %>">
|
94
|
+
<%== icon(:stop) %>
|
95
|
+
</button>
|
96
|
+
</form>
|
97
|
+
</td>
|
98
|
+
</tr>
|
@@ -1,51 +1,42 @@
|
|
1
1
|
<%# This code is part of Karafka Pro, a commercial component not licensed under LGPL. %>
|
2
2
|
<%# See LICENSE for details. %>
|
3
3
|
|
4
|
-
|
5
|
-
<
|
6
|
-
<
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
<
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
<
|
18
|
-
<code><%= job.consumer %></code>
|
4
|
+
<tr>
|
5
|
+
<td>
|
6
|
+
<a href="<%= consumer_path(job.process.id, 'subscriptions') %>">
|
7
|
+
<%== truncate(job.process.id, strategy: :middle) %>
|
8
|
+
</a>
|
9
|
+
</td>
|
10
|
+
<td>
|
11
|
+
<span class="badge badge-secondary" title="Consumer group: <%= job.consumer_group %>">
|
12
|
+
<%= job.topic %>:
|
13
|
+
<%= job.partition %>
|
14
|
+
</span>
|
15
|
+
</td>
|
16
|
+
<td>
|
17
|
+
<code><%= job.consumer %></code>
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
<% else %>
|
45
|
-
<%==
|
46
|
-
partial(
|
47
|
-
'consumers/incompatible',
|
48
|
-
locals: { colspan: 8, process: job.process }
|
49
|
-
)
|
50
|
-
%>
|
51
|
-
<% end %>
|
19
|
+
<% unless job.tags.empty? %>
|
20
|
+
<br/>
|
21
|
+
<%== tags(job.tags) %>
|
22
|
+
<% end %>
|
23
|
+
</td>
|
24
|
+
<td>
|
25
|
+
<code>#<%= job.type %></code>
|
26
|
+
</td>
|
27
|
+
<td>
|
28
|
+
<%= job.messages %>
|
29
|
+
</td>
|
30
|
+
<td>
|
31
|
+
<%== offset_with_label job.topic, job.partition, job.first_offset, explore: true %>
|
32
|
+
</td>
|
33
|
+
<td>
|
34
|
+
<%== offset_with_label job.topic, job.partition, job.last_offset, explore: true %>
|
35
|
+
</td>
|
36
|
+
<td>
|
37
|
+
<%== offset_with_label job.topic, job.partition, job.committed_offset %>
|
38
|
+
</td>
|
39
|
+
<td>
|
40
|
+
<%== relative_time job.updated_at %>
|
41
|
+
</td>
|
42
|
+
</tr>
|
@@ -29,14 +29,14 @@ module Karafka
|
|
29
29
|
|
30
30
|
raise ::Karafka::Web::Errors::Processing::IncompatibleSchemaError
|
31
31
|
# Older reports mean someone is in the middle of upgrade. Schema change related
|
32
|
-
# upgrades always should happen without a rolling-upgrade,
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
# In case user wants to do a rolling upgrade, the user docs state that this can happen
|
38
|
-
# and it is something user should be aware
|
32
|
+
# upgrades always should happen without a rolling-upgrade. For such, since we cannot
|
33
|
+
# reason about their statistics structure, we only track state, so we can provide
|
34
|
+
# basic upgrade reporting details in the status page. All other data is rejected and
|
35
|
+
# since in most cases this is intermediate due to rolling upgrades, this should not
|
36
|
+
# significantly impact the state tracking and processing.
|
39
37
|
when :older
|
38
|
+
@state_aggregator.add_state(message.payload, message.offset)
|
39
|
+
|
40
40
|
next
|
41
41
|
else
|
42
42
|
raise ::Karafka::Errors::UnsupportedCaseError
|
@@ -36,7 +36,7 @@ module Karafka
|
|
36
36
|
def add(report, offset)
|
37
37
|
super(report)
|
38
38
|
increment_total_counters(report)
|
39
|
-
|
39
|
+
add_state(report, offset)
|
40
40
|
# We always evict after counters updates because we want to use expired (stopped)
|
41
41
|
# data for counters as it was valid previously. This can happen only when web consumer
|
42
42
|
# had a lag and is catching up.
|
@@ -46,6 +46,19 @@ module Karafka
|
|
46
46
|
refresh_current_stats
|
47
47
|
end
|
48
48
|
|
49
|
+
# Registers or updates the given process state based on the report
|
50
|
+
#
|
51
|
+
# @param report [Hash]
|
52
|
+
# @param offset [Integer]
|
53
|
+
def add_state(report, offset)
|
54
|
+
process_id = report[:process][:id]
|
55
|
+
|
56
|
+
state[:processes][process_id] = {
|
57
|
+
dispatched_at: report[:dispatched_at],
|
58
|
+
offset: offset
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
49
62
|
# @return [Array<Hash, Float>] aggregated current stats value and time from which this
|
50
63
|
# aggregation comes from
|
51
64
|
#
|
@@ -84,19 +97,6 @@ module Karafka
|
|
84
97
|
end
|
85
98
|
end
|
86
99
|
|
87
|
-
# Registers or updates the given process state based on the report
|
88
|
-
#
|
89
|
-
# @param report [Hash]
|
90
|
-
# @param offset [Integer]
|
91
|
-
def update_process_state(report, offset)
|
92
|
-
process_id = report[:process][:id]
|
93
|
-
|
94
|
-
state[:processes][process_id] = {
|
95
|
-
dispatched_at: report[:dispatched_at],
|
96
|
-
offset: offset
|
97
|
-
}
|
98
|
-
end
|
99
|
-
|
100
100
|
# Evicts expired processes from the current state
|
101
101
|
# We consider processes dead if they do not report often enough
|
102
102
|
# @note We do not evict based on states (stopped), because we want to report the
|
data/lib/karafka/web/ui/base.rb
CHANGED
@@ -94,8 +94,7 @@ module Karafka
|
|
94
94
|
::Rdkafka::RdkafkaError,
|
95
95
|
Errors::Ui::NotFoundError,
|
96
96
|
Errors::Ui::ProOnlyError,
|
97
|
-
Errors::Ui::ForbiddenError
|
98
|
-
Errors::Ui::IncompatibleSchemaError
|
97
|
+
Errors::Ui::ForbiddenError
|
99
98
|
] do |e|
|
100
99
|
@error = true
|
101
100
|
|
@@ -106,9 +105,6 @@ module Karafka
|
|
106
105
|
when Errors::Ui::ForbiddenError
|
107
106
|
response.status = 403
|
108
107
|
view 'shared/exceptions/not_allowed'
|
109
|
-
when Errors::Ui::IncompatibleSchemaError
|
110
|
-
response.status = 422
|
111
|
-
view 'shared/exceptions/incompatible_schema'
|
112
108
|
else
|
113
109
|
response.status = 404
|
114
110
|
view 'shared/exceptions/not_found'
|
@@ -12,6 +12,8 @@ module Karafka
|
|
12
12
|
# @param process_id [String] id of the process we are looking for
|
13
13
|
# @return [Process] selected process or error raised
|
14
14
|
# @raise [::Karafka::Web::Errors::Ui::NotFoundError] raised if process not found
|
15
|
+
# @note Keep in mind, that this search is looking only within processes with a
|
16
|
+
# compatible schema, as it uses `#active` under the hood.
|
15
17
|
def find(state, process_id)
|
16
18
|
found_process = Processes.active(state).find { |process| process.id == process_id }
|
17
19
|
found_process || raise(::Karafka::Web::Errors::Ui::NotFoundError, process_id)
|
@@ -86,7 +88,7 @@ module Karafka
|
|
86
88
|
# instance. Any incompatibility will cause reporting of incompatible. That's for the
|
87
89
|
# sake of simplicity as the long term goal for user is anyhow to align those.
|
88
90
|
def schema_compatible?
|
89
|
-
schema_version == ::Karafka::Web::Tracking::Consumers::Sampler::SCHEMA_VERSION
|
91
|
+
self[:schema_version] == ::Karafka::Web::Tracking::Consumers::Sampler::SCHEMA_VERSION
|
90
92
|
end
|
91
93
|
end
|
92
94
|
end
|
@@ -11,22 +11,30 @@ module Karafka
|
|
11
11
|
class << self
|
12
12
|
include ::Karafka::Core::Helpers::Time
|
13
13
|
|
14
|
-
# Returns
|
15
|
-
#
|
16
|
-
# while we've already had it.
|
17
|
-
#
|
14
|
+
# Returns processes that are running or recently shutdown. It may also return processes
|
15
|
+
# with incompatible schema.
|
18
16
|
# @param state [State] current system state from which we can get processes metadata
|
19
17
|
# @return [Array<Process>]
|
20
|
-
def
|
18
|
+
def all(state)
|
21
19
|
messages = fetch_reports(state)
|
22
20
|
messages = squash_processes_data(messages)
|
23
21
|
processes = messages.map(&:payload)
|
24
22
|
evict_expired_processes(processes)
|
25
23
|
processes = sort_processes(processes)
|
26
|
-
|
27
24
|
processes.map { |process_hash| Process.new(process_hash) }
|
28
25
|
end
|
29
26
|
|
27
|
+
# Returns the active processes in an array and alongside of that the current state of
|
28
|
+
# the system. We use those together in the UI and it would be expensive to pick it up
|
29
|
+
# while we've already had it. Active means it is running (or recently shutdown) and
|
30
|
+
# it has current schema. Basically any process about which we can reason
|
31
|
+
#
|
32
|
+
# @param state [State] current system state from which we can get processes metadata
|
33
|
+
# @return [Array<Process>]
|
34
|
+
def active(state)
|
35
|
+
all(state).delete_if { |process| !process.schema_compatible? }
|
36
|
+
end
|
37
|
+
|
30
38
|
private
|
31
39
|
|
32
40
|
# Fetches the relevant processes reports from the reports topic
|
@@ -79,6 +87,19 @@ module Karafka
|
|
79
87
|
end
|
80
88
|
end
|
81
89
|
|
90
|
+
# Removes processes that have schema different than the one supported by the Web UI
|
91
|
+
# We support incompatible schema processes reporting in the status page so users know
|
92
|
+
# what and how to update. For other processes we do not display them or their data
|
93
|
+
# as it would be too complex to support
|
94
|
+
#
|
95
|
+
# @param processes [Array<Hash>]
|
96
|
+
# @return [Array<Hash>] only data about processes running current schema
|
97
|
+
def evict_incompatible_processes(processes)
|
98
|
+
processes.delete_if do |details|
|
99
|
+
details[:schema_version] != Tracking::Consumers::Sampler::SCHEMA_VERSION
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
82
103
|
# Ensures that we always return processes sorted by their id
|
83
104
|
# @param processes [Array<Hash>]
|
84
105
|
# @return [Array<Hash>] sorted processes data
|
@@ -183,7 +183,7 @@ module Karafka
|
|
183
183
|
# @return [Status::Step] could we read and operate on the current processes data (if any)
|
184
184
|
def consumers_reports
|
185
185
|
if initial_consumers_metrics.success?
|
186
|
-
@processes ||= Models::Processes.
|
186
|
+
@processes ||= Models::Processes.all(@current_state)
|
187
187
|
status = :success
|
188
188
|
else
|
189
189
|
status = :halted
|
@@ -1,45 +1,36 @@
|
|
1
|
-
|
2
|
-
<
|
3
|
-
<
|
4
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
</p>
|
1
|
+
<tr class="status-row-<%= process.status %>">
|
2
|
+
<td>
|
3
|
+
<p>
|
4
|
+
<a href="<%= consumer_path(process.id, 'subscriptions') %>">
|
5
|
+
<%== truncate(process.id, strategy: :middle) %>
|
6
|
+
</a>
|
7
|
+
</p>
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
<p class="mt-1">
|
10
|
+
<%== partial 'consumers/assignments_badges', locals: { process: process } %>
|
11
|
+
</p>
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
<p>
|
14
|
+
<%== tags(process.tags) %>
|
15
|
+
</p>
|
16
|
+
</td>
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
<td>
|
19
|
+
<%== relative_time process.started_at %>
|
20
|
+
</td>
|
22
21
|
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
<td>
|
23
|
+
<%== badge_primary_sm format_memory process.memory_usage %>
|
24
|
+
</td>
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
<td>
|
27
|
+
<span class="badge badge-primary">
|
28
|
+
<%= process.workers %> /
|
29
|
+
<%= process.busy %>
|
30
|
+
</span>
|
31
|
+
</td>
|
33
32
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
<% else %>
|
39
|
-
<%==
|
40
|
-
partial(
|
41
|
-
'consumers/incompatible',
|
42
|
-
locals: { colspan: 5, process: process }
|
43
|
-
)
|
44
|
-
%>
|
45
|
-
<% end %>
|
33
|
+
<td>
|
34
|
+
<%= process.lag_hybrid %>
|
35
|
+
</td>
|
36
|
+
</tr>
|
@@ -1,39 +1,30 @@
|
|
1
|
-
|
2
|
-
<
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
<
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
<
|
15
|
-
<code><%= job.consumer %></code>
|
1
|
+
<tr>
|
2
|
+
<td>
|
3
|
+
<a href="<%= consumer_path(job.process.id, 'subscriptions') %>">
|
4
|
+
<%== truncate(job.process.id, strategy: :middle) %>
|
5
|
+
</a>
|
6
|
+
</td>
|
7
|
+
<td>
|
8
|
+
<span class="badge badge-secondary" title="Consumer group: <%= job.consumer_group %>">
|
9
|
+
<%= job.topic %>:
|
10
|
+
<%= job.partition %>
|
11
|
+
</span>
|
12
|
+
</td>
|
13
|
+
<td>
|
14
|
+
<code><%= job.consumer %></code>
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
<% else %>
|
33
|
-
<%==
|
34
|
-
partial(
|
35
|
-
'consumers/incompatible',
|
36
|
-
locals: { colspan: 5, process: job.process }
|
37
|
-
)
|
38
|
-
%>
|
39
|
-
<% end %>
|
16
|
+
<% unless job.tags.empty? %>
|
17
|
+
<br/>
|
18
|
+
<%== tags(job.tags) %>
|
19
|
+
<% end %>
|
20
|
+
</td>
|
21
|
+
<td>
|
22
|
+
<code>#<%= job.type %></code>
|
23
|
+
</td>
|
24
|
+
<td>
|
25
|
+
<%== offset_with_label job.topic, job.partition, job.first_offset %>
|
26
|
+
</td>
|
27
|
+
<td>
|
28
|
+
<%== relative_time job.updated_at %>
|
29
|
+
</td>
|
30
|
+
</tr>
|
@@ -58,12 +58,6 @@
|
|
58
58
|
<td>.status-row-error</td>
|
59
59
|
<td>.status-row-error</td>
|
60
60
|
</tr>
|
61
|
-
|
62
|
-
<tr class="status-row-incompatible">
|
63
|
-
<td>.status-row-incompatible</td>
|
64
|
-
<td>.status-row-incompatible</td>
|
65
|
-
<td>.status-row-incompatible</td>
|
66
|
-
</tr>
|
67
61
|
</tbody>
|
68
62
|
</table>
|
69
63
|
</div>
|
data/lib/karafka/web/version.rb
CHANGED
data/package-lock.json
CHANGED
@@ -1034,9 +1034,9 @@
|
|
1034
1034
|
}
|
1035
1035
|
},
|
1036
1036
|
"node_modules/daisyui": {
|
1037
|
-
"version": "5.0.
|
1038
|
-
"resolved": "https://registry.npmjs.org/daisyui/-/daisyui-5.0.
|
1039
|
-
"integrity": "sha512-
|
1037
|
+
"version": "5.0.37",
|
1038
|
+
"resolved": "https://registry.npmjs.org/daisyui/-/daisyui-5.0.37.tgz",
|
1039
|
+
"integrity": "sha512-PLc+MhWAqTwolygEGPDi+ac+OsFqIt9nZylTIiyVlEx8loYL7Pt7hNWb8cp5pQQ9dhjYnda1ERiuM6OsJmvPGw==",
|
1040
1040
|
"dev": true,
|
1041
1041
|
"license": "MIT",
|
1042
1042
|
"funding": {
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: karafka-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.0.
|
4
|
+
version: 0.11.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maciej Mensfeld
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain:
|
11
10
|
- |
|
@@ -35,7 +34,7 @@ cert_chain:
|
|
35
34
|
i9zWxov0mr44TWegTVeypcWGd/0nxu1+QHVNHJrpqlPBRvwQsUm7fwmRInGpcaB8
|
36
35
|
ap8wNYvryYzrzvzUxIVFBVM5PacgkFqRmolCa8I7tdKQN+R1
|
37
36
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
37
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
39
38
|
dependencies:
|
40
39
|
- !ruby/object:Gem::Dependency
|
41
40
|
name: erubi
|
@@ -668,7 +667,6 @@ files:
|
|
668
667
|
- lib/karafka/web/ui/views/consumers/_assignments_badges.erb
|
669
668
|
- lib/karafka/web/ui/views/consumers/_breadcrumbs.erb
|
670
669
|
- lib/karafka/web/ui/views/consumers/_consumer.erb
|
671
|
-
- lib/karafka/web/ui/views/consumers/_incompatible.erb
|
672
670
|
- lib/karafka/web/ui/views/consumers/_no_consumers.erb
|
673
671
|
- lib/karafka/web/ui/views/consumers/_summary.erb
|
674
672
|
- lib/karafka/web/ui/views/consumers/_tabs.erb
|
@@ -726,7 +724,6 @@ files:
|
|
726
724
|
- lib/karafka/web/ui/views/shared/alerts/_warning.erb
|
727
725
|
- lib/karafka/web/ui/views/shared/charts/_bar.erb
|
728
726
|
- lib/karafka/web/ui/views/shared/charts/_line.erb
|
729
|
-
- lib/karafka/web/ui/views/shared/exceptions/incompatible_schema.erb
|
730
727
|
- lib/karafka/web/ui/views/shared/exceptions/not_allowed.erb
|
731
728
|
- lib/karafka/web/ui/views/shared/exceptions/not_found.erb
|
732
729
|
- lib/karafka/web/ui/views/shared/exceptions/pro_only.erb
|
@@ -849,7 +846,6 @@ metadata:
|
|
849
846
|
source_code_uri: https://github.com/karafka/karafka-web
|
850
847
|
documentation_uri: https://karafka.io/docs
|
851
848
|
rubygems_mfa_required: 'true'
|
852
|
-
post_install_message:
|
853
849
|
rdoc_options: []
|
854
850
|
require_paths:
|
855
851
|
- lib
|
@@ -860,12 +856,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
860
856
|
version: 3.1.0
|
861
857
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
862
858
|
requirements:
|
863
|
-
- - "
|
859
|
+
- - ">="
|
864
860
|
- !ruby/object:Gem::Version
|
865
|
-
version:
|
861
|
+
version: '0'
|
866
862
|
requirements: []
|
867
|
-
rubygems_version: 3.
|
868
|
-
signing_key:
|
863
|
+
rubygems_version: 3.6.9
|
869
864
|
specification_version: 4
|
870
865
|
summary: Karafka ecosystem Web UI interface
|
871
866
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<tr class="status-row-incompatible">
|
2
|
-
<td>
|
3
|
-
<p class="text-muted">
|
4
|
-
<%== truncate(process.id, strategy: :middle) %>
|
5
|
-
</p>
|
6
|
-
</td>
|
7
|
-
|
8
|
-
<td colspan="<%= colspan %>" class="text-muted">
|
9
|
-
This process uses schema <%= process.schema_version %>
|
10
|
-
while Web UI runs on <%= ::Karafka::Web::Tracking::Consumers::Sampler::SCHEMA_VERSION %>.
|
11
|
-
Limited functionality until all components are updated to the same version.
|
12
|
-
</td>
|
13
|
-
</tr>
|
@@ -1,34 +0,0 @@
|
|
1
|
-
<div class="hidden">
|
2
|
-
<%== partial 'shared/controls' %>
|
3
|
-
</div>
|
4
|
-
|
5
|
-
<main class="flex items-center justify-center min-h-screen">
|
6
|
-
<div id="content" class="max-w-2xl w-full mx-auto">
|
7
|
-
<div class="flex items-center justify-center vh-100">
|
8
|
-
<div class="text-center">
|
9
|
-
<h1 class="text-8xl font-bold">422</h1>
|
10
|
-
<p class="text-3xl mt-5">
|
11
|
-
<span class="text-orange-500">Schema Mismatch</span>
|
12
|
-
</p>
|
13
|
-
<div class="mt-5">
|
14
|
-
<p class="mb-10 text-lg font-light">
|
15
|
-
Requested consumer process is using an incompatible schema version and cannot be fully displayed.
|
16
|
-
</p>
|
17
|
-
<p class="text-lg font-light mb-5">This typically happens when:</p>
|
18
|
-
<ul class="list-disc text-left text-lg mb-10 pl-5 font-light">
|
19
|
-
<li>You are performing a gradual deployment of Karafka components</li>
|
20
|
-
<li>Some components are running on different versions</li>
|
21
|
-
<li>The process schema in the consumer process doesn't match Web UI schema</li>
|
22
|
-
</ul>
|
23
|
-
<p class="text-lg font-light mb-10">
|
24
|
-
To resolve this, please ensure all Karafka components are updated to use the same version.
|
25
|
-
</p>
|
26
|
-
<p>
|
27
|
-
<a href="<%= root_path %>" class="btn btn-primary mr-2 rounded-md py-1">Go Home</a>
|
28
|
-
<a href="<%= root_path('status') %>" class="btn btn-success text-white rounded-md">Check Status</a>
|
29
|
-
</p>
|
30
|
-
</div>
|
31
|
-
</div>
|
32
|
-
</div>
|
33
|
-
</div>
|
34
|
-
</main>
|