karafka-web 0.6.3 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.github/workflows/ci.yml +13 -4
- data/CHANGELOG.md +119 -5
- data/Gemfile +1 -0
- data/Gemfile.lock +27 -24
- data/README.md +2 -0
- data/bin/rspecs +6 -0
- data/certs/cert_chain.pem +21 -21
- data/docker-compose.yml +22 -0
- data/karafka-web.gemspec +3 -3
- data/lib/karafka/web/app.rb +6 -2
- data/lib/karafka/web/cli.rb +51 -47
- data/lib/karafka/web/config.rb +33 -9
- data/lib/karafka/web/contracts/base.rb +32 -0
- data/lib/karafka/web/contracts/config.rb +63 -0
- data/lib/karafka/web/deserializer.rb +10 -1
- data/lib/karafka/web/errors.rb +29 -7
- data/lib/karafka/web/installer.rb +58 -148
- data/lib/karafka/web/management/base.rb +34 -0
- data/lib/karafka/web/management/clean_boot_file.rb +31 -0
- data/lib/karafka/web/management/create_initial_states.rb +101 -0
- data/lib/karafka/web/management/create_topics.rb +127 -0
- data/lib/karafka/web/management/delete_topics.rb +28 -0
- data/lib/karafka/web/management/enable.rb +82 -0
- data/lib/karafka/web/management/extend_boot_file.rb +37 -0
- data/lib/karafka/web/processing/consumer.rb +73 -17
- data/lib/karafka/web/processing/consumers/aggregators/base.rb +56 -0
- data/lib/karafka/web/processing/consumers/aggregators/metrics.rb +154 -0
- data/lib/karafka/web/processing/consumers/aggregators/state.rb +180 -0
- data/lib/karafka/web/processing/consumers/contracts/aggregated_stats.rb +32 -0
- data/lib/karafka/web/processing/consumers/contracts/metrics.rb +53 -0
- data/lib/karafka/web/processing/consumers/contracts/process.rb +19 -0
- data/lib/karafka/web/processing/consumers/contracts/state.rb +49 -0
- data/lib/karafka/web/processing/consumers/contracts/topic_stats.rb +21 -0
- data/lib/karafka/web/processing/consumers/metrics.rb +29 -0
- data/lib/karafka/web/processing/consumers/schema_manager.rb +56 -0
- data/lib/karafka/web/processing/consumers/state.rb +6 -9
- data/lib/karafka/web/processing/time_series_tracker.rb +130 -0
- data/lib/karafka/web/tracking/consumers/contracts/consumer_group.rb +2 -2
- data/lib/karafka/web/tracking/consumers/contracts/job.rb +2 -1
- data/lib/karafka/web/tracking/consumers/contracts/partition.rb +14 -1
- data/lib/karafka/web/tracking/consumers/contracts/report.rb +10 -8
- data/lib/karafka/web/tracking/consumers/contracts/subscription_group.rb +2 -2
- data/lib/karafka/web/tracking/consumers/contracts/topic.rb +2 -2
- data/lib/karafka/web/tracking/consumers/listeners/processing.rb +6 -2
- data/lib/karafka/web/tracking/consumers/listeners/statistics.rb +15 -1
- data/lib/karafka/web/tracking/consumers/reporter.rb +14 -6
- data/lib/karafka/web/tracking/consumers/sampler.rb +80 -39
- data/lib/karafka/web/tracking/contracts/error.rb +2 -1
- data/lib/karafka/web/ui/app.rb +20 -10
- data/lib/karafka/web/ui/base.rb +56 -6
- data/lib/karafka/web/ui/controllers/base.rb +28 -0
- data/lib/karafka/web/ui/controllers/become_pro.rb +1 -1
- data/lib/karafka/web/ui/controllers/cluster.rb +12 -6
- data/lib/karafka/web/ui/controllers/consumers.rb +4 -2
- data/lib/karafka/web/ui/controllers/dashboard.rb +32 -0
- data/lib/karafka/web/ui/controllers/errors.rb +19 -6
- data/lib/karafka/web/ui/controllers/jobs.rb +4 -2
- data/lib/karafka/web/ui/controllers/requests/params.rb +28 -0
- data/lib/karafka/web/ui/controllers/responses/redirect.rb +29 -0
- data/lib/karafka/web/ui/helpers/application_helper.rb +57 -14
- data/lib/karafka/web/ui/helpers/paths_helper.rb +48 -0
- data/lib/karafka/web/ui/lib/hash_proxy.rb +18 -6
- data/lib/karafka/web/ui/lib/paginations/base.rb +61 -0
- data/lib/karafka/web/ui/lib/paginations/offset_based.rb +96 -0
- data/lib/karafka/web/ui/lib/paginations/page_based.rb +70 -0
- data/lib/karafka/web/ui/lib/paginations/paginators/arrays.rb +33 -0
- data/lib/karafka/web/ui/lib/paginations/paginators/base.rb +23 -0
- data/lib/karafka/web/ui/lib/paginations/paginators/partitions.rb +52 -0
- data/lib/karafka/web/ui/lib/paginations/paginators/sets.rb +85 -0
- data/lib/karafka/web/ui/lib/paginations/watermark_offsets_based.rb +75 -0
- data/lib/karafka/web/ui/lib/ttl_cache.rb +82 -0
- data/lib/karafka/web/ui/models/cluster_info.rb +59 -0
- data/lib/karafka/web/ui/models/consumers_metrics.rb +46 -0
- data/lib/karafka/web/ui/models/{state.rb → consumers_state.rb} +6 -2
- data/lib/karafka/web/ui/models/health.rb +37 -7
- data/lib/karafka/web/ui/models/message.rb +123 -39
- data/lib/karafka/web/ui/models/metrics/aggregated.rb +196 -0
- data/lib/karafka/web/ui/models/metrics/charts/aggregated.rb +50 -0
- data/lib/karafka/web/ui/models/metrics/charts/topics.rb +109 -0
- data/lib/karafka/web/ui/models/metrics/topics.rb +101 -0
- data/lib/karafka/web/ui/models/partition.rb +27 -0
- data/lib/karafka/web/ui/models/process.rb +12 -1
- data/lib/karafka/web/ui/models/status.rb +110 -22
- data/lib/karafka/web/ui/models/visibility_filter.rb +33 -0
- data/lib/karafka/web/ui/pro/app.rb +87 -19
- data/lib/karafka/web/ui/pro/controllers/cluster.rb +11 -0
- data/lib/karafka/web/ui/pro/controllers/consumers.rb +13 -7
- data/lib/karafka/web/ui/pro/controllers/dashboard.rb +54 -0
- data/lib/karafka/web/ui/pro/controllers/dlq.rb +1 -2
- data/lib/karafka/web/ui/pro/controllers/errors.rb +46 -10
- data/lib/karafka/web/ui/pro/controllers/explorer.rb +145 -15
- data/lib/karafka/web/ui/pro/controllers/health.rb +10 -2
- data/lib/karafka/web/ui/pro/controllers/messages.rb +62 -0
- data/lib/karafka/web/ui/pro/controllers/routing.rb +44 -0
- data/lib/karafka/web/ui/pro/views/consumers/_breadcrumbs.erb +7 -1
- data/lib/karafka/web/ui/pro/views/consumers/_consumer.erb +1 -1
- data/lib/karafka/web/ui/pro/views/consumers/_counters.erb +7 -5
- data/lib/karafka/web/ui/pro/views/consumers/consumer/_job.erb +3 -3
- data/lib/karafka/web/ui/pro/views/consumers/consumer/_metrics.erb +5 -4
- data/lib/karafka/web/ui/pro/views/consumers/consumer/_partition.erb +13 -4
- data/lib/karafka/web/ui/pro/views/consumers/consumer/_subscription_group.erb +3 -2
- data/lib/karafka/web/ui/pro/views/consumers/consumer/_tabs.erb +7 -0
- data/lib/karafka/web/ui/pro/views/consumers/details.erb +21 -0
- data/lib/karafka/web/ui/pro/views/consumers/index.erb +4 -2
- data/lib/karafka/web/ui/pro/views/dashboard/_ranges_selector.erb +39 -0
- data/lib/karafka/web/ui/pro/views/dashboard/index.erb +82 -0
- data/lib/karafka/web/ui/pro/views/dlq/_topic.erb +1 -1
- data/lib/karafka/web/ui/pro/views/errors/_breadcrumbs.erb +8 -6
- data/lib/karafka/web/ui/pro/views/errors/_error.erb +2 -2
- data/lib/karafka/web/ui/pro/views/errors/_partition_option.erb +1 -1
- data/lib/karafka/web/ui/pro/views/errors/_table.erb +21 -0
- data/lib/karafka/web/ui/pro/views/errors/_title_with_select.erb +31 -0
- data/lib/karafka/web/ui/pro/views/errors/index.erb +9 -56
- data/lib/karafka/web/ui/pro/views/errors/partition.erb +17 -0
- data/lib/karafka/web/ui/pro/views/errors/show.erb +1 -1
- data/lib/karafka/web/ui/pro/views/explorer/_breadcrumbs.erb +6 -4
- data/lib/karafka/web/ui/pro/views/explorer/_filtered.erb +16 -0
- data/lib/karafka/web/ui/pro/views/explorer/_message.erb +14 -4
- data/lib/karafka/web/ui/pro/views/explorer/_no_topics.erb +7 -0
- data/lib/karafka/web/ui/pro/views/explorer/_partition_option.erb +3 -3
- data/lib/karafka/web/ui/pro/views/explorer/_topic.erb +1 -1
- data/lib/karafka/web/ui/pro/views/explorer/index.erb +12 -8
- data/lib/karafka/web/ui/pro/views/explorer/messages/_headers.erb +15 -0
- data/lib/karafka/web/ui/pro/views/explorer/messages/_key.erb +12 -0
- data/lib/karafka/web/ui/pro/views/explorer/partition/_details.erb +35 -0
- data/lib/karafka/web/ui/pro/views/explorer/partition/_messages.erb +1 -0
- data/lib/karafka/web/ui/pro/views/explorer/partition.erb +6 -4
- data/lib/karafka/web/ui/pro/views/explorer/show.erb +48 -5
- data/lib/karafka/web/ui/pro/views/explorer/topic/_details.erb +23 -0
- data/lib/karafka/web/ui/pro/views/explorer/topic/_empty.erb +3 -0
- data/lib/karafka/web/ui/pro/views/explorer/topic/_limited.erb +4 -0
- data/lib/karafka/web/ui/pro/views/explorer/topic.erb +51 -0
- data/lib/karafka/web/ui/pro/views/health/_breadcrumbs.erb +16 -0
- data/lib/karafka/web/ui/pro/views/health/_no_data.erb +9 -0
- data/lib/karafka/web/ui/pro/views/health/_partition.erb +17 -15
- data/lib/karafka/web/ui/pro/views/health/_partition_offset.erb +40 -0
- data/lib/karafka/web/ui/pro/views/health/_tabs.erb +27 -0
- data/lib/karafka/web/ui/pro/views/health/offsets.erb +71 -0
- data/lib/karafka/web/ui/pro/views/health/overview.erb +68 -0
- data/lib/karafka/web/ui/pro/views/jobs/_job.erb +6 -3
- data/lib/karafka/web/ui/pro/views/jobs/index.erb +4 -1
- data/lib/karafka/web/ui/pro/views/routing/_consumer_group.erb +37 -0
- data/lib/karafka/web/ui/pro/views/routing/_detail.erb +25 -0
- data/lib/karafka/web/ui/pro/views/routing/_topic.erb +23 -0
- data/lib/karafka/web/ui/pro/views/routing/index.erb +10 -0
- data/lib/karafka/web/ui/pro/views/routing/show.erb +26 -0
- data/lib/karafka/web/ui/pro/views/shared/_navigation.erb +7 -10
- data/lib/karafka/web/ui/public/images/logo-gray.svg +28 -0
- data/lib/karafka/web/ui/public/javascripts/application.js +30 -0
- data/lib/karafka/web/ui/public/javascripts/chart.min.js +14 -0
- data/lib/karafka/web/ui/public/javascripts/charts.js +330 -0
- data/lib/karafka/web/ui/public/javascripts/datepicker.js +6 -0
- data/lib/karafka/web/ui/public/javascripts/live_poll.js +39 -12
- data/lib/karafka/web/ui/public/javascripts/offset_datetime.js +74 -0
- data/lib/karafka/web/ui/public/javascripts/tabs.js +59 -0
- data/lib/karafka/web/ui/public/stylesheets/application.css +11 -0
- data/lib/karafka/web/ui/public/stylesheets/datepicker.min.css +12 -0
- data/lib/karafka/web/ui/views/cluster/_no_partitions.erb +3 -0
- data/lib/karafka/web/ui/views/cluster/_partition.erb +20 -22
- data/lib/karafka/web/ui/views/cluster/index.erb +6 -1
- data/lib/karafka/web/ui/views/consumers/_consumer.erb +1 -1
- data/lib/karafka/web/ui/views/consumers/_counters.erb +6 -4
- data/lib/karafka/web/ui/views/consumers/_summary.erb +3 -3
- data/lib/karafka/web/ui/views/consumers/index.erb +3 -1
- data/lib/karafka/web/ui/views/dashboard/_feature_pro.erb +3 -0
- data/lib/karafka/web/ui/views/dashboard/_not_enough_data.erb +15 -0
- data/lib/karafka/web/ui/views/dashboard/_ranges_selector.erb +23 -0
- data/lib/karafka/web/ui/views/dashboard/index.erb +95 -0
- data/lib/karafka/web/ui/views/errors/_detail.erb +12 -0
- data/lib/karafka/web/ui/views/errors/_error.erb +2 -2
- data/lib/karafka/web/ui/views/errors/show.erb +1 -1
- data/lib/karafka/web/ui/views/jobs/index.erb +3 -1
- data/lib/karafka/web/ui/views/layout.erb +10 -3
- data/lib/karafka/web/ui/views/routing/_consumer_group.erb +8 -6
- data/lib/karafka/web/ui/views/routing/_detail.erb +2 -2
- data/lib/karafka/web/ui/views/routing/_topic.erb +1 -1
- data/lib/karafka/web/ui/views/routing/show.erb +1 -1
- data/lib/karafka/web/ui/views/shared/_brand.erb +2 -2
- data/lib/karafka/web/ui/views/shared/_chart.erb +14 -0
- data/lib/karafka/web/ui/views/shared/_content.erb +2 -2
- data/lib/karafka/web/ui/views/shared/_feature_pro.erb +1 -1
- data/lib/karafka/web/ui/views/shared/_flashes.erb +9 -0
- data/lib/karafka/web/ui/views/shared/_footer.erb +22 -0
- data/lib/karafka/web/ui/views/shared/_header.erb +15 -9
- data/lib/karafka/web/ui/views/shared/_live_poll.erb +7 -0
- data/lib/karafka/web/ui/views/shared/_navigation.erb +5 -8
- data/lib/karafka/web/ui/views/shared/_no_paginated_data.erb +9 -0
- data/lib/karafka/web/ui/views/shared/_pagination.erb +17 -13
- data/lib/karafka/web/ui/views/shared/_tab_nav.erb +7 -0
- data/lib/karafka/web/ui/views/shared/exceptions/not_found.erb +34 -32
- data/lib/karafka/web/ui/views/shared/exceptions/pro_only.erb +45 -43
- data/lib/karafka/web/ui/views/status/failures/_consumers_reports_schema_state.erb +15 -0
- data/lib/karafka/web/ui/views/status/failures/_enabled.erb +8 -0
- data/lib/karafka/web/ui/views/status/failures/_initial_consumers_metrics.erb +11 -0
- data/lib/karafka/web/ui/views/status/failures/{_initial_state.erb → _initial_consumers_state.erb} +3 -3
- data/lib/karafka/web/ui/views/status/failures/_partitions.erb +14 -6
- data/lib/karafka/web/ui/views/status/info/_components.erb +21 -1
- data/lib/karafka/web/ui/views/status/show.erb +62 -5
- data/lib/karafka/web/ui/views/status/successes/_enabled.erb +1 -0
- data/lib/karafka/web/ui/views/status/warnings/_replication.erb +19 -0
- data/lib/karafka/web/version.rb +1 -1
- data/lib/karafka/web.rb +11 -0
- data.tar.gz.sig +0 -0
- metadata +124 -39
- metadata.gz.sig +0 -0
- data/lib/karafka/web/processing/consumers/aggregator.rb +0 -130
- data/lib/karafka/web/tracking/contracts/base.rb +0 -34
- data/lib/karafka/web/ui/lib/paginate_array.rb +0 -38
- data/lib/karafka/web/ui/pro/views/explorer/_encryption_enabled.erb +0 -18
- data/lib/karafka/web/ui/pro/views/explorer/partition/_watermark_offsets.erb +0 -10
- data/lib/karafka/web/ui/pro/views/health/index.erb +0 -60
- /data/lib/karafka/web/ui/pro/views/explorer/{_detail.erb → messages/_detail.erb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 651916e28aaa3964d58370954dc66d15afb727f5ca2b4e3f2d8909c41420f329
|
4
|
+
data.tar.gz: c4134a5c8a95a59fe9cd31954333d0663d242291a63718b256b4a95d03a865c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87f1a55595f44d1233a0a88433bf8d245dee7f11e2a1d0d78574eebba3a0471d47588ae7d4a6666674c22d0b35e84042113b37f083900d82a919339192443555
|
7
|
+
data.tar.gz: b618135edf9acdc3130e213fcf8d70d71975f1b813335252d9ef7b94a2f495cd653b891e9628f7bfc63ba8fcdc02dd9c28139508780d4fbbdd5e715e27150641
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.github/workflows/ci.yml
CHANGED
@@ -28,32 +28,41 @@ jobs:
|
|
28
28
|
- ruby: '3.2'
|
29
29
|
coverage: 'true'
|
30
30
|
steps:
|
31
|
-
- uses: actions/checkout@
|
31
|
+
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
|
32
32
|
- name: Install package dependencies
|
33
33
|
run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
|
34
|
+
|
35
|
+
- name: Start Kafka with docker-compose
|
36
|
+
run: |
|
37
|
+
docker-compose up -d
|
38
|
+
|
34
39
|
- name: Set up Ruby
|
35
40
|
uses: ruby/setup-ruby@v1
|
36
41
|
with:
|
37
42
|
ruby-version: ${{matrix.ruby}}
|
43
|
+
|
38
44
|
- name: Install latest bundler
|
39
45
|
run: |
|
40
46
|
gem install bundler --no-document
|
41
47
|
bundle config set without 'tools benchmarks docs'
|
48
|
+
|
42
49
|
- name: Bundle install
|
43
50
|
run: |
|
44
51
|
bundle config set without development
|
45
52
|
bundle install --jobs 4 --retry 3
|
53
|
+
|
46
54
|
- name: Run all tests
|
47
55
|
env:
|
48
56
|
GITHUB_COVERAGE: ${{matrix.coverage}}
|
49
|
-
|
57
|
+
KARAFKA_PRO_LICENSE_TOKEN: ${{ secrets.KARAFKA_PRO_LICENSE_TOKEN }}
|
58
|
+
run: bin/rspecs
|
50
59
|
|
51
60
|
diffend:
|
52
61
|
runs-on: ubuntu-latest
|
53
62
|
strategy:
|
54
63
|
fail-fast: false
|
55
64
|
steps:
|
56
|
-
- uses: actions/checkout@
|
65
|
+
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
|
57
66
|
with:
|
58
67
|
fetch-depth: 0
|
59
68
|
|
@@ -74,7 +83,7 @@ jobs:
|
|
74
83
|
strategy:
|
75
84
|
fail-fast: false
|
76
85
|
steps:
|
77
|
-
- uses: actions/checkout@
|
86
|
+
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
|
78
87
|
with:
|
79
88
|
fetch-depth: 0
|
80
89
|
- name: Run Coditsu
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,119 @@
|
|
1
1
|
# Karafka Web changelog
|
2
2
|
|
3
|
+
## 0.7.0 (2023-09-14)
|
4
|
+
- **[Feature]** Introduce graphs.
|
5
|
+
- **[Feature]** Introduce historical metrics storage.
|
6
|
+
- **[Feature]** Introduce per-topic data exploration in the Explorer.
|
7
|
+
- **[Feature]** Introduce per-topic and per-partition most recent message view with live reload.
|
8
|
+
- **[Feature]** Introduce a new per-process inspection view called "Details" ti display all process real-time aggregated data.
|
9
|
+
- **[Feature]** Introduce `bundle exec karafka-web migrate` that can be used to bootstrap the proper topics and initial data in environments where Karafka Web-UI should be used but is missing the initial setup.
|
10
|
+
- **[Feature]** Replace `decrypt` with a pluggable API for deciding which topics data to display.
|
11
|
+
- **[Feature]** Make sure, that the karafka server process that is materializing UI states is not processing any data having unsupported (newer) schemas. This state will be also visible in the status page.
|
12
|
+
- **[Feature]** Provide ability to reproduce a given message to the same topic partition with all the details from the per message explorer view.
|
13
|
+
- **[Feature]** Provide "surrounding" navigation link that allows to view the given message in the context of its surrounding. Useful for debugging of failures where the batch context may be relevant.
|
14
|
+
- **[Feature]** Allow for time based lookups per topic partition.
|
15
|
+
- **[Feature]** Introduce Offsets Health inspection view for frozen LSO lookups with `lso_threshold` configuration option.
|
16
|
+
- [Improvement] Support pattern subscriptions details in the routing view both by displaying the pattern as well as expanded routing details.
|
17
|
+
- [Improvement] Collect total number of threads per process for the process details view.
|
18
|
+
- [Improvement] Normalize naming of metrics to better reflect what they do (in reports and in the Web UI).
|
19
|
+
- [Improvement] Link error reported first and last offset to the explorer.
|
20
|
+
- [Improvement] Expand routing details to compensate for nested values in declarative topics.
|
21
|
+
- [Improvement] Include last rebalance age in the health view per consumer group.
|
22
|
+
- [Improvement] Provide previous / next navigation when viewing particular messages in the explorer.
|
23
|
+
- [Improvement] Provide previous / next navigation when viewing particular errors.
|
24
|
+
- [Improvement] Link all explorable offsets to the explorer.
|
25
|
+
- [Improvement] Extend status page checks to ensure, that it detects a case when Web-UI is not part of `karafka.rb` but still referenced in routes.
|
26
|
+
- [Improvement] Extend status page checks to ensure, that it detects a case where there is no initial consumers metrics in Kafka topic.
|
27
|
+
- [Improvement] Report Rails version when viewing status page (if Rails used).
|
28
|
+
- [Improvement] List Web UI topics names on the status page in the info section.
|
29
|
+
- [Improvement] Start versioning the materialized states schemas.
|
30
|
+
- [Improvement] Drastically improve the consumers view performance.
|
31
|
+
- [Improvement] Ship versioned assets to prevent invalid assets loading due to cache.
|
32
|
+
- [Improvement] Use `Cache-Control` to cache all the static assets.
|
33
|
+
- [Improvement] Link `counters` counter to jobs page.
|
34
|
+
- [Improvement] Include a sticky footer with the most important links and copyrights.
|
35
|
+
- [Improvement] Store lag in counters for performance improvement and historical metrics.
|
36
|
+
- [Improvement] Introduce in-memory cluster state cached to improve performance.
|
37
|
+
- [Improvement] Switch to offset based pagination instead of per-page pagination.
|
38
|
+
- [Improvement] Avoid double-reading of watermark offsets for explorer and errors display.
|
39
|
+
- [Improvement] When no params needed for a page, do not include empty params.
|
40
|
+
- [Improvement] Do not include page when page is 1 in the url.
|
41
|
+
- [Improvement] Align descriptions for the status page, to reflect that state check happens for consumers initial state.
|
42
|
+
- [Improvement] Report bytesize of raw payload when viewing message in the explorer.
|
43
|
+
- [Improvement] Use zlib compression for Karafka Web UI topics reports (all). Reduces space needed from 50 to 91%.
|
44
|
+
- [Improvement] Rename lag to lag stored in counters to reflect what it does.
|
45
|
+
- [Improvement] Collect both stored lag and lag.
|
46
|
+
- [Improvement] Introduce states and metrics schema validation.
|
47
|
+
- [Improvement] Prevent locking in sampler for time of OS data aggregation.
|
48
|
+
- [Improvement] Collect and report number of messages in particular jobs.
|
49
|
+
- [Improvement] Limit segment size for Web topics to ensure, that Web-UI does not drain resources.
|
50
|
+
- [Improvement] Introduce cookie based sessions management for future usage.
|
51
|
+
- [Improvement] Introduce config validation.
|
52
|
+
- [Improvement] Provide flash messages support.
|
53
|
+
- [Improvement] Use replication factor of two by default (if not overridden) for Web UI topics when there is more than one broker.
|
54
|
+
- [Improvement] Show a warning when replication factor of 1 is used for Web UI topics in production.
|
55
|
+
- [Improvement] Collect extra additional metrics useful for hanging transactions detection.
|
56
|
+
- [Improvement] Reorganize how the Health view looks.
|
57
|
+
- [Improvement] Hide all private Kafka topics by default in the explorer. Configurable with `show_internal_topics` config setting.
|
58
|
+
- [Fix] Return 402 status instead of 500 on Pro features that are not available in OSS.
|
59
|
+
- [Fix] Fix a case where errors would not be visible without Rails due to the `String#first` usage.
|
60
|
+
- [Fix] Fix a case where live-poll would be disabled but would still update data.
|
61
|
+
- [Fix] Fix a case where states materializing consumer would update state too often.
|
62
|
+
- [Fix] Fix a bug when rapid non-initialized shutdown could mess up the metrics.
|
63
|
+
- [Fix] Fix a case where upon multiple rebalances, part of the states materialization could be lost.
|
64
|
+
- [Fix] Make sure, that the flushing interval computation division happens with float.
|
65
|
+
- [Fix] Fix a case where app client id change could force web-ui to recompute the metrics.
|
66
|
+
- [Fix] Make sure, that when re-using same Karafka Web-UI topics as a different up, all states and reports are not recomputed back.
|
67
|
+
- [Fix] Fix headers size inconsistency between Health and Routing.
|
68
|
+
- [Fix] Fix invalid padding on status page.
|
69
|
+
- [Fix] Fix a case where root mounted Karafka Web-UI would not work.
|
70
|
+
- [Fix] Fix a case where upon hitting a too high page of consumers we would inform that no consumers are reporting instead of information that this page does not contain any reporting.
|
71
|
+
- [Refactor] Limit usage of UI models for data intense computation to speed up states materialization under load.
|
72
|
+
- [Refactor] Reorganize pagination engine to support offset based pagination.
|
73
|
+
- [Refactor] Use Roda `custom_block_results` plugin for controllers results handling.
|
74
|
+
- [Maintenance] Require `karafka` `2.2.0` due to fixes in the Iterator API and routing API extensions.
|
75
|
+
|
76
|
+
### Upgrade Notes
|
77
|
+
|
78
|
+
This is a **major** release that brings many things to the table.
|
79
|
+
|
80
|
+
#### Configuration
|
81
|
+
|
82
|
+
Karafka Web UI now relies on Roda session management. Please configure the `ui.sessions.secret` key with a secret value string of at least 64 characters:
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
# Configure it BEFORE enabling
|
86
|
+
Karafka::Web.setup do |config|
|
87
|
+
# REPLACE THIS with your own value. You can use `SecureRandom.hex(64)` to generate it
|
88
|
+
# You may want to set it per ENV
|
89
|
+
config.ui.sessions.secret = 'REPLACE ME! b94b2215cc66371f2c34b7d0c0df1a010f83ca45 REPLACE ME!'
|
90
|
+
end
|
91
|
+
|
92
|
+
Karafka::Web.enable!
|
93
|
+
```
|
94
|
+
|
95
|
+
#### Deployment
|
96
|
+
|
97
|
+
Because of the reporting schema update and new web-ui topics introduction, it is recommended to:
|
98
|
+
|
99
|
+
1. Upgrade the codebase based on the below details.
|
100
|
+
2. **Stop** the consumer materializing Web-UI. Unless you are running a Web-UI dedicated consumer as recommended [here](https://karafka.io/docs/Web-UI-Development-vs-Production/), you will have to stop all the consumers. This is **crucial** because of schema changes. `karafka-web` `0.7.0` introduces the detection of schema changes, so this step should not be needed in the future.
|
101
|
+
3. Run a migration command: `bundle exec karafka-web migrate` that will create missing states and missing topics. You **need** to run it for each of the environments where you use Karafka Web UI.
|
102
|
+
4. Deploy **all** the Karafka consumer processes (`karafka server`).
|
103
|
+
5. Deploy the Web update to your web server and check that everything is OK by visiting the status page.
|
104
|
+
|
105
|
+
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.
|
106
|
+
|
107
|
+
#### Code and API changes
|
108
|
+
|
109
|
+
1. `bundle exec karafka-web install` is now a single-purpose command that should run **only** when installing the Web-UI for the first time.
|
110
|
+
2. For creating needed topics and states per environment and during upgrades, please use the newly introduced non-destructive `bundle exec karafka-web migrate`. It will assess changes required and will apply only those.
|
111
|
+
3. Is no longer`ui.decrypt` has been replaced with `ui.visibility_filter` API. This API by default also does not decrypt data. To change this behavior, please implement your visibility filter as presented in our documentation.
|
112
|
+
4. Karafka Web UI `0.7.0` introduces an in-memory topics cache for some views. This means that rapid topics changes (repartitions/new topics) may be visible up to 5 minutes after those changes.
|
113
|
+
3. `ui.decrypt` setting has been replaced with `ui.visibility_filter` API. This API by default also does not decrypt data. To change this behavior, please implement your visibility filter as presented in our documentation.
|
114
|
+
4. Karafka Web-UI `0.7.0` introduces an in-memory topics cache for some views. This means that rapid topics changes (repartitions/new topics) may be visible up to 5 minutes after those changes.
|
115
|
+
5. Karafka Web UI requires now a new topic called `karafka_consumers_metrics`. If you use strict topic creation and ACL policies, please make sure it exists and that Karafka can both read and write to it.
|
116
|
+
|
3
117
|
## 0.6.3 (2023-07-22)
|
4
118
|
- [Fix] Remove files from 0.7.0 accidentally added to the release.
|
5
119
|
|
@@ -37,7 +151,7 @@
|
|
37
151
|
- [Refactor] Remove not used and redundant partials.
|
38
152
|
- [Maintenance] Require `karafka` `2.1.4` due to fixes in metrics usage for workless flows.
|
39
153
|
|
40
|
-
### Upgrade
|
154
|
+
### Upgrade Notes
|
41
155
|
|
42
156
|
Because of the reporting schema update, it is recommended to:
|
43
157
|
|
@@ -85,7 +199,7 @@ Please make sure **not** to do it for the default `Karafka.producer` because it
|
|
85
199
|
- [Fix] Fix misspelling of word `committed`.
|
86
200
|
- [Fix] Shutdown and revocation jobs statistics extraction crashes when idle initialized without messages (#53)
|
87
201
|
|
88
|
-
### Upgrade
|
202
|
+
### Upgrade Notes
|
89
203
|
|
90
204
|
Because of the reporting schema change, it is recommended to:
|
91
205
|
|
@@ -106,7 +220,7 @@ Please note that if you decide to use the updated Web UI with not updated consum
|
|
106
220
|
- [Fix] Add missing support for using multiple subscription groups within a single consumer group.
|
107
221
|
- [Fix] Mask SASL credentials in topic routing view (#46)
|
108
222
|
|
109
|
-
### Upgrade
|
223
|
+
### Upgrade Notes
|
110
224
|
|
111
225
|
Because of the reporting schema change, it is recommended to:
|
112
226
|
|
@@ -120,7 +234,7 @@ Please note that if you decide to use the updated Web UI with not updated consum
|
|
120
234
|
- [Fix] Fix display of compacted messages placeholders for offsets lower than low watermark.
|
121
235
|
- [Fix] Fix invalid pagination per page count.
|
122
236
|
|
123
|
-
### Upgrade
|
237
|
+
### Upgrade Notes
|
124
238
|
|
125
239
|
If upgrading from `0.3.0`, nothing.
|
126
240
|
|
@@ -145,7 +259,7 @@ If upgrading from lower, please follow `0.3.0` upgrade procedure.
|
|
145
259
|
- [Maintenance] Remove compatibility fallbacks for job and process tags (#1342)
|
146
260
|
- [Maintenance] Extract base sampler for tracking and web.
|
147
261
|
|
148
|
-
### Upgrade
|
262
|
+
### Upgrade Notes
|
149
263
|
|
150
264
|
Because of the removal of compatibility fallbacks for some metrics fetches, it is recommended to:
|
151
265
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
karafka-web (0.
|
4
|
+
karafka-web (0.7.0)
|
5
5
|
erubi (~> 1.4)
|
6
|
-
karafka (>= 2.
|
7
|
-
karafka-core (>= 2.
|
8
|
-
roda (~> 3.68, >= 3.
|
6
|
+
karafka (>= 2.2.3, < 3.0.0)
|
7
|
+
karafka-core (>= 2.2.2, < 3.0.0)
|
8
|
+
roda (~> 3.68, >= 3.69)
|
9
9
|
tilt (~> 2.0)
|
10
10
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
activesupport (7.0.
|
14
|
+
activesupport (7.0.8)
|
15
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
16
|
i18n (>= 1.6, < 2)
|
17
17
|
minitest (>= 5.1)
|
@@ -21,31 +21,33 @@ GEM
|
|
21
21
|
diff-lcs (1.5.0)
|
22
22
|
docile (1.4.0)
|
23
23
|
erubi (1.12.0)
|
24
|
-
factory_bot (6.
|
24
|
+
factory_bot (6.3.0)
|
25
25
|
activesupport (>= 5.0.0)
|
26
26
|
ffi (1.15.5)
|
27
|
-
i18n (1.
|
27
|
+
i18n (1.14.1)
|
28
28
|
concurrent-ruby (~> 1.0)
|
29
|
-
karafka (2.
|
30
|
-
karafka-core (>= 2.
|
29
|
+
karafka (2.2.3)
|
30
|
+
karafka-core (>= 2.2.2, < 2.3.0)
|
31
31
|
thor (>= 0.20)
|
32
|
-
waterdrop (>= 2.
|
32
|
+
waterdrop (>= 2.6.6, < 3.0.0)
|
33
33
|
zeitwerk (~> 2.3)
|
34
|
-
karafka-core (2.
|
34
|
+
karafka-core (2.2.2)
|
35
35
|
concurrent-ruby (>= 1.1)
|
36
|
-
karafka-rdkafka (>= 0.
|
37
|
-
karafka-rdkafka (0.
|
36
|
+
karafka-rdkafka (>= 0.13.1, < 0.14.0)
|
37
|
+
karafka-rdkafka (0.13.4)
|
38
38
|
ffi (~> 1.15)
|
39
39
|
mini_portile2 (~> 2.6)
|
40
40
|
rake (> 12)
|
41
|
-
mini_portile2 (2.8.
|
42
|
-
minitest (5.
|
43
|
-
rack (3.0.
|
41
|
+
mini_portile2 (2.8.4)
|
42
|
+
minitest (5.20.0)
|
43
|
+
rack (3.0.8)
|
44
|
+
rack-test (2.1.0)
|
45
|
+
rack (>= 1.3)
|
44
46
|
rackup (0.2.3)
|
45
47
|
rack (>= 3.0.0.beta1)
|
46
48
|
webrick
|
47
49
|
rake (13.0.6)
|
48
|
-
roda (3.
|
50
|
+
roda (3.71.0)
|
49
51
|
rack
|
50
52
|
rspec (3.12.0)
|
51
53
|
rspec-core (~> 3.12.0)
|
@@ -56,10 +58,10 @@ GEM
|
|
56
58
|
rspec-expectations (3.12.3)
|
57
59
|
diff-lcs (>= 1.2.0, < 2.0)
|
58
60
|
rspec-support (~> 3.12.0)
|
59
|
-
rspec-mocks (3.12.
|
61
|
+
rspec-mocks (3.12.6)
|
60
62
|
diff-lcs (>= 1.2.0, < 2.0)
|
61
63
|
rspec-support (~> 3.12.0)
|
62
|
-
rspec-support (3.12.
|
64
|
+
rspec-support (3.12.1)
|
63
65
|
simplecov (0.22.0)
|
64
66
|
docile (~> 1.1)
|
65
67
|
simplecov-html (~> 0.11)
|
@@ -67,14 +69,14 @@ GEM
|
|
67
69
|
simplecov-html (0.12.3)
|
68
70
|
simplecov_json_formatter (0.1.4)
|
69
71
|
thor (1.2.2)
|
70
|
-
tilt (2.
|
72
|
+
tilt (2.2.0)
|
71
73
|
tzinfo (2.0.6)
|
72
74
|
concurrent-ruby (~> 1.0)
|
73
|
-
waterdrop (2.
|
74
|
-
karafka-core (>= 2.
|
75
|
+
waterdrop (2.6.7)
|
76
|
+
karafka-core (>= 2.1.1, < 3.0.0)
|
75
77
|
zeitwerk (~> 2.3)
|
76
78
|
webrick (1.8.1)
|
77
|
-
zeitwerk (2.6.
|
79
|
+
zeitwerk (2.6.11)
|
78
80
|
|
79
81
|
PLATFORMS
|
80
82
|
x86_64-linux
|
@@ -83,9 +85,10 @@ DEPENDENCIES
|
|
83
85
|
byebug
|
84
86
|
factory_bot
|
85
87
|
karafka-web!
|
88
|
+
rack-test
|
86
89
|
rackup (~> 0.2)
|
87
90
|
rspec
|
88
91
|
simplecov
|
89
92
|
|
90
93
|
BUNDLED WITH
|
91
|
-
2.4.
|
94
|
+
2.4.19
|
data/README.md
CHANGED
@@ -18,6 +18,8 @@ Karafka Web UI documentation is part of the Karafka framework documentation and
|
|
18
18
|
|
19
19
|
The Enhanced Web UI, aside from all the features from the OSS version, also offers additional features and capabilities not available in the free version, making it a better option for those looking for more robust monitoring and management capabilities for their Karafka applications. Some of the key benefits of the Enhanced Web UI version include the following:
|
20
20
|
|
21
|
+
- Real-time and historical processing and utilization metrics.
|
22
|
+
- Real-time topics lag awareness.
|
21
23
|
- Enhanced consumers utilization metrics providing much better insights into processes resources utilization.
|
22
24
|
- Consumer process inspection to quickly analyze the state of a given consuming process.
|
23
25
|
- Consumer jobs inspection to view currently running jobs on a per-process basis.
|
data/bin/rspecs
ADDED
data/certs/cert_chain.pem
CHANGED
@@ -1,26 +1,26 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
2
|
MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MRAwDgYDVQQDDAdjb250
|
3
3
|
YWN0MRcwFQYKCZImiZPyLGQBGRYHa2FyYWZrYTESMBAGCgmSJomT8ixkARkWAmlv
|
4
|
-
|
4
|
+
MB4XDTIzMDgyMTA3MjU1NFoXDTI0MDgyMDA3MjU1NFowPzEQMA4GA1UEAwwHY29u
|
5
5
|
dGFjdDEXMBUGCgmSJomT8ixkARkWB2thcmFma2ExEjAQBgoJkiaJk/IsZAEZFgJp
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
6
|
+
bzCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAOuZpyQKEwsTG9plLat7
|
7
|
+
8bUaNuNBEnouTsNMr6X+XTgvyrAxTuocdsyP1sNCjdS1B8RiiDH1/Nt9qpvlBWon
|
8
|
+
sdJ1SYhaWNVfqiYStTDnCx3PRMmHRdD4KqUWKpN6VpZ1O/Zu+9Mw0COmvXgZuuO9
|
9
|
+
wMSJkXRo6dTCfMedLAIxjMeBIxtoLR2e6Jm6MR8+8WYYVWrO9kSOOt5eKQLBY7aK
|
10
|
+
b/Dc40EcJKPg3Z30Pia1M9ZyRlb6SOj6SKpHRqc7vbVQxjEw6Jjal1lZ49m3YZMd
|
11
|
+
ArMAs9lQZNdSw5/UX6HWWURLowg6k10RnhTUtYyzO9BFev0JFJftHnmuk8vtb+SD
|
12
|
+
5VPmjFXg2VOcw0B7FtG75Vackk8QKfgVe3nSPhVpew2CSPlbJzH80wChbr19+e3+
|
13
|
+
YGr1tOiaJrL6c+PNmb0F31NXMKpj/r+n15HwlTMRxQrzFcgjBlxf2XFGnPQXHhBm
|
14
|
+
kp1OFnEq4GG9sON4glRldkwzi/f/fGcZmo5fm3d+0ZdNgwIDAQABo3cwdTAJBgNV
|
15
|
+
HRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUPVH5+dLA80A1kJ2Uz5iGwfOa
|
16
|
+
1+swHQYDVR0RBBYwFIESY29udGFjdEBrYXJhZmthLmlvMB0GA1UdEgQWMBSBEmNv
|
17
|
+
bnRhY3RAa2FyYWZrYS5pbzANBgkqhkiG9w0BAQsFAAOCAYEAnpa0jcN7JzREHMTQ
|
18
|
+
bfZ+xcvlrzuROMY6A3zIZmQgbnoZZNuX4cMRrT1p1HuwXpxdpHPw7dDjYqWw3+1h
|
19
|
+
3mXLeMuk7amjQpYoSWU/OIZMhIsARra22UN8qkkUlUj3AwTaChVKN/bPJOM2DzfU
|
20
|
+
kz9vUgLeYYFfQbZqeI6SsM7ltilRV4W8D9yNUQQvOxCFxtLOetJ00fC/E7zMUzbK
|
21
|
+
IBwYFQYsbI6XQzgAIPW6nGSYKgRhkfpmquXSNKZRIQ4V6bFrufa+DzD0bt2ZA3ah
|
22
|
+
fMmJguyb5L2Gf1zpDXzFSPMG7YQFLzwYz1zZZvOU7/UCpQsHpID/YxqDp4+Dgb+Y
|
23
|
+
qma0whX8UG/gXFV2pYWpYOfpatvahwi+A1TwPQsuZwkkhi1OyF1At3RY+hjSXyav
|
24
|
+
AnG1dJU+yL2BK7vaVytLTstJME5mepSZ46qqIJXMuWob/YPDmVaBF39TDSG9e34s
|
25
|
+
msG3BiCqgOgHAnL23+CN3Rt8MsuRfEtoTKpJVcCfoEoNHOkc
|
26
26
|
-----END CERTIFICATE-----
|
data/docker-compose.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
version: '2'
|
2
|
+
services:
|
3
|
+
zookeeper:
|
4
|
+
container_name: karafka_web_21_zookeeper
|
5
|
+
image: wurstmeister/zookeeper
|
6
|
+
restart: on-failure
|
7
|
+
ports:
|
8
|
+
- '2181:2181'
|
9
|
+
|
10
|
+
kafka:
|
11
|
+
container_name: karafka_web_21_kafka
|
12
|
+
image: wurstmeister/kafka
|
13
|
+
ports:
|
14
|
+
- '9092:9092'
|
15
|
+
environment:
|
16
|
+
KAFKA_ADVERTISED_HOST_NAME: localhost
|
17
|
+
KAFKA_ADVERTISED_PORT: 9092
|
18
|
+
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
|
19
|
+
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
|
20
|
+
volumes:
|
21
|
+
- /var/run/docker.sock:/var/run/docker.sock
|
22
|
+
restart: on-failure
|
data/karafka-web.gemspec
CHANGED
@@ -17,9 +17,9 @@ 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.
|
21
|
-
spec.add_dependency 'karafka-core', '>= 2.
|
22
|
-
spec.add_dependency 'roda', '~> 3.68', '>= 3.
|
20
|
+
spec.add_dependency 'karafka', '>= 2.2.3', '< 3.0.0'
|
21
|
+
spec.add_dependency 'karafka-core', '>= 2.2.2', '< 3.0.0'
|
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'
|
data/lib/karafka/web/app.rb
CHANGED
@@ -8,8 +8,12 @@ module Karafka
|
|
8
8
|
# @param env [Hash] Rack env
|
9
9
|
# @param block [Proc] Rack block
|
10
10
|
def call(env, &block)
|
11
|
-
|
12
|
-
|
11
|
+
engine.call(env, &block)
|
12
|
+
end
|
13
|
+
|
14
|
+
# @return [Class] regular or pro Web engine
|
15
|
+
def engine
|
16
|
+
::Karafka.pro? ? Ui::Pro::App : Ui::App
|
13
17
|
end
|
14
18
|
end
|
15
19
|
end
|
data/lib/karafka/web/cli.rb
CHANGED
@@ -6,74 +6,78 @@ module Karafka
|
|
6
6
|
class Cli < Thor
|
7
7
|
include ::Karafka::Helpers::Colorize
|
8
8
|
|
9
|
-
# Code that is needed in the `karafka.rb` to connect Web UI to Karafka
|
10
|
-
ENABLER_CODE = 'Karafka::Web.enable!'
|
11
|
-
|
12
|
-
private_constant :ENABLER_CODE
|
13
|
-
|
14
9
|
package_name 'Karafka Web'
|
15
10
|
|
16
11
|
desc 'install', 'Installs the Web UI'
|
17
12
|
method_option(
|
18
13
|
:replication_factor,
|
19
14
|
desc: 'Replication factor for created topics',
|
20
|
-
default:
|
15
|
+
default: false,
|
16
|
+
check_default_type: false,
|
21
17
|
type: :numeric
|
22
18
|
)
|
23
|
-
# Installs Karafka Web
|
19
|
+
# Installs Karafka Web. Creates all needed topics, populates the data and adds the needed
|
20
|
+
# code to `karafka.rb`.
|
24
21
|
def install
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
Karafka::Web::Installer.new.bootstrap!(replication_factor: options[:replication_factor])
|
31
|
-
|
32
|
-
puts 'Updating the Karafka boot file...'
|
33
|
-
|
34
|
-
if File.read(Karafka.boot_file).include?(ENABLER_CODE)
|
35
|
-
puts "Web UI #{green('already')} installed."
|
36
|
-
else
|
37
|
-
File.open(Karafka.boot_file, 'a') do |f|
|
38
|
-
f << "\n#{ENABLER_CODE}\n"
|
39
|
-
end
|
40
|
-
end
|
22
|
+
Karafka::Web::Installer.new.install(
|
23
|
+
replication_factor: compute_replication_factor(options[:replication_factor])
|
24
|
+
)
|
25
|
+
end
|
41
26
|
|
42
|
-
|
43
|
-
|
44
|
-
|
27
|
+
desc 'migrate', 'Creates necessary topics if not present and populates state data'
|
28
|
+
method_option(
|
29
|
+
:replication_factor,
|
30
|
+
desc: 'Replication factor for created topics',
|
31
|
+
default: false,
|
32
|
+
check_default_type: false,
|
33
|
+
type: :numeric
|
34
|
+
)
|
35
|
+
# Creates new topics (if any) and populates missing data.
|
36
|
+
# It does **not** remove topics and will not populate data if it is already there.
|
37
|
+
#
|
38
|
+
# Useful in two scenarios:
|
39
|
+
# 1. When setting up Web-UI in a new environment, so the Web-UI has the proper initial
|
40
|
+
# state.
|
41
|
+
# 2. When upgrading Web-UI in-between versions that would require extra topics and/or extra
|
42
|
+
# states populated.
|
43
|
+
def migrate
|
44
|
+
Karafka::Web::Installer.new.migrate(
|
45
|
+
replication_factor: compute_replication_factor(options[:replication_factor])
|
46
|
+
)
|
45
47
|
end
|
46
48
|
|
47
49
|
desc 'reset', 'Resets the Web UI by removing all the Web topics and creating them again'
|
48
|
-
|
50
|
+
method_option(
|
51
|
+
:replication_factor,
|
52
|
+
desc: 'Replication factor for created topics',
|
53
|
+
default: false,
|
54
|
+
check_default_type: false,
|
55
|
+
type: :numeric
|
56
|
+
)
|
57
|
+
# Resets Karafka Web. Removes the topics, creates them again and populates the initial state
|
58
|
+
# again. This is useful in case the Web-UI metrics or anything else got corrupted.
|
49
59
|
def reset
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
puts
|
54
|
-
puts("Resetting #{green('completed')}. Have fun!")
|
55
|
-
puts
|
60
|
+
Karafka::Web::Installer.new.reset(
|
61
|
+
replication_factor: compute_replication_factor(options[:replication_factor])
|
62
|
+
)
|
56
63
|
end
|
57
64
|
|
58
65
|
desc 'uninstall', 'Removes all the Web UI topics and the enabled code'
|
59
66
|
# Uninstalls Karafka Web
|
60
67
|
def uninstall
|
61
|
-
|
62
|
-
|
63
|
-
Karafka::Web::Installer.new.uninstall!
|
64
|
-
|
65
|
-
puts 'Updating the Karafka boot file...'
|
66
|
-
|
67
|
-
karafka_rb = File.readlines(Karafka.boot_file)
|
68
|
-
if karafka_rb.any? { |line| line.include?(ENABLER_CODE) }
|
69
|
-
karafka_rb.delete_if { |line| line.include?(ENABLER_CODE) }
|
68
|
+
Karafka::Web::Installer.new.uninstall
|
69
|
+
end
|
70
70
|
|
71
|
-
|
72
|
-
end
|
71
|
+
private
|
73
72
|
|
74
|
-
|
75
|
-
|
76
|
-
|
73
|
+
# Takes the CLI user provided replication factor but if not present, uses the brokers count
|
74
|
+
# to decide. For non-dev clusters (with one broker) we usually want to have replication of
|
75
|
+
# two, just to have some redundancy.
|
76
|
+
# @param cli_replication_factor [Integer, false] user requested replication factor or false
|
77
|
+
# if we are supposed to compute the factor automatically
|
78
|
+
# @return [Integer] replication factor for Karafka Web UI topics
|
79
|
+
def compute_replication_factor(cli_replication_factor)
|
80
|
+
cli_replication_factor || Ui::Models::ClusterInfo.fetch.brokers.size > 1 ? 2 : 1
|
77
81
|
end
|
78
82
|
end
|
79
83
|
end
|