karafka-web 0.11.1 → 0.11.3

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: fb9cef529c70e9f643eef6d7d8e70022ddd99fcf2909d40c350d1948bc50dc8f
4
- data.tar.gz: '02795dbd46f18bba63aadc8ccdd95910e183f0df5a8147ab8ac897c6e4a85623'
3
+ metadata.gz: 7b958131581b6fe2fd1a45a68b7366fb842ca15eccd946988516e78b7fcc3cce
4
+ data.tar.gz: 899898076b7fc09111d8cfd77f5e68fe6158b9bfee3128292f77248f2b5922c8
5
5
  SHA512:
6
- metadata.gz: 21559bfd9b8d66872b6499823feec8c34ad7827a36ca5c7170d2a37d74dc2ffbc11ffc109c65cf7c7a6b5e2a70e1493a585cfbd550779f7b21077c62f2b8de8a
7
- data.tar.gz: a6fc4f1592472218556b82c6a5cd3cf0b4a5acc2d1db6546245a5eaab8a7d3d81733f9cea7d9e344e919793e05768da5f5d6f516158559ffc6ef6a9939d0a76f
6
+ metadata.gz: b53b0e2dc696cf5af719ad49b90c130a7122261a8123e5ac8ca4deb31d0f397e49f09d71032df4e840ad3a5f9b5b3115709fbcd08568a0991ee24b0da1b7054e
7
+ data.tar.gz: b3eeac33c925b9527aef85231a74a255c3d59aedd36f20a174e72b282db744cb6a0779258c9136266f54041ab0e81ce8c95a6a042d4ecc908e0cbba299d651f3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Karafka Web Changelog
2
2
 
3
+ ## 0.11.3 (2025-09-29)
4
+ - [Enhancement] Upgrade DaisyUI to 5.1.
5
+ - [Change] Remove Ruby `3.1` support according to the EOL schedule.
6
+ - [Change] Normalize how libs and dependencies are required (no functional change for the end user)
7
+ - [Fix] Fix a case where the states JSON would contain multiple entries for the same processes causing `JSON.parse` with `allow_duplicate_key: false` to fail.
8
+ - [Fix] Fix incorrect reference to `IncompatibleSchemaError`.
9
+
10
+ ## 0.11.2 (2025-08-18)
11
+ - [Enhancement] Make sure that TTL counters related `#inspect` are thread-safe.
12
+ - [Change] Add new CI action to trigger auto-doc refresh.
13
+ - [Change] Update daisyUI to `5.0.50`
14
+
3
15
  ## 0.11.1 (2025-06-23)
4
16
  - [Fix] Extremely high error turnover from hundreds of partitions can cause a deadlock in the reporter for transactional Web producer.
5
17
 
