Skip to content

Commit

Permalink
fix missing stored lag reference in OSS consumers (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
mensfeld authored May 3, 2024
1 parent ed43d65 commit 0b7a03e
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Karafka Web changelog

## 0.9.1 (2024-05-03)
- [Fix] OSS `lag_stored` for not-subscribed consumers causes Web UI to crash.

## 0.9.0 (2024-04-26)
- **[Breaking]** Drop Ruby `2.7` support.
- **[Feature]** Provide ability to stop and quiet running consumers (Pro).
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
karafka-web (0.9.0)
karafka-web (0.9.1)
erubi (~> 1.4)
karafka (>= 2.4.0, < 2.5.0)
karafka-core (>= 2.4.0, < 2.5.0)
Expand Down
2 changes: 1 addition & 1 deletion lib/karafka/web/ui/views/consumers/_consumer.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@
</td>

<td>
<%= process.lag_stored %>
<%= process.lag_hybrid %>
</td>
</tr>
2 changes: 1 addition & 1 deletion lib/karafka/web/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
module Karafka
module Web
# Current gem version
VERSION = '0.9.0'
VERSION = '0.9.1'
end
end
29 changes: 29 additions & 0 deletions spec/lib/karafka/web/ui/controllers/consumers_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,35 @@
end
end

context 'when there is an active consumer but without any partitions assigned yet' do
before do
topics_config.consumers.states = states_topic
topics_config.consumers.reports = reports_topic

report = Fixtures.consumers_reports_json
scope = report[:consumer_groups][:example_app6_app][:subscription_groups][:c4ca4238a0b9_0]
scope[:topics].clear

produce(states_topic, Fixtures.consumers_states_file)
produce(reports_topic, report.to_json)

get 'consumers'
end

it do
expect(response).to be_ok
expect(body).not_to include('partitions: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9')
expect(body).to include(support_message)
expect(body).not_to include(breadcrumbs)
expect(body).not_to include(no_processes)
expect(body).not_to include(pagination)
expect(body).to include('246 MB')
expect(body).to include('shinra:1:1')
expect(body).to include('/consumers/shinra:1:1/subscriptions')
expect(body).to include('2690818651.82293')
end
end

context 'when there are active consumers with many partitions assigned' do
before do
topics_config.consumers.states = states_topic
Expand Down

0 comments on commit 0b7a03e

Please sign in to comment.