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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70c1492ea1073bf499055b4a6db1090e8fede2fd6a89d0fca7c5085669170863
4
- data.tar.gz: 52cffaec446f588e4c3508e9b4085f7e911b68961cd2430406bd7c5b49a99f74
3
+ metadata.gz: 9602c38ed3a77f91e9df0a84639567c4e36742a779cf71ae9b122d8c03be57d8
4
+ data.tar.gz: 983b13133ce81341541b39cf1ec2643de93031341cbb27277acac85d1ffbef9e
5
5
  SHA512:
6
- metadata.gz: 9a766d94df43a6f8bf61c2331d48ef21bd1e26860123268441838ce75cc298d0f957d459ff2d6c180acca01b90bb3bf6199554b5abbb74d6255f2d57aac95948
7
- data.tar.gz: 0b8fbeef52a71372088d8d2d24420e5336028ab9a443c5b537ebb55d1faf61a2cb4f69f855c91421175c277a0a2e5192aac39586673493a3a14eabf15cc6fa5d
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka-web (0.11.0)
4
+ karafka-web (0.11.0.beta2)
5
5
  erubi (~> 1.4)
6
6
  karafka (>= 2.5.0.beta1, < 2.6.0)
7
7
  karafka-core (>= 2.5.0, < 2.6.0)
@@ -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
- return render if @process.schema_compatible?
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
- <% if process.schema_compatible? %>
5
- <tr class="status-row-<%= process.status %>">
6
- <td>
7
- <p>
8
- <a href="<%= consumer_path(process.id, 'subscriptions') %>">
9
- <%== truncate(process.id, strategy: :middle) %>
10
- </a>
11
- </p>
12
-
13
- <p class="mt-1">
14
- <%== partial 'consumers/assignments_badges', locals: { process: process } %>
15
- </p>
16
-
17
- <p>
18
- <%== tags(process.tags) %>
19
- </p>
20
- </td>
21
-
22
- <td>
23
- <%== relative_time process.started_at %>
24
- </td>
25
-
26
- <td>
27
- <%== badge_primary_sm format_memory process.memory_usage %>
28
- <%== badge_primary_sm format_memory process.memory_total_usage %>
29
- <%== badge_primary_sm format_memory process.memory_size %>
30
- </td>
31
-
32
- <td>
33
- <span class="badge badge-primary">
34
- <%= process.utilization.round(1) %>%
35
- </span>
36
- <span class="badge badge-primary">
37
- <%= process.workers %> /
38
- <%= process.busy %>
39
- </span>
40
- </td>
41
-
42
- <td>
43
- <% process.cpu_usage.each do |metric| %>
44
- <%== badge_primary_sm metric %>
45
- <% end %>
46
- </td>
47
-
48
- <td>
49
- <%= process.lag_hybrid %>
50
- </td>
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
- <% if process.schema_compatible? %>
5
- <tr class="status-row-<%= process.status %>">
6
- <td>
7
- <a href="<%= consumer_path(process.id, 'subscriptions') %>">
8
- <%== truncate(process.id, strategy: :middle) %>
9
- </a>
10
-
11
- <p class="mt-1">
12
- <%== tags(process.tags) %>
13
- </p>
14
- </td>
15
-
16
- <td>
17
- <%= format_memory process.memory_usage %>
18
- </td>
19
-
20
- <td>
21
- <%= process.utilization.round(1) %>%
22
- </td>
23
-
24
- <td>
25
- <%= process.threads %>
26
- </td>
27
-
28
- <td>
29
- <%= process.cpu_usage[0].to_f %>
30
- </td>
31
-
32
- <td>
33
- <%= process.cpu_usage[1].to_f %>
34
- </td>
35
-
36
- <td>
37
- <%= process.cpu_usage[2].to_f %>
38
- </td>
39
-
40
- <td>
41
- <%= process.workers %>
42
- </td>
43
-
44
- <td>
45
- <%= process.busy %>
46
- </td>
47
-
48
- <td>
49
- <%= process.listeners.fetch(:active) %>
50
- </td>
51
-
52
- <td>
53
- <%= process.listeners.fetch(:standby) %>
54
- </td>
55
-
56
- <td>
57
- <%= process.jobs.running.count %>
58
- </td>
59
-
60
- <td>
61
- <%= process.jobs.pending.count %>
62
- </td>
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
- <% if process.schema_compatible? %>
5
- <tr class="status-row-<%= process.status %>">
6
- <td>
7
- <a href="<%= consumer_path(process.id, 'subscriptions') %>">
8
- <%== truncate(process.id, strategy: :middle) %>
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
- <p class="mt-1">
12
- <%== tags(process.tags) %>
13
- </p>
14
- </td>
10
+ <p class="mt-1">
11
+ <%== tags(process.tags) %>
12
+ </p>
13
+ </td>
15
14
 