@@ -153,6 +165,9 @@
153
165
  - [Fix] License identifier `LGPL-3.0` is deprecated for SPDX (#2177).
154
166
  - [Fix] Do not include prettifying the payload for visibility in the resource computation cost.
155
167
 
168
+ ## 0.9.2 (2025-09-19)
169
+ - [Fix] Fix BaseController caller action name extraction.
170
+
156
171
  ## 0.9.1 (2024-05-03)
157
172
  - [Fix] OSS `lag_stored` for not-subscribed consumers causes Web UI to crash.
158
173
 
data/Gemfile CHANGED
@@ -6,8 +6,6 @@ plugin 'diffend'
6
6
 
7
7
  gemspec
8
8
 
9
- gem 'karafka'
10
-
11
9
  group :test do
12
10
  gem 'byebug'
13
11
  gem 'factory_bot'
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka-web (0.11.1)
4
+ karafka-web (0.11.3)
5
5
  erubi (~> 1.4)
6
- karafka (>= 2.5.0.rc2, < 2.6.0)
6
+ karafka (>= 2.5.0, < 2.6.0)
7
7
  karafka-core (>= 2.5.0, < 2.6.0)
8
8
  roda (~> 3.68, >= 3.69)
9
9
  tilt (~> 2.0)
@@ -11,7 +11,7 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- activesupport (7.2.2.1)
14
+ activesupport (7.2.2.2)
15
15
  base64
16
16
  benchmark (>= 0.3)
17
17
  bigdecimal
@@ -35,10 +35,20 @@ GEM
35
35
  erubi (1.13.1)
36
36
  et-orbi (1.2.11)
37
37
  tzinfo
38
- factory_bot (6.5.4)
38
+ factory_bot (6.5.5)
39
39
  activesupport (>= 6.1.0)
40
40
  ffi (1.17.2)
41
- fugit (1.11.1)
41
+ ffi (1.17.2-aarch64-linux-gnu)
42
+ ffi (1.17.2-aarch64-linux-musl)
43
+ ffi (1.17.2-arm-linux-gnu)
44
+ ffi (1.17.2-arm-linux-musl)
45
+ ffi (1.17.2-arm64-darwin)
46
+ ffi (1.17.2-x86-linux-gnu)
47
+ ffi (1.17.2-x86-linux-musl)
48
+ ffi (1.17.2-x86_64-darwin)
49
+ ffi (1.17.2-x86_64-linux-gnu)
50
+ ffi (1.17.2-x86_64-linux-musl)
51
+ fugit (1.11.2)
42
52
  et-orbi (~> 1, >= 1.2.11)
43
53
  raabro (~> 1.4)
44
54
  i18n (1.14.7)
@@ -52,42 +62,58 @@ GEM
52
62
  karafka-core (2.5.2)
53
63
  karafka-rdkafka (>= 0.19.2, < 0.21.0)
54
64
  logger (>= 1.6.0)
55
- karafka-rdkafka (0.19.5)
65
+ karafka-rdkafka (0.20.1)
56
66
  ffi (~> 1.15)
67
+ logger
68
+ mini_portile2 (~> 2.6)
69
+ rake (> 12)
70
+ karafka-rdkafka (0.20.1-arm64-darwin)
71
+ ffi (~> 1.15)
72
+ logger
73
+ mini_portile2 (~> 2.6)
74
+ rake (> 12)
75
+ karafka-rdkafka (0.20.1-x86_64-linux-gnu)
76
+ ffi (~> 1.15)
77
+ logger
78
+ mini_portile2 (~> 2.6)
79
+ rake (> 12)
80
+ karafka-rdkafka (0.20.1-x86_64-linux-musl)
81
+ ffi (~> 1.15)
82
+ logger
57
83
  mini_portile2 (~> 2.6)
58
84
  rake (> 12)
59
85
  logger (1.7.0)
60
86
  mini_portile2 (2.8.9)
61
87
  minitest (5.25.5)
62
- nokogiri (1.18.8)
88
+ nokogiri (1.18.10)
63
89
  mini_portile2 (~> 2.8.2)
64
90
  racc (~> 1.4)
65
- nokogiri (1.18.8-aarch64-linux-gnu)
91
+ nokogiri (1.18.10-aarch64-linux-gnu)
66
92
  racc (~> 1.4)
67
- nokogiri (1.18.8-aarch64-linux-musl)
93
+ nokogiri (1.18.10-aarch64-linux-musl)
68
94
  racc (~> 1.4)
69
- nokogiri (1.18.8-arm-linux-gnu)
95
+ nokogiri (1.18.10-arm-linux-gnu)
70
96
  racc (~> 1.4)
71
- nokogiri (1.18.8-arm-linux-musl)
97
+ nokogiri (1.18.10-arm-linux-musl)
72
98
  racc (~> 1.4)
73
- nokogiri (1.18.8-arm64-darwin)
99
+ nokogiri (1.18.10-arm64-darwin)
74
100
  racc (~> 1.4)
75
- nokogiri (1.18.8-x86_64-darwin)
101
+ nokogiri (1.18.10-x86_64-darwin)
76
102
  racc (~> 1.4)
77
- nokogiri (1.18.8-x86_64-linux-gnu)
103
+ nokogiri (1.18.10-x86_64-linux-gnu)
78
104
  racc (~> 1.4)
79
- nokogiri (1.18.8-x86_64-linux-musl)
105
+ nokogiri (1.18.10-x86_64-linux-musl)
80
106
  racc (~> 1.4)
81
- ostruct (0.6.2)
107
+ ostruct (0.6.3)
82
108
  raabro (1.4.0)
83
109
  racc (1.8.1)
84
- rack (3.1.15)
110
+ rack (3.1.16)
85
111
  rack-test (2.2.0)
86
112
  rack (>= 1.3)
87
113
  rackup (0.2.3)
88
114
  rack (>= 3.0.0.beta1)
89
115
  webrick
90
- rake (13.2.1)
116
+ rake (13.3.0)
91
117
  roda (3.92.0)
92
118
  rack
93
119
  rspec (3.13.1)
@@ -137,7 +163,6 @@ DEPENDENCIES
137
163
  byebug
138
164
  factory_bot
139
165
  fugit
140
- karafka
141
166
  karafka-web!
142
167
  nokogiri
143
168
  ostruct
@@ -13,7 +13,7 @@ allowed_patterns=(
13
13
  )
14
14
 
15
15
  # Get all warnings
16
- warnings=$(docker logs --since=0 kafka | grep WARN)
16
+ warnings=$(docker logs --since=0 kafka | grep "] WARN ")
17
17
  exit_code=0
18
18
 
19
19
  while IFS= read -r line; do
@@ -7,3 +7,4 @@ en:
7
7
  missing: needs to be present
8
8
  id_format: needs to be a String
9
9
  format: is invalid
10
+ processes_format: must be a hash with symbol keys
data/docker-compose.yml CHANGED
@@ -1,9 +1,7 @@
1
- version: '2'
2
-
3
1
  services:
4
2
  kafka:
5
3
  container_name: kafka
6
- image: confluentinc/cp-kafka:8.0.0
4
+ image: confluentinc/cp-kafka:8.0.1
7
5
 
8
6
  ports:
9
7
  - 9092:9092
data/karafka-web.gemspec CHANGED
@@ -17,14 +17,14 @@ Gem::Specification.new do |spec|
17
17
  spec.licenses = %w[LGPL-3.0-only Commercial]
18
18
 
19
19
  spec.add_dependency 'erubi', '~> 1.4'
20
- spec.add_dependency 'karafka', '>= 2.5.0.rc2', '< 2.6.0'
20
+ spec.add_dependency 'karafka', '>= 2.5.0', '< 2.6.0'
21
21
  spec.add_dependency 'karafka-core', '>= 2.5.0', '< 2.6.0'
22
22
  spec.add_dependency 'roda', '~> 3.68', '>= 3.69'
23
23
  spec.add_dependency 'tilt', '~> 2.0'
24
24
 
25
25
  spec.add_development_dependency 'rackup', '~> 0.2'
26
26
 
27
- spec.required_ruby_version = '>= 3.1.0'
27
+ spec.required_ruby_version = '>= 3.2.0'
28
28
 
29
29
  spec.executables = %w[karafka-web]
30
30
  spec.require_paths = %w[lib]
@@ -21,7 +21,12 @@ module Karafka
21
21
 
22
22
  ::JSON.parse(
23
23
  raw_payload,
24
- symbolize_names: true
24
+ symbolize_names: true,
25
+ # We allow duplicates keys because of a fixed bug that was causing duplicated process
26
+ # ids to leak into the consumers states data. Once a proper migration is written, this
27
+ # can be retired
28
+ # @see https://github.com/karafka/karafka-web/issues/741
29
+ allow_duplicate_key: true
25
30
  )
26
31
  end
27
32
  end
@@ -54,6 +54,14 @@ module Karafka
54
54
 
55
55
  # Similar to the one related to consumers states
56
56
  MissingConsumersMetricsTopicError = Class.new(BaseError)
57
+
58
+ # Similar to management and ui errors with the same name, it is raised when a critical
59
+ # incompatibility is detected during processing.
60
+ #
61
+ # This error is raised when there was an attempt to process reports that are in a newer
62
+ # version that the one in the current process. We prevent this from happening not to
63
+ # corrupt the data. Please upgrade all the Web UI consumers to the same version
64
+ IncompatibleSchemaError = Class.new(BaseError)
57
65
  end
58
66
 
59
67
  # Ui related errors
@@ -67,11 +75,6 @@ module Karafka
67
75
 
68
76
  # Raised when we want to stop the flow and render 403
69
77
  ForbiddenError = Class.new(BaseError)
70
-
71
- # Raised when trying to get info about a consumer that has incompatible schema in its
72
- # report. It usually means you are running different version of the Web UI in the consumer
73
- # and in the Web server
74
- IncompatibleSchemaError = Class.new(BaseError)
75
78
  end
76
79
  end
77
80
  end
@@ -51,7 +51,11 @@ module Karafka
51
51
  # @param report [Hash]
52
52
  # @param offset [Integer]
53
53
  def add_state(report, offset)
54
- process_id = report[:process][:id]
54
+ # When we deserialize the keys from the stored state, because we convert keys into
55
+ # symbols, we may have given process state already stored. This means that in order
56
+ # to update it, we do need to have the new report process id also as a symbol to
57
+ # act as the key
58
+ process_id = report[:process][:id].to_sym
55
59
 
56
60
  state[:processes][process_id] = {
57
61
  dispatched_at: report[:dispatched_at],
@@ -19,9 +19,14 @@ module Karafka
19
19
  required(:schema_version) { |val| val.is_a?(String) && !val.empty? }
20
20
  required(:dispatched_at) { |val| val.is_a?(Numeric) && val.positive? }
21
21
  required(:stats) { |val| val.is_a?(Hash) }
22
- required(:processes) { |val| val.is_a?(Hash) }
23
22
  required(:schema_state) { |val| VALID_SCHEMA_STATES.include?(val) }
24
23
 
24
+ required(:processes) do |val|
25
+ next false unless val.is_a?(Hash)
26
+
27
+ val.keys.all? { |key| key.is_a?(Symbol) }
28
+ end
29
+
25
30
  virtual do |data, errors|
26
31
  next unless errors.empty?
27
32
 
@@ -56,6 +56,17 @@ module Karafka
56
56
  super
57
57
  end
58
58
 
59
+ # @return [String] thread-safe inspection string
60
+ def inspect
61
+ clear
62
+ size = @accu.size
63
+
64
+ parts = ["ttl=#{@ttl}ms"]
65
+ parts << "size=#{size}"
66
+
67
+ "#<#{self.class.name}:#{format('%#x', object_id)} #{parts.join(' ')}>"
68
+ end
69
+
59
70
  private
60
71
 
61
72
  # Evicts outdated samples
@@ -10,7 +10,8 @@ module Karafka
10
10
  class Hash < Hash
11
11
  # @param ttl [Integer] milliseconds ttl
12
12
  def initialize(ttl)
13
- super() { |k, v| k[v] = Ttls::Array.new(ttl) }
13
+ @ttl = ttl
14
+ super() { |k, v| k[v] = Ttls::Array.new(@ttl) }
14
15
  end
15
16
 
16
17
  # Takes a block where we provide a hash select filtering to select keys we are
@@ -26,6 +27,11 @@ module Karafka
26
27
  select(&block)
27
28
  )
28
29
  end
30
+
31
+ # @return [String] thread-safe inspect of the ttls hash
32
+ def inspect
33
+ "#<#{self.class.name}:#{format('%#x', object_id)} size=#{size} ttl=#{@ttl}ms>"
34
+ end
29
35
  end
30
36
  end
31
37
  end
@@ -12,7 +12,7 @@ module Karafka
12
12
  extend Forwardable
13
13
 
14
14
  def_delegators :sampler, :track
15
- def_delegators :reporter, :report, :report!
15
+ def_delegators :reporter, :report
16
16
 
17
17
  private
18
18