Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard with metrics #83

Merged
merged 120 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
6f46df6
wip
mensfeld Jul 14, 2023
bdb8b50
remarks
mensfeld Jul 18, 2023
a43fb4a
remarks
mensfeld Jul 18, 2023
5169850
remarks
mensfeld Jul 18, 2023
7f8b0ef
remove boilerplate
mensfeld Jul 18, 2023
f75a3f7
specs and cleaup
mensfeld Jul 18, 2023
5ffffe6
remarks
mensfeld Jul 18, 2023
bf96089
remarks
mensfeld Jul 20, 2023
b612b54
remarks
mensfeld Jul 20, 2023
aaf52fb
remarks
mensfeld Jul 21, 2023
f3c184a
specs and remarks
mensfeld Jul 21, 2023
931472e
add specs
mensfeld Jul 21, 2023
8297e4c
make rubocop happy
mensfeld Jul 21, 2023
3b9dd16
wip
mensfeld Jul 22, 2023
8dabb1a
merg
mensfeld Jul 22, 2023
db69bca
Merge branch 'master' of github.com:karafka/karafka-web into 81
mensfeld Jul 22, 2023
76191f8
remarks
mensfeld Jul 23, 2023
0b464c7
rename state to consumers state in models
mensfeld Jul 23, 2023
f59a0a4
wip
mensfeld Jul 25, 2023
6e0e1b8
wip
mensfeld Jul 25, 2023
38c1937
align naming of lag
mensfeld Jul 25, 2023
3bef4b6
details on process
mensfeld Jul 25, 2023
fb761f4
remarks
mensfeld Jul 25, 2023
e469fac
ui cleanups
mensfeld Jul 26, 2023
73c65fc
wip
mensfeld Jul 27, 2023
da5eef3
remarks
mensfeld Jul 27, 2023
3b79bfb
remarks
mensfeld Jul 27, 2023
1d6222e
remarks
mensfeld Jul 27, 2023
0d94b7f
typo
mensfeld Jul 28, 2023
cc9d570
rem
mensfeld Jul 28, 2023
b8f0156
introduce ongoing
mensfeld Jul 28, 2023
e663749
remarks
mensfeld Jul 28, 2023
76806d7
fixes
mensfeld Jul 28, 2023
fa9f030
better labels
mensfeld Jul 28, 2023
9473e29
changes
mensfeld Jul 29, 2023
304d383
docs
mensfeld Jul 29, 2023
6f75474
remarks
mensfeld Jul 29, 2023
1092088
remarks
mensfeld Jul 29, 2023
50d5093
specs and ui
mensfeld Jul 31, 2023
66d866b
small remarks
mensfeld Jul 31, 2023
b67181c
remarks
mensfeld Jul 31, 2023
eca8ac8
remarks
mensfeld Jul 31, 2023
297bc0a
remarks
mensfeld Jul 31, 2023
e4b5086
non-pro remarks
mensfeld Jul 31, 2023
4ed5b7a
small remarks
mensfeld Jul 31, 2023
97d37ec
more better specs
mensfeld Jul 31, 2023
23cddf7
remarks
mensfeld Jul 31, 2023
fb87de0
specs
mensfeld Aug 1, 2023
3360ce7
remarks
mensfeld Aug 1, 2023
5da2b24
more specs and fixes
mensfeld Aug 1, 2023
aa3f011
more specs
mensfeld Aug 1, 2023
ea5b0b7
visibility filter and messages links
mensfeld Aug 3, 2023
1c943b9
more specs
mensfeld Aug 3, 2023
d5a2e3f
more specs
mensfeld Aug 3, 2023
789a91d
specs and remarks
mensfeld Aug 3, 2023
0170ce3
more specs
mensfeld Aug 3, 2023
d8c0dc7
more specs
mensfeld Aug 3, 2023
5a22e9f
more specs
mensfeld Aug 4, 2023
2803601
specs
mensfeld Aug 4, 2023
97a1d2d
contracts specs
mensfeld Aug 4, 2023
d741b05
compatibility manager
mensfeld Aug 4, 2023
0ec3276
remarks
mensfeld Aug 4, 2023
a88c8af
specs and ui
mensfeld Aug 4, 2023
38ac4f5
small ui remarks
mensfeld Aug 4, 2023
a49c9ef
fix message paginator
mensfeld Aug 4, 2023
368fc26
align naming conventions
mensfeld Aug 5, 2023
e0c5c15
remark
mensfeld Aug 5, 2023
4153ec5
remarks
mensfeld Aug 5, 2023
48e2efc
better defaults
mensfeld Aug 5, 2023
8d05589
more specs
mensfeld Aug 7, 2023
7720594
spec fix
mensfeld Aug 7, 2023
25913a3
more specs
mensfeld Aug 7, 2023
5f9b57f
more specs
mensfeld Aug 7, 2023
c10e70b
remarks
mensfeld Aug 7, 2023
1935033
typos
mensfeld Aug 7, 2023
bfc1eb2
more specs
mensfeld Aug 7, 2023
bd4d620
init manago specs
mensfeld Aug 7, 2023
6d75ad5
fix
mensfeld Aug 7, 2023
33c983e
sampler specs
mensfeld Aug 7, 2023
de13803
remarks
mensfeld Aug 7, 2023
fcd601f
increase cov
mensfeld Aug 7, 2023
535e734
fix spec
mensfeld Aug 7, 2023
ff208c3
remarks
mensfeld Aug 8, 2023
1b9943b
more specs and remarks
mensfeld Aug 9, 2023
2dbdcf8
remarks and specs
mensfeld Aug 9, 2023
fdf77d2
more specs
mensfeld Aug 9, 2023
837b229
remarks
mensfeld Aug 9, 2023
fd2fd43
remarks
mensfeld Aug 9, 2023
d27521f
more specs
mensfeld Aug 9, 2023
24687eb
add integration specs
mensfeld Aug 9, 2023
49cc114
more specs
mensfeld Aug 9, 2023
ba48600
a lot of specs
mensfeld Aug 9, 2023
dcfe945
non pro dashboard specs
mensfeld Aug 9, 2023
962e326
more specs
mensfeld Aug 9, 2023
bcdef92
more specs and better messaging
mensfeld Aug 10, 2023
0cd2654
specs and remarks
mensfeld Aug 10, 2023
3862514
remarks
mensfeld Aug 10, 2023
77482c5
run specs well
mensfeld Aug 10, 2023
1723928
remarks
mensfeld Aug 10, 2023
46909df
more specs
mensfeld Aug 10, 2023
2da403d
specs
mensfeld Aug 11, 2023
a704b6f
remarks
mensfeld Aug 11, 2023
d09c8fa
fix
mensfeld Aug 11, 2023
b717666
more specs
mensfeld Aug 11, 2023
96ba631
more specs
mensfeld Aug 11, 2023
bf1e419
rename high offsets to pace to match what it shows
mensfeld Aug 12, 2023
5ea5ff3
rename to topics pace
mensfeld Aug 12, 2023
052181f
dlq specs
mensfeld Aug 12, 2023
3963185
remarks
mensfeld Aug 13, 2023
c8771b6
more specs
mensfeld Aug 13, 2023
7ac9876
increase required code cov
mensfeld Aug 13, 2023
4867abe
missing specs
mensfeld Aug 14, 2023
f96c606
more specs
mensfeld Aug 14, 2023
caf4f01
missing spec
mensfeld Aug 14, 2023
4d1674f
more specs
mensfeld Aug 14, 2023
4cef52f
do not require render responde execution directly
mensfeld Aug 14, 2023
e938f26
specs and remarks
mensfeld Aug 14, 2023
4f8a6ba
remarks
mensfeld Aug 14, 2023
c229e7b
better coverage
mensfeld Aug 14, 2023
f76361a
upgrade
mensfeld Aug 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,31 @@ jobs:
- uses: actions/checkout@v3
- name: Install package dependencies
run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"