16
- <td>
17
- <div class="badge <%= status_badge(process.status) %>">
18
- <%= process.status %>
19
- </div>
20
- </td>
15
+ <td>
16
+ <div class="badge <%= status_badge(process.status) %>">
17
+ <%= process.status %>
18
+ </div>
19
+ </td>
21
20
 
22
- <td>
23
- <%== partial 'consumers/assignments_badges', locals: { process: process } %>
24
- </td>
21
+ <td>
22
+ <%== partial 'consumers/assignments_badges', locals: { process: process } %>
23
+ </td>
25
24
 
26
- <td>
27
- <%== relative_time process.started_at %>
28
- </td>
25
+ <td>
26
+ <%== relative_time process.started_at %>
27
+ </td>
29
28
 
30
- <td>
31
- <span class="badge badge-primary">
32
- <%= format_memory process.memory_usage %>
33
- </span>
34
- </td>
29
+ <td>
30
+ <span class="badge badge-primary">
31
+ <%= format_memory process.memory_usage %>
32
+ </span>
33
+ </td>
35
34
 
36
- <td>
37
- <span class="badge badge-primary">
38
- <%= process.utilization.round(1) %>%
39
- </span>
40
- <span class="badge badge-primary">
41
- <%= process.workers %> /
42
- <%= process.busy %>
43
- </span>
44
- </td>
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
- <td>
47
- <%= process.lag_hybrid %>
48
- </td>
45
+ <td>
46
+ <%= process.lag_hybrid %>
47
+ </td>
49
48
 
50
- <td class="commands-inline-3">
51
- <%
52
- trace_path = consumers_path('commanding', process.id, 'trace')
53
- disabled_class = process.status != 'stopped' ? '' : 'btn-disabled'
54
- %>
55
- <form action="<%= trace_path %>" method="post" class="inline" title="Trace">
56
- <%== csrf_tag(trace_path) %>
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
- <button type="submit" class="btn btn-info btn-sm btn-lockable <%= disabled_class %>">
59
- <%== icon(:gear) %>
60
- </button>
61
- </form>
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
- quiet_path = consumers_path('commanding', process.id, 'quiet')
65
- disabled_class = process.status == 'running' ? '' : 'btn-disabled'
62
+ <%
63
+ quiet_path = consumers_path('commanding', process.id, 'quiet')
64
+ disabled_class = process.status == 'running' ? '' : 'btn-disabled'
66
65
 
67
- if process.execution_mode == 'standalone'
68
- title = 'Quiet'
69
- else
70
- disabled_class = 'btn-disabled'
71
- title = 'Supported only in standalone consumer processes'
72
- end
73
- %>
74
- <form action="<%= quiet_path %>" method="post" class="inline" title="<%= title %>">
75
- <%== csrf_tag(quiet_path) %>
76
- <button type="submit" class="btn btn-warning btn-sm btn-lockable <%= disabled_class %>">
77
- <%== icon(:pause) %>
78
- </button>
79
- </form>
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
- stop_path = consumers_path('commanding', process.id, 'stop')
83
- disabled_class = process.status != 'stopping' && process.status != 'stopped' ? '' : 'btn-disabled'
80
+ <%
81
+ stop_path = consumers_path('commanding', process.id, 'stop')
82
+ disabled_class = process.status != 'stopping' && process.status != 'stopped' ? '' : 'btn-disabled'
84
83
 
85
- if process.execution_mode == 'standalone'
86
- title = 'Stop'
87
- else
88
- disabled_class = 'btn-disabled'
89
- title = 'Supported only in standalone consumer processes'
90
- end
91
- %>
92
- <form action="<%= stop_path %>" method="post" class="inline" title="<%= title %>">
93
- <%== csrf_tag(stop_path) %>
94
- <button type="submit" class="btn btn-error btn-sm btn-lockable <%= disabled_class %>">
95
- <%== icon(:stop) %>
96
- </button>
97
- </form>
98
- </td>
99
- </tr>
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
- <% if job.process.schema_compatible? %>
5
- <tr>
6
- <td>
7
- <a href="<%= consumer_path(job.process.id, 'subscriptions') %>">
8
- <%== truncate(job.process.id, strategy: :middle) %>
9
- </a>
10
- </td>
11
- <td>
12
- <span class="badge badge-secondary" title="Consumer group: <%= job.consumer_group %>">
13
- <%= job.topic %>:
14
- <%= job.partition %>
15
- </span>
16
- </td>
17
- <td>
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
- <% unless job.tags.empty? %>
21
- <br/>
22
- <%== tags(job.tags) %>
23
- <% end %>
24
- </td>
25
- <td>
26
- <code>#<%= job.type %></code>
27
- </td>
28
- <td>
29
- <%= job.messages %>
30
- </td>
31
- <td>
32
- <%== offset_with_label job.topic, job.partition, job.first_offset, explore: true %>
33
- </td>
34
- <td>
35
- <%== offset_with_label job.topic, job.partition, job.last_offset, explore: true %>
36
- </td>
37
- <td>
38
- <%== offset_with_label job.topic, job.partition, job.committed_offset %>
39
- </td>
40
- <td>
41
- <%== relative_time job.updated_at %>
42
- </td>
43
- </tr>
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, hence we can reject those
33
- # requests without significant or any impact on data quality but without having to
34
- # worry about backwards compatibility. Errors are tracked independently, so it should
35
- # not be a problem.
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
- update_process_state(report, offset)
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
@@ -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 the active processes in an array and alongside of that the current state of
15
- # the system. We use those together in the UI and it would be expensive to pick it up
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 active(state)
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.active(@current_state)
186
+ @processes ||= Models::Processes.all(@current_state)
187
187
  status = :success
