karafka-web 0.5.0 → 0.5.2
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 +12 -1
- data/Gemfile.lock +10 -11
- data/lib/karafka/web/config.rb +2 -1
- data/lib/karafka/web/tracking/consumers/listeners/tags.rb +85 -0
- data/lib/karafka/web/ui/base.rb +18 -0
- data/lib/karafka/web/ui/pro/views/consumers/consumer/_job.erb +3 -2
- data/lib/karafka/web/ui/pro/views/jobs/_job.erb +4 -1
- data/lib/karafka/web/ui/views/jobs/_job.erb +4 -1
- data/lib/karafka/web/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +3 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9696cc8cfbcb6124155dbac2a3c92cadca69bd1acec727418874ecdd24f49de1
|
4
|
+
data.tar.gz: eb60dcbf83ba9cbd8f542b2e536e2e1c5328ee3fe358b234916575202ee75bba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 133ecc3adc65e9559a317b4148813b95f21a41150a271f754e726d2617f19515e89498322b0b50e808825a9793a78472041618c584aaf3797e80259a2f296782
|
7
|
+
data.tar.gz: bf07811d4f0825f0c9770ae04218c2d73c24eed397296ae54fbeb5f8898a6db750952588426ad45ded5c88d9ce498b3aadf54a202852f4ec8193fd9ff4a159d3
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
# Karafka Web changelog
|
2
2
|
|
3
|
-
## 0.5.
|
3
|
+
## 0.5.2 (2023-05-22)
|
4
|
+
- Label ActiveJob consumers jobs with `active_job` tag.
|
5
|
+
- Label Virtual Partitions consumers with `virtual` tag.
|
6
|
+
- Label Long Running Jobs with `long_running_job` tag.
|
7
|
+
- Label collapsed Virtual Partition with `collapsed` tag.
|
8
|
+
- Display consumer tags always below the consumer class name in Jobs/Consumer Jobs views.
|
9
|
+
- Add label with the attempt count on work being retried.
|
10
|
+
|
11
|
+
## 0.5.1 (2023-04-16)
|
12
|
+
- [Fix] Use CSP header matching Sidekiq one to ensure styles and js loading (#55)
|
13
|
+
|
14
|
+
## 0.5.0 (2023-04-13)
|
4
15
|
- [Improvement] Report job `-1001` offsets as `N/A` as in all the other places.
|
5
16
|
- [Fix] Fix misspelling of word `committed`.
|
6
17
|
- [Fix] Shutdown and revocation jobs statistics extraction crashes when idle initialized without messages (#53)
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
karafka-web (0.5.
|
4
|
+
karafka-web (0.5.2)
|
5
5
|
erubi (~> 1.4)
|
6
6
|
karafka (>= 2.0.40, < 3.0.0)
|
7
7
|
karafka-core (>= 2.0.12, < 3.0.0)
|
@@ -24,9 +24,9 @@ GEM
|
|
24
24
|
factory_bot (6.2.1)
|
25
25
|
activesupport (>= 5.0.0)
|
26
26
|
ffi (1.15.5)
|
27
|
-
i18n (1.
|
27
|
+
i18n (1.13.0)
|
28
28
|
concurrent-ruby (~> 1.0)
|
29
|
-
karafka (2.0.
|
29
|
+
karafka (2.0.41)
|
30
30
|
karafka-core (>= 2.0.12, < 3.0.0)
|
31
31
|
thor (>= 0.20)
|
32
32
|
waterdrop (>= 2.4.10, < 3.0.0)
|
@@ -38,22 +38,22 @@ GEM
|
|
38
38
|
ffi (~> 1.15)
|
39
39
|
mini_portile2 (~> 2.6)
|
40
40
|
rake (> 12)
|
41
|
-
mini_portile2 (2.8.
|
41
|
+
mini_portile2 (2.8.2)
|
42
42
|
minitest (5.18.0)
|
43
43
|
rack (3.0.7)
|
44
44
|
rackup (0.2.3)
|
45
45
|
rack (>= 3.0.0.beta1)
|
46
46
|
webrick
|
47
47
|
rake (13.0.6)
|
48
|
-
roda (3.
|
48
|
+
roda (3.67.0)
|
49
49
|
rack
|
50
50
|
rspec (3.12.0)
|
51
51
|
rspec-core (~> 3.12.0)
|
52
52
|
rspec-expectations (~> 3.12.0)
|
53
53
|
rspec-mocks (~> 3.12.0)
|
54
|
-
rspec-core (3.12.
|
54
|
+
rspec-core (3.12.2)
|
55
55
|
rspec-support (~> 3.12.0)
|
56
|
-
rspec-expectations (3.12.
|
56
|
+
rspec-expectations (3.12.3)
|
57
57
|
diff-lcs (>= 1.2.0, < 2.0)
|
58
58
|
rspec-support (~> 3.12.0)
|
59
59
|
rspec-mocks (3.12.5)
|
@@ -70,14 +70,13 @@ GEM
|
|
70
70
|
tilt (2.1.0)
|
71
71
|
tzinfo (2.0.6)
|
72
72
|
concurrent-ruby (~> 1.0)
|
73
|
-
waterdrop (2.5.
|
73
|
+
waterdrop (2.5.2)
|
74
74
|
karafka-core (>= 2.0.12, < 3.0.0)
|
75
75
|
zeitwerk (~> 2.3)
|
76
76
|
webrick (1.8.1)
|
77
|
-
zeitwerk (2.6.
|
77
|
+
zeitwerk (2.6.8)
|
78
78
|
|
79
79
|
PLATFORMS
|
80
|
-
arm64-darwin-21
|
81
80
|
x86_64-linux
|
82
81
|
|
83
82
|
DEPENDENCIES
|
@@ -89,4 +88,4 @@ DEPENDENCIES
|
|
89
88
|
simplecov
|
90
89
|
|
91
90
|
BUNDLED WITH
|
92
|
-
2.4.
|
91
|
+
2.4.12
|
data/lib/karafka/web/config.rb
CHANGED
@@ -45,7 +45,8 @@ module Karafka
|
|
45
45
|
Tracking::Consumers::Listeners::Errors.new,
|
46
46
|
Tracking::Consumers::Listeners::Statistics.new,
|
47
47
|
Tracking::Consumers::Listeners::Pausing.new,
|
48
|
-
Tracking::Consumers::Listeners::Processing.new
|
48
|
+
Tracking::Consumers::Listeners::Processing.new,
|
49
|
+
Tracking::Consumers::Listeners::Tags.new
|
49
50
|
]
|
50
51
|
end
|
51
52
|
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Karafka
|
4
|
+
module Web
|
5
|
+
module Tracking
|
6
|
+
module Consumers
|
7
|
+
module Listeners
|
8
|
+
# Listener used to attach tags to consumers for Web-UI usage. Those tags will be picked
|
9
|
+
# up by another listener
|
10
|
+
#
|
11
|
+
# @note We cannot attach here certain the ActiveJob consumer tags and they need to be
|
12
|
+
# in Karafka itself (mainly the per AJ job tag) because from the outside consumer
|
13
|
+
# perspective we have a single consumption that can run multiple different AJ jobs
|
14
|
+
#
|
15
|
+
# @note We can assign tags here and the order of tracking listeners does not matter,
|
16
|
+
# because tags state for consumers is materialized in the moment of reporting.
|
17
|
+
class Tags < Base
|
18
|
+
# @param event [Karafka::Core::Monitoring::Event]
|
19
|
+
def on_consumer_consume(event)
|
20
|
+
consumer = event.payload[:caller]
|
21
|
+
|
22
|
+
tag_active_job(consumer)
|
23
|
+
tag_attempt(consumer)
|
24
|
+
|
25
|
+
return unless Karafka.pro?
|
26
|
+
|
27
|
+
tag_virtual_partitions(consumer)
|
28
|
+
tag_long_running_job(consumer)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
# Adds ActiveJob consumer related tags
|
34
|
+
#
|
35
|
+
# @param consumer [Karafka::BaseConsumer]
|
36
|
+
def tag_active_job(consumer)
|
37
|
+
return unless consumer.topic.active_job?
|
38
|
+
|
39
|
+
consumer.tags.add(:active_job, :active_job)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Adds attempts counter if this is not the first attempt. Not the first means, there
|
43
|
+
# was an error and we are re-processing.
|
44
|
+
#
|
45
|
+
# @param consumer [Karafka::BaseConsumer]
|
46
|
+
def tag_attempt(consumer)
|
47
|
+
attempt = consumer.coordinator.pause_tracker.attempt
|
48
|
+
|
49
|
+
if attempt > 1
|
50
|
+
consumer.tags.add(:attempt, "attempt:#{attempt}")
|
51
|
+
else
|
52
|
+
consumer.tags.delete(:attempt)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Tags virtual partitioned consumers and adds extra info if operates in a collapsed
|
57
|
+
# mode
|
58
|
+
#
|
59
|
+
# @param consumer [Karafka::BaseConsumer]
|
60
|
+
def tag_virtual_partitions(consumer)
|
61
|
+
return unless consumer.topic.virtual_partitions?
|
62
|
+
|
63
|
+
consumer.tags.add(:virtual, :virtual)
|
64
|
+
|
65
|
+
if consumer.collapsed?
|
66
|
+
consumer.tags.add(:collapsed, :collapsed)
|
67
|
+
else
|
68
|
+
consumer.tags.delete(:collapsed)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Tags long running job consumer work
|
73
|
+
#
|
74
|
+
# @param consumer [Karafka::BaseConsumer]
|
75
|
+
def tag_long_running_job(consumer)
|
76
|
+
return unless consumer.topic.long_running_job?
|
77
|
+
|
78
|
+
consumer.tags.add(:long_running_job, :long_running)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
data/lib/karafka/web/ui/base.rb
CHANGED
@@ -25,6 +25,24 @@ module Karafka
|
|
25
25
|
plugin :not_found
|
26
26
|
plugin :path
|
27
27
|
|
28
|
+
# Based on
|
29
|
+
# https://github.com/sidekiq/sidekiq/blob/ae6ca119/lib/sidekiq/web/application.rb#L8
|
30
|
+
plugin :content_security_policy do |csp|
|
31
|
+
csp.default_src "'self' https: http:"
|
32
|
+
csp.child_src "'self'"
|
33
|
+
csp.connect_src "'self' https: http: wss: ws:"
|
34
|
+
csp.font_src "'self' https: http:"
|
35
|
+
csp.frame_src "'self'"
|
36
|
+
csp.img_src "'self' https: http: data:"
|
37
|
+
csp.manifest_src "'self'"
|
38
|
+
csp.media_src "'self'"
|
39
|
+
csp.object_src "'none'"
|
40
|
+
csp.script_src "'self' https: http: 'unsafe-inline'"
|
41
|
+
csp.style_src "'self' https: http: 'unsafe-inline'"
|
42
|
+
csp.worker_src "'self'"
|
43
|
+
csp.base_uri "'self'"
|
44
|
+
end
|
45
|
+
|
28
46
|
# Display appropriate error specific to a given error type
|
29
47
|
plugin :error_handler, classes: [
|
30
48
|
::Karafka::Web::Errors::Ui::NotFoundError,
|
data/lib/karafka/web/version.rb
CHANGED
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.5.
|
4
|
+
version: 0.5.2
|
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-
|
38
|
+
date: 2023-05-22 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: erubi
|
@@ -184,6 +184,7 @@ files:
|
|
184
184
|
- lib/karafka/web/tracking/consumers/listeners/processing.rb
|
185
185
|
- lib/karafka/web/tracking/consumers/listeners/statistics.rb
|
186
186
|
- lib/karafka/web/tracking/consumers/listeners/status.rb
|
187
|
+
- lib/karafka/web/tracking/consumers/listeners/tags.rb
|
187
188
|
- lib/karafka/web/tracking/consumers/sampler.rb
|
188
189
|
- lib/karafka/web/tracking/memoized_shell.rb
|
189
190
|
- lib/karafka/web/tracking/reporter.rb
|
metadata.gz.sig
CHANGED
Binary file
|