- name: Start Kafka with docker-compose
run: |
docker-compose up -d

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{matrix.ruby}}

- name: Install latest bundler
run: |
gem install bundler --no-document
bundle config set without 'tools benchmarks docs'

- name: Bundle install
run: |
bundle config set without development
bundle install --jobs 4 --retry 3

- name: Run all tests
env:
GITHUB_COVERAGE: ${{matrix.coverage}}
run: bundle exec rspec
KARAFKA_PRO_LICENSE_TOKEN: ${{ secrets.KARAFKA_PRO_LICENSE_TOKEN }}
run: bin/rspecs

diffend:
runs-on: ubuntu-latest
Expand Down
85 changes: 80 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,88 @@
# Karafka Web changelog

## 0.7.0 (Unreleased)
- **[Feature]** Introduce graphs.
- **[Feature]** Introduce historical metrics storage.
- **[Feature]** Introduce per-topic data exploration in the Explorer.
- **[Feature]** Introduce per-topic and per-partition most recent message view with live reload.
- **[Feature]** Introduce a new per-process inspection view called "Details" ti display all process real-time aggregated data.
- **[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.
- **[Feature]** Replace `decrypt` with a pluggable API for deciding which topics data to display.
- **[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.
- [Improvement] Collect total number of threads per process for the process details view.
- [Improvement] Normalize naming of metrics to better reflect what they do (in reports and in the Web UI).
- [Improvement] Link error reported first and last offset to the explorer.
- [Improvement] Expand routing details to compensate for nested values in declarative topics.
- [Improvement] Include last rebalance age in the health view per consumer group.
- [Improvement] Provide previous / next navigation when viewing particular messages in the explorer.
- [Improvement] Provide previous / next navigation when viewing particular errors.
- [Improvement] Link all explorable offsets to the explorer.
- [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.
- [Improvement] Extend status page checks to ensure, that it detects a case where there is no initial consumers metrics in Kafka topic.
- [Improvement] Report Rails version when viewing status page (if Rails used).
- [Improvement] List Web UI topics names on the status page in the info section.
- [Improvement] Start versioning the materialized states schemas.
- [Improvement] Drastically improve the consumers view performance.
- [Improvement] Ship versioned assets to prevent invalid assets loading due to cache.
- [Improvement] Use `Cache-Control` to cache all the static assets.
- [Improvement] Link `counters` counter to jobs page.
- [Improvement] Include a sticky footer with the most important links and copyrights.
- [Improvement] Store lag in counters for performance improvement and historical metrics.
- [Improvement] Move top navbar content to the left to gain space for new features.
- [Improvement] Introduce in-memory cluster state cached to improve performance.
- [Improvement] Switch to offset based pagination instead of per-page pagination.
- [Improvement] Avoid double-reading of watermark offsets for explorer and errors display.
- [Improvement] When no params needed for a page, do not include empty params.
- [Improvement] Do not include page when page is 1 in the url.
- [Improvement] Align descriptions for the status page, to reflect that state check happens for consumers initial state.
- [Improvement] Report bytesize of raw payload when viewing message in the explorer.
- [Improvement] Use zlib compression for Karafka Web UI topics reports (all). Reduces space needed from 50 to 91%.
- [Improvement] Rename lag to lag stored in counters to reflect what it does.
- [Improvement] Collect both stored lag and lag.
- [Improvement] Introduce states and metrics schema validation.
- [Improvement] Prevent locking in sampler for time of OS data aggregation.
- [Improvement] Collect and report number of messages in particular jobs.
- [Improvement] Limit segment size for Web topics to ensure, that Web-UI does not drain resources.
- [Fix] Return 402 status instead of 500 on Pro features that are not available in OSS.
- [Fix] Fix a case where errors would not be visible without Rails due to the `String#first` usage.
- [Fix] Fix a case where live-poll would be disabled but would still update data.
- [Fix] Fix a case where states materializing consumer would update state too often.
- [Fix] Fix a bug when rapid non-initialized shutdown could mess up the metrics.
- [Fix] Fix a case where upon multiple rebalances, part of the states materialization could be lost.
- [Fix] Make sure, that the flushing interval computation division happens with float.
- [Fix] Fix a case where app client id change could force web-ui to recompute the metrics.
- [Fix] Make sure, that when re-using same Karafka Web-UI topics as a different up, all states and reports are not recomputed back.
- [Fix] Fix headers size inconsistency between Health and Routing.
- [Fix] Fix invalid padding on status page.
- [Fix] Fix a case where root mounted Karafka Web-UI would not work.
- [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.
- [Refactor] Limit usage of UI models for data intense computation to speed up states materialization under load.
- [Refactor] Reorganize pagination engine to support offset based pagination.
- [Refactor] Use Roda `custom_block_results` plugin for controllers results handling.
- [Maintenance] Require `karafka` `2.1.8` due to fixes in the Iterator API and routing API extensions.

### Upgrade Notes

This is a **major** release that brings many things to the table.

#### Deployment

Because of the reporting schema update and new web-ui topics introduction, it is recommended to:

1. Upgrade the codebase based on the below details.
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.
3. Run a migration command: `bundle exec karafka-web migrate` that will create missing states and missing topics.
4. Deploy **all** the Karafka consumer processes (`karafka server`).
5. Deploy the Web update to your web server and check that everything is OK by visiting the status page.

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.

#### Code and API changes

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.
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.
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.
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.

## 0.6.3 (2023-07-22)
- [Fix] Remove files from 0.7.0 accidentally added to the release.
Expand Down Expand Up @@ -46,7 +121,7 @@
- [Refactor] Remove not used and redundant partials.
- [Maintenance] Require `karafka` `2.1.4` due to fixes in metrics usage for workless flows.

### Upgrade notes
### Upgrade Notes

Because of the reporting schema update, it is recommended to:

Expand Down Expand Up @@ -94,7 +169,7 @@ Please make sure **not** to do it for the default `Karafka.producer` because it
- [Fix] Fix misspelling of word `committed`.
- [Fix] Shutdown and revocation jobs statistics extraction crashes when idle initialized without messages (#53)

### Upgrade notes
### Upgrade Notes

Because of the reporting schema change, it is recommended to:

Expand All @@ -115,7 +190,7 @@ Please note that if you decide to use the updated Web UI with not updated consum
- [Fix] Add missing support for using multiple subscription groups within a single consumer group.
- [Fix] Mask SASL credentials in topic routing view (#46)

### Upgrade notes
### Upgrade Notes

Because of the reporting schema change, it is recommended to:

Expand All @@ -129,7 +204,7 @@ Please note that if you decide to use the updated Web UI with not updated consum
- [Fix] Fix display of compacted messages placeholders for offsets lower than low watermark.
- [Fix] Fix invalid pagination per page count.

### Upgrade notes
### Upgrade Notes

If upgrading from `0.3.0`, nothing.

Expand All @@ -154,7 +229,7 @@ If upgrading from lower, please follow `0.3.0` upgrade procedure.
- [Maintenance] Remove compatibility fallbacks for job and process tags (#1342)
- [Maintenance] Extract base sampler for tracking and web.

### Upgrade notes
### Upgrade Notes

Because of the removal of compatibility fallbacks for some metrics fetches, it is recommended to:

Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ gemspec
group :test do
gem 'byebug'
gem 'factory_bot'
gem 'rack-test'
gem 'rspec'
gem 'simplecov'
end
43 changes: 23 additions & 20 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
PATH
remote: .
specs:
karafka-web (0.6.2)
karafka-web (0.7.0)
erubi (~> 1.4)
karafka (>= 2.1.4, < 3.0.0)
karafka (>= 2.1.8, < 3.0.0)
karafka-core (>= 2.0.13, < 3.0.0)
roda (~> 3.68, >= 3.68)
roda (~> 3.68, >= 3.69)
tilt (~> 2.0)

GEM
remote: https://rubygems.org/
specs:
activesupport (7.0.4.3)
activesupport (7.0.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand All @@ -24,28 +24,30 @@ GEM
factory_bot (6.2.1)
activesupport (>= 5.0.0)
ffi (1.15.5)
i18n (1.13.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
karafka (2.1.4)
karafka-core (>= 2.0.13, < 3.0.0)
karafka (2.1.8)
karafka-core (>= 2.1.1, < 2.2.0)
thor (>= 0.20)
waterdrop (>= 2.5.3, < 3.0.0)
waterdrop (>= 2.6.2, < 3.0.0)
zeitwerk (~> 2.3)
karafka-core (2.0.13)
karafka-core (2.1.1)
concurrent-ruby (>= 1.1)
karafka-rdkafka (>= 0.12.3)
karafka-rdkafka (0.12.3)
karafka-rdkafka (>= 0.13.1, < 0.14.0)
karafka-rdkafka (0.13.3)
ffi (~> 1.15)
mini_portile2 (~> 2.6)
rake (> 12)
mini_portile2 (2.8.2)
minitest (5.18.0)
rack (3.0.7)
mini_portile2 (2.8.4)
minitest (5.18.1)
rack (3.0.8)
rack-test (2.1.0)
rack (>= 1.3)
rackup (0.2.3)
rack (>= 3.0.0.beta1)
webrick
rake (13.0.6)
roda (3.68.0)
roda (3.70.0)
rack
rspec (3.12.0)
rspec-core (~> 3.12.0)
Expand All @@ -56,22 +58,22 @@ GEM
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.5)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rspec-support (3.12.1)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
thor (1.2.2)
tilt (2.1.0)
tilt (2.2.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
waterdrop (2.5.3)
karafka-core (>= 2.0.13, < 3.0.0)
waterdrop (2.6.5)
karafka-core (>= 2.1.1, < 3.0.0)
zeitwerk (~> 2.3)
webrick (1.8.1)
zeitwerk (2.6.8)
Expand All @@ -83,6 +85,7 @@ DEPENDENCIES
byebug
factory_bot
karafka-web!
rack-test
rackup (~> 0.2)
rspec
simplecov
Expand Down
6 changes: 6 additions & 0 deletions bin/rspecs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

set -e

SPECS_TYPE=regular bundle exec rspec --exclude-pattern "**/pro/**/*_spec.rb"
SPECS_TYPE=pro bundle exec rspec --pattern "**/pro/**/*_spec.rb"
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '2'
services:
zookeeper:
container_name: karafka_web_21_zookeeper
image: wurstmeister/zookeeper
restart: on-failure
ports:
- '2181:2181'

kafka:
container_name: karafka_web_21_kafka
image: wurstmeister/kafka
ports:
- '9092:9092'
environment:
KAFKA_ADVERTISED_HOST_NAME: localhost
KAFKA_ADVERTISED_PORT: 9092
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
volumes:
- /var/run/docker.sock:/var/run/docker.sock
restart: on-failure
4 changes: 2 additions & 2 deletions karafka-web.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Gem::Specification.new do |spec|
spec.licenses = %w[LGPL-3.0 Commercial]

spec.add_dependency 'erubi', '~> 1.4'
spec.add_dependency 'karafka', '>= 2.1.4', '< 3.0.0'
spec.add_dependency 'karafka', '>= 2.1.8', '< 3.0.0'
spec.add_dependency 'karafka-core', '>= 2.0.13', '< 3.0.0'
spec.add_dependency 'roda', '~> 3.68', '>= 3.68'
spec.add_dependency 'roda', '~> 3.68', '>= 3.69'
spec.add_dependency 'tilt', '~> 2.0'

spec.add_development_dependency 'rackup', '~> 0.2'
Expand Down
1 change: 1 addition & 0 deletions lib/karafka/web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
roda
etc
open3
zlib
].each { |lib| require lib }

module Karafka
Expand Down
Loading