karafka-web 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 130c84348624e2b4a25faebece676cf3a4ee23a41cbe8527a97020ede7f95701
4
- data.tar.gz: 627002c97f8c0c3c684371cf4c4a83fb24a9cf1de9d481358c4d3b9bf3b59675
3
+ metadata.gz: 9edb576f473624295de9b0f1d62cbed131c9be1b480958a63c33f891fbf7cb19
4
+ data.tar.gz: 4f71e3a6ce1ca6eb423550824c5381e3b2b237c1b2af88c9108359bd225a7444
5
5
  SHA512:
6
- metadata.gz: 4e9195f492ce88ad8e4f03394a80851d61cc23512cbc3fe8ded3af5b5245ef4cb52bb536954be5587011027735c13e5906e7c1f8b8fd1d9ce0d4d687d6712311
7
- data.tar.gz: f8354d6bc12b847cfb6b1a633e164ee6cd80b3dc9f9a91103f18b007be0a569a22417d2236b5dafca4938c81d8e65eeafcb7a55a48553c2dacd9df9c7e6ae21f
6
+ metadata.gz: 7e0f77ed2a8e6c902596d2fad16938c3117a49c3faa7d9c60e8018c24135b9c3f38e45ffe5a0aa6fffdbf6f514956d4122afbb90a021f0c6f6274e0cb5212e75
7
+ data.tar.gz: 6fc0272d850dcdd99c277dabb38c5a0761646709f679b794f5c4b8161eb9217439f087b7d3eba3763bec60902874413506c6492dbb9ee63a992a0b6674124689
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Karafka Web changelog
2
2
 
