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

Fix partitions display and limit cache in non-prod #128

Merged
merged 3 commits into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

## 0.7.2 (Unreleased)
- [Improvement] Display hidden by accident errors for OSS metrics.
- [Improvement] Use a five second cache for non-production environments to improve dev experience.
- [Improvement] Limit number of partitions listed on the Consumers view if they exceed 10 to improve readability and indicate, that there are more in OSS similar to Pro.

## 0.7.1 (2023-09-15)
- [Improvement] Limit number of partitions listed on the Consumers view if they exceed 10 to improve readability and indicate, that there are more.
- [Improvement] Limit number of partitions listed on the Consumers view if they exceed 10 to improve readability and indicate, that there are more in Pro.
- [Improvement] Make sure, that small messages size (less than 100 bytes) is correctly displayed.
- [Fix] Validate refresh time.
- [Fix] Fix invalid message payload size display (KB instead of B, etc).
Expand Down
6 changes: 5 additions & 1 deletion lib/karafka/web/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ class Config
end

# UI cache to improve performance of views that reuse states that are not often changed
setting :cache, default: Ui::Lib::TtlCache.new(60_000 * 5)
setting :cache, default: Ui::Lib::TtlCache.new(
# Use the TTL for internal cache in prod but invalidate quickly in other environments,
# as for example in development things may change frequently
Karafka.env.production? ? 60_000 * 5 : 5_000
)

# Should we display internal topics of Kafka. The once starting with `__`
# By default we do not display them as they are not usable from regular users perspective
Expand Down
6 changes: 5 additions & 1 deletion lib/karafka/web/ui/views/consumers/_consumer.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
<% subscription_group.topics.each do |topic| %>
<span class="badge bg-secondary badge-topic" title="Consumer group: <%= consumer_group.id %>">
<%= topic.name %>:
<%= topic.partitions.map(&:id).join(',') %>
<% if topic.partitions.size > 10 %>
<%= "#{topic.partitions.first(10).map(&:id).join(',')}..." %>
<% else %>
<%= topic.partitions.map(&:id).join(',') %>
<% end %>
</span>
<% end %>
<% end %>
Expand Down