188
188
  else
189
189
  status = :halted
@@ -507,12 +507,6 @@
507
507
  }
508
508
  }
509
509
 
510
- @utility status-row-incompatible {
511
- table & td:first-child {
512
- @apply border-l border-l-secondary;
513
- }
514
- }
515
-
516
510
  @utility code {
517
511
  @apply text-sm border border-gray-300;
518
512
  }
@@ -1,45 +1,36 @@
1
- <% if process.schema_compatible? %>
2
- <tr class="status-row-<%= process.status %>">
3
- <td>
4
- <p>
5
- <a href="<%= consumer_path(process.id, 'subscriptions') %>">
6
- <%== truncate(process.id, strategy: :middle) %>
7
- </a>
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
- <p class="mt-1">
11
- <%== partial 'consumers/assignments_badges', locals: { process: process } %>
12
- </p>
9
+ <p class="mt-1">
10
+ <%== partial 'consumers/assignments_badges', locals: { process: process } %>
11
+ </p>
13
12
 
14
- <p>
15
- <%== tags(process.tags) %>
16
- </p>
17
- </td>
13
+ <p>
14
+ <%== tags(process.tags) %>
15
+ </p>
16
+ </td>
18
17
 
19
- <td>
20
- <%== relative_time process.started_at %>
21
- </td>
18
+ <td>
19
+ <%== relative_time process.started_at %>
20
+ </td>
22
21
 
23
- <td>
24
- <%== badge_primary_sm format_memory process.memory_usage %>
25
- </td>
22
+ <td>
23
+ <%== badge_primary_sm format_memory process.memory_usage %>
24
+ </td>
26
25
 
27
- <td>
28
- <span class="badge badge-primary">
29
- <%= process.workers %> /
30
- <%= process.busy %>
31
- </span>
32
- </td>
26
+ <td>
27
+ <span class="badge badge-primary">
28
+ <%= process.workers %> /
29
+ <%= process.busy %>
30
+ </span>
31
+ </td>
33
32
 
34
- <td>
35
- <%= process.lag_hybrid %>
36
- </td>
37
- </tr>
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
- <% if job.process.schema_compatible? %>
2
- <tr>
3
- <td>
4
- <a href="<%= consumer_path(job.process.id, 'subscriptions') %>">
5
- <%== truncate(job.process.id, strategy: :middle) %>
6
- </a>
7
- </td>
8
- <td>
9
- <span class="badge badge-secondary" title="Consumer group: <%= job.consumer_group %>">
10
- <%= job.topic %>:
11
- <%= job.partition %>
12
- </span>
13
- </td>
14
- <td>
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
- <% unless job.tags.empty? %>
18
- <br/>
19
- <%== tags(job.tags) %>
20
- <% end %>
21
- </td>
22
- <td>
23
- <code>#<%= job.type %></code>
24
- </td>
25
- <td>
26
- <%== offset_with_label job.topic, job.partition, job.first_offset %>
27
- </td>
28
- <td>
29
- <%== relative_time job.updated_at %>
30
- </td>
31
- </tr>
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>
@@ -3,6 +3,6 @@
3
3
  module Karafka
4
4
  module Web
5
5
  # Current gem version
6
- VERSION = '0.11.0.beta1'
6
+ VERSION = '0.11.0.beta2'
7
7
  end
8
8
  end
data/package-lock.json CHANGED
@@ -1034,9 +1034,9 @@
1034
1034
  }
1035
1035
  },
1036
1036
  "node_modules/daisyui": {
1037
- "version": "5.0.35",
1038
- "resolved": "https://registry.npmjs.org/daisyui/-/daisyui-5.0.35.tgz",
1039
- "integrity": "sha512-AWi11n/x5++mps55jcwrBf0Lmip1euWY0FYcH/05SFGmoqrU7S7/aIUWaiaeqlJ5EcmEZ/7zEY73aOxMv6hcIg==",
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.beta1
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: 2025-05-21 00:00:00.000000000 Z
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: 1.3.1
861
+ version: '0'
866
862
  requirements: []
867
- rubygems_version: 3.3.26
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>