3
+ ## 0.5.0 (2022-04-13)
4
+ - [Improvement] Report job `-1001` offsets as `N/A` as in all the other places.
5
+ - [Fix] Fix misspelling of word `committed`.
6
+ - [Fix] Shutdown and revocation jobs statistics extraction crashes when idle initialized without messages (#53)
7
+
8
+ ### Upgrade notes
9
+
10
+ Because of the reporting schema change, it is recommended to:
11
+
12
+ - First, deploy **all** the Karafka consumer processes (`karafka server`)
13
+ - Deploy the Web update to your web server.
14
+
15
+ Please note that if you decide to use the updated Web UI with not updated consumers, you may hit a 500 error or offset related data may not be displayed correctly.
16
+
3
17
  ## 0.4.1 (2023-04-12)
4
18
  - [Improvement] Replace the "x time ago" in the code explorer with an exact date (`2023-04-12 10:16:48.596 +0200 `).
5
19
  - [Improvement] When hovering over a message timestamp, a label with raw numeric timestamp will be presented.
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka-web (0.4.1)
4
+ karafka-web (0.5.0)
5
5
  erubi (~> 1.4)
6
- karafka (>= 2.0.38, < 3.0.0)
6
+ karafka (>= 2.0.40, < 3.0.0)
7
7
  karafka-core (>= 2.0.12, < 3.0.0)
8
8
  roda (~> 3.63)
9
9
  tilt (~> 2.0)
@@ -26,7 +26,7 @@ GEM
26
26
  ffi (1.15.5)
27
27
  i18n (1.12.0)
28
28
  concurrent-ruby (~> 1.0)
29
- karafka (2.0.38)
29
+ karafka (2.0.40)
30
30
  karafka-core (>= 2.0.12, < 3.0.0)
31
31
  thor (>= 0.20)
32
32
  waterdrop (>= 2.4.10, < 3.0.0)
data/karafka-web.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.licenses = %w[LGPL-3.0 Commercial]
18
18
 
19
19
  spec.add_dependency 'erubi', '~> 1.4'
20
- spec.add_dependency 'karafka', '>= 2.0.38', '< 3.0.0'
20
+ spec.add_dependency 'karafka', '>= 2.0.40', '< 3.0.0'
21
21
  spec.add_dependency 'karafka-core', '>= 2.0.12', '< 3.0.0'
22
22
  spec.add_dependency 'roda', '~> 3.63'
23
23
  spec.add_dependency 'tilt', '~> 2.0'
@@ -14,9 +14,9 @@ module Karafka
14
14
  required(:started_at) { |val| val.is_a?(Float) && val >= 0 }
15
15
  required(:topic) { |val| val.is_a?(String) }
16
16
  required(:partition) { |val| val.is_a?(Integer) && val >= 0 }
17
- required(:first_offset) { |val| val.is_a?(Integer) && val >= 0 }
18
- required(:last_offset) { |val| val.is_a?(Integer) && val >= 0 }
19
- required(:comitted_offset) { |val| val.is_a?(Integer) }
17
+ required(:first_offset) { |val| val.is_a?(Integer) && (val >= 0 || val == -1001) }
18
+ required(:last_offset) { |val| val.is_a?(Integer) && (val >= 0 || val == -1001) }
19
+ required(:committed_offset) { |val| val.is_a?(Integer) }
20
20
  required(:type) { |val| %w[consume revoked shutdown].include?(val) }
21
21
  required(:tags) { |val| val.is_a?(Karafka::Core::Taggable::Tags) }
22
22
  end
@@ -69,10 +69,10 @@ module Karafka
69
69
  {
70
70
  topic: consumer.topic.name,
71
71
  consumer_group: consumer.topic.consumer_group.id,
72
- partition: consumer.messages.metadata.partition,
73
- first_offset: consumer.messages.first.offset,
74
- last_offset: consumer.messages.last.offset,
75
- comitted_offset: consumer.coordinator.seek_offset - 1,
72
+ partition: consumer.partition,
73
+ first_offset: consumer.messages.metadata.first_offset,
74
+ last_offset: consumer.messages.metadata.last_offset,
75
+ committed_offset: consumer.coordinator.seek_offset - 1,
76
76
  consumer: consumer.class.to_s,
77
77
  tags: consumer.tags
78
78
  }
@@ -46,10 +46,17 @@ module Karafka
46
46
  'revoked'
47
47
  when 'consumer.shutdown.error'
48
48
  'shutdown'
49
+ # This is not a user facing execution flow, but internal system one
50
+ # that is why it will not be reported as a separate job for the UI
51
+ when 'consumer.idle.error'
52
+ false
53
+ else
54
+ false
49
55
  end
50
56
 
51
57
  # job reference only exists for consumer work related operations.
52
58
  # Only for them we need to deregister the job reference.
59
+ # This also refers only to consumer work that runs user operations.
53
60
  return unless type
54
61
 
55
62
  sampler.jobs.delete(
@@ -144,10 +151,10 @@ module Karafka
144
151
  {
145
152
  started_at: float_now,
146
153
  topic: consumer.topic.name,
147
- partition: consumer.messages.metadata.partition,
148
- first_offset: consumer.messages.first.offset,
149
- last_offset: consumer.messages.last.offset,
150
- comitted_offset: consumer.coordinator.seek_offset - 1,
154
+ partition: consumer.partition,
155
+ first_offset: consumer.messages.metadata.first_offset,
156
+ last_offset: consumer.messages.metadata.last_offset,
157
+ committed_offset: consumer.coordinator.seek_offset - 1,
151
158
  consumer: consumer.class.to_s,
152
159
  consumer_group: consumer.topic.consumer_group.id,
153
160
  type: type,
@@ -14,7 +14,7 @@ module Karafka
14
14
  # Current schema version
15
15
  # This can be used in the future for detecting incompatible changes and writing
16
16
  # migrations
17
- SCHEMA_VERSION = '1.1.0'
17
+ SCHEMA_VERSION = '1.2.0'
18
18
 
19
19
  # 60 seconds window for time tracked window-based metrics
20
20
  TIMES_TTL = 60
@@ -131,12 +131,25 @@ module Karafka
131
131
 
132
132
  # @param time [Time] time object we want to present with detailed ms label
133
133
  # @return [String] span tag with raw timestamp as a title and time as a value
134
- def labeled_time(time)
134
+ def time_with_label(time)
135
135
  stamp = (time.to_f * 1000).to_i
136
136
 
137
137
  %(<span title="#{stamp}">#{time}</span>)
138
138
  end
139
139
 
140
+ # @param offset [Integer] offset
141
+ # @return [String] offset if correct or `N/A` with labeled explanation for offsets
142
+ # that are less than 0. Offset with less than 0 indicates, that the offset was not
143
+ # yet committed and there is no value we know of
144
+ def offset_with_label(offset)
145
+ if offset.negative?
146
+ title = 'Not available until first offset commit'
147
+ %(<span class="badge bg-secondary" title="#{title}">N/A</span>)
148
+ else
149
+ offset.to_s
150
+ end
151
+ end
152
+
140
153
  # Returns the view title html code
141
154
  #
142
155
  # @param title [String] page title
@@ -16,13 +16,13 @@
16
16
  <code>#<%= job.type %></code>
17
17
  </td>
18
18
  <td>
19
- <%= job.first_offset %>
19
+ <%== offset_with_label job.first_offset %>
20
20
  </td>
21
21
  <td>
22
- <%= job.last_offset %>
22
+ <%== offset_with_label job.last_offset %>
23
23
  </td>
24
24
  <td>
25
- <%= job.comitted_offset %>
25
+ <%== offset_with_label job.committed_offset %>
26
26
  </td>
27
27
  <td>
28
28
  <%== relative_time job.started_at %>
@@ -6,13 +6,7 @@
6
6
  <%= partition.id %>
7
7
  </td>
8
8
  <td>
9
- <% if partition.lag_stored.to_i < 0 %>
10
- <span class="badge bg-secondary" title="Not available until first offset commit">
11
- N/A
12
- </span>
13
- <% else %>
14
- <%= partition.lag_stored %>
15
- <% end %>
9
+ <%== offset_with_label partition.lag_stored.to_i %>
16
10
  </td>
17
11
  <td>
18
12
  <span class="badge <%= lag_trend_bg(partition.lag_stored_d) %>">
@@ -20,22 +14,10 @@
20
14
  </span>
21
15
  </td>
22
16
  <td>
23
- <% if partition.committed_offset.to_i < 0 %>
24
- <span class="badge bg-secondary" title="Not available until first offset commit">
25
- N/A
26
- </span>
27
- <% else %>
28
- <%= partition.committed_offset %>
29
- <% end %>
17
+ <%== offset_with_label partition.committed_offset.to_i %>
30
18
  </td>
31
19
  <td>
32
- <% if partition.stored_offset.to_i < 0 %>
33
- <span class="badge bg-secondary" title="Not available until first offset commit">
34
- N/A
35
- </span>
36
- <% else %>
37
- <%= partition.stored_offset %>
38
- <% end %>
20
+ <%== offset_with_label partition.stored_offset.to_i %>
39
21
  </td>
40
22
  <td>
41
23
  <span class="badge <%= kafka_state_bg(partition.fetch_state) %> mt-1 mb-1">
@@ -15,7 +15,7 @@
15
15
  <%= k %>
16
16
  </td>
17
17
  <td>
18
- <%== labeled_time(v) %>
18
+ <%== time_with_label(v) %>
19
19
  </td>
20
20
  </tr>
21
21
  <% else %>
@@ -13,7 +13,7 @@
13
13
  <%= message.offset %>
14
14
  </td>
15
15
  <td>
16
- <%== labeled_time(message.timestamp) %>
16
+ <%== time_with_label(message.timestamp) %>
17
17
  </td>
18
18
  <td>
19
19
  <%= message.key %>
@@ -6,13 +6,7 @@
6
6
  <%= partition_id %>
7
7
  </td>
8
8
  <td>
9
- <% if details[:lag_stored].to_i < 0 %>
10
- <span class="badge bg-secondary" title="Not available until first offset commit">
11
- N/A
12
- </span>
13
- <% else %>
14
- <%= details[:lag_stored] %>
15
- <% end %>
9
+ <%== offset_with_label details[:lag_stored].to_i %>
16
10
  </td>
17
11
  <td>
18
12
  <span class="badge <%= lag_trend_bg(details[:lag_stored_d]) %>">
@@ -23,13 +17,7 @@
23
17
  <%= details[:committed_offset] %>
24
18
  </td>
25
19
  <td>
26
- <% if details[:stored_offset].to_i < 0 %>
27
- <span class="badge bg-secondary" title="Not available until first offset commit">
28
- N/A
29
- </span>
30
- <% else %>
31
- <%= details[:stored_offset] %>
32
- <% end %>
20
+ <%== offset_with_label details[:stored_offset].to_i %>
33
21
  </td>
34
22
  <td>
35
23
  <span class="badge <%= kafka_state_bg(details[:fetch_state]) %> mt-1 mb-1">
@@ -19,13 +19,13 @@
19
19
  <code>#<%= job.type %></code>
20
20
  </td>
21
21
  <td>
22
- <%= job.first_offset %>
22
+ <%== offset_with_label job.first_offset %>
23
23
  </td>
24
24
  <td>
25
- <%= job.last_offset %>
25
+ <%== offset_with_label job.last_offset %>
26
26
  </td>
27
27
  <td>
28
- <%= job.comitted_offset %>
28
+ <%== offset_with_label job.committed_offset %>
29
29
  </td>
30
30
  <td>
31
31
  <%== relative_time job.started_at %>
@@ -3,6 +3,6 @@
3
3
  module Karafka
4
4
  module Web
5
5
  # Current gem version
6
- VERSION = '0.4.1'
6
+ VERSION = '0.5.0'
7
7
  end
8
8
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karafka-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -35,7 +35,7 @@ cert_chain:
35
35
  Qf04B9ceLUaC4fPVEz10FyobjaFoY4i32xRto3XnrzeAgfEe4swLq8bQsR3w/EF3
36
36
  MGU0FeSV2Yj7Xc2x/7BzLK8xQn5l7Yy75iPF+KP3vVmDHnNl
37
37
  -----END CERTIFICATE-----
38
- date: 2023-04-12 00:00:00.000000000 Z
38
+ date: 2023-04-13 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: erubi
@@ -57,7 +57,7 @@ dependencies:
57
57
  requirements:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: 2.0.38
60
+ version: 2.0.40
61
61
  - - "<"
62
62
  - !ruby/object:Gem::Version
63
63
  version: 3.0.0
@@ -67,7 +67,7 @@ dependencies:
67
67
  requirements:
68
68
  - - ">="
69
69
  - !ruby/object:Gem::Version
70
- version: 2.0.38
70
+ version: 2.0.40
71
71
  - - "<"
72
72
  - !ruby/object:Gem::Version
73
73
  version: 3.0.0
metadata.gz.sig CHANGED
Binary file