karafka-web 0.4.0 → 0.5.0

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: 741082cd49e03399e910d2119b2bbd5bffd397c0b548005db6dedc3d6e283557
4
- data.tar.gz: b5b24528a2e489fa509c70deea9e79011d0945e6a6f1b8e44686acc0ec2ab96b
3
+ metadata.gz: 9edb576f473624295de9b0f1d62cbed131c9be1b480958a63c33f891fbf7cb19
4
+ data.tar.gz: 4f71e3a6ce1ca6eb423550824c5381e3b2b237c1b2af88c9108359bd225a7444
5
5
  SHA512:
6
- metadata.gz: aba7fd6a0b9e3729219bd477319b6e06b0662e41f7734e0e43940df940f20451a63a7c4ab734475b29a1c615109329f04a4f6e9767c3cf36005b365ca2174b8f
7
- data.tar.gz: '02160184e59088650bb6a00c831ef58a880b02a70dc2b2a4ccfceb4e140a0ee4e0b30e27a5e6df1b35e9516db47823464e6b125ed34ee29a742db4506460983c'
6
+ metadata.gz: 7e0f77ed2a8e6c902596d2fad16938c3117a49c3faa7d9c60e8018c24135b9c3f38e45ffe5a0aa6fffdbf6f514956d4122afbb90a021f0c6f6274e0cb5212e75
7
+ data.tar.gz: 6fc0272d850dcdd99c277dabb38c5a0761646709f679b794f5c4b8161eb9217439f087b7d3eba3763bec60902874413506c6492dbb9ee63a992a0b6674124689
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
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
+
17
+ ## 0.4.1 (2023-04-12)
18
+ - [Improvement] Replace the "x time ago" in the code explorer with an exact date (`2023-04-12 10:16:48.596 +0200 `).
19
+ - [Improvement] When hovering over a message timestamp, a label with raw numeric timestamp will be presented.
20
+ - [Improvement] Do not skip reporting on partitions subscribed that never received any messages.
21
+ - [Fix] Skip reporting data on subscriptions that were revoked and not only stopped by us.
22
+
3
23
  ## 0.4.0 (2023-04-07)
4
24
  - [Improvement] Include active jobs and active partitions subscriptions count in the per-process tab navigation.
5
25
  - [Improvement] Include subscription groups names in the per-process subscriptions view.
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka-web (0.4.0)
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,
@@ -87,13 +87,14 @@ module Karafka
87
87
  def partition_reportable?(pt_id, pt_stats)
88
88
  return false if pt_id == -1
89
89
 
90
- # Skip until lag info is available
91
- return false if pt_stats['consumer_lag'] == -1
92
-
93
90
  # Collect information only about what we are subscribed to and what we fetch or
94
- # work in any way. Stopped means, we no longer work with it
91
+ # work in any way. Stopped means, we stopped working with it
95
92
  return false if pt_stats['fetch_state'] == 'stopped'
96
93
 
94
+ # Return if we no longer fetch this partition in a particular process. None means
95
+ # that we no longer have this subscription assigned and we do not fetch
96
+ return false if pt_stats['fetch_state'] == 'none'
97
+
97
98
  true
98
99
  end
99
100
 
@@ -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
@@ -125,10 +125,31 @@ module Karafka
125
125
  # @param time [Float] UTC time float
126
126
  # @return [String] relative time tag for timeago.js
127
127
  def relative_time(time)
128
- stamp = Time.at(time).getutc.iso8601
128
+ stamp = Time.at(time).getutc.iso8601(3)
129
129
  %(<time class="ltr" dir="ltr" title="#{stamp}" datetime="#{stamp}">#{time}</time>)
130
130
  end
131
131
 
132
+ # @param time [Time] time object we want to present with detailed ms label
133
+ # @return [String] span tag with raw timestamp as a title and time as a value
134
+ def time_with_label(time)
135
+ stamp = (time.to_f * 1000).to_i
136
+
137
+ %(<span title="#{stamp}">#{time}</span>)
138
+ end
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
+
132
153
  # Returns the view title html code
133
154
  #
134
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,16 +14,10 @@
20
14
  </span>
21
15
  </td>
22
16
  <td>
23
- <%= partition.committed_offset %>
17
+ <%== offset_with_label partition.committed_offset.to_i %>
24
18
  </td>
25
19
  <td>
26
- <% if partition.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
- <%= partition.stored_offset %>
32
- <% end %>
20
+ <%== offset_with_label partition.stored_offset.to_i %>
33
21
  </td>
34
22
  <td>
35
23
  <span class="badge <%= kafka_state_bg(partition.fetch_state) %> mt-1 mb-1">
@@ -9,6 +9,15 @@
9
9
  </td>
10
10
  </tr>
11
11
  <% end %>
12
+ <% elsif v.is_a?(Time) %>
13
+ <tr>
14
+ <td>
15
+ <%= k %>
16
+ </td>
17
+ <td>
18
+ <%== time_with_label(v) %>
19
+ </td>
20
+ </tr>
12
21
  <% else %>
13
22
  <tr>
14
23
  <td>
@@ -13,7 +13,7 @@
13
13
  <%= message.offset %>
14
14
  </td>
15
15
  <td>
16
- <%== relative_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.0'
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.0
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-07 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