Skip to content

Commit

Permalink
Merge branch 'master' into 141
Browse files Browse the repository at this point in the history
  • Loading branch information
mensfeld committed Sep 27, 2023
2 parents 327a8a9 + 509931a commit 8150942
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- **[Feature]** Introduce ability to download raw payloads.
- **[Feature]** Introduce ability to download deserialized message payload as JSON.
- [Enhancement] Update order of topics creation for the setup of Web to support zero-downtime setup of Web in running Karafka projects.
- [Enhancement] Add space delimiter to counters numbers to make them look better.
- [Fix] Fix a case where charts aggregated data would not include all topics.
- [Fix] Make sure, that most recent per partition data for Health is never overwritten by an old state from a previous partition owner.
- [Fix] Cache assets for 1 year instead of 7 days.
Expand Down
5 changes: 3 additions & 2 deletions lib/karafka/web/ui/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,13 @@ def format_memory(mem_kb)

# Converts number to a more friendly delimiter based version
# @param number [Numeric]
# @param delimiter [String] delimiter (comma by default)
# @return [String] number with delimiter
def number_with_delimiter(number)
def number_with_delimiter(number, delimiter = ',')
return '' unless number

parts = number.to_s.to_str.split('.')
parts[0].gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, '\1,')
parts[0].gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{delimiter}")
parts.join('.')
end

Expand Down
32 changes: 24 additions & 8 deletions lib/karafka/web/ui/pro/views/consumers/_counters.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,56 @@
<div class="col-sm-12">
<ul class="list-unstyled row text-center mb-0 mt-0">
<li class="col-sm">
<div class="count mb-1"><%= @counters.messages %></div>
<div class="count mb-1">
<%= number_with_delimiter @counters.messages, ' ' %>
</div>
<div class="desc">Messages</div>
</li>
<li class="col-sm">
<div class="count mb-1"><%= @counters.batches %></div>
<div class="count mb-1">
<%= number_with_delimiter @counters.batches, ' ' %>
</div>
<div class="desc">Batches</div>
</li>
<li class="col-sm">
<div class="count mb-1"><%= @counters.lag_stored %></div>
<div class="count mb-1">
<%= number_with_delimiter @counters.lag_stored, ' ' %>
</div>
<div class="desc">Lag stored</div>
</li>
<li class="col-sm">
<a href="<%= root_path('jobs') %>">
<div class="count mb-1"><%= @counters.busy %></div>
<div class="count mb-1">
<%= number_with_delimiter @counters.busy, ' ' %>
</div>
<div class="desc">Busy</div>
</a>
</li>
<li class="col-sm">
<div class="count mb-1"><%= @counters.enqueued %></div>
<div class="count mb-1">
<%= number_with_delimiter @counters.enqueued, ' ' %>
</div>
<div class="desc">Enqueued</div>
</li>
<li class="col-sm">
<a href="<%= root_path('errors') %>">
<div class="count mb-1"><%= @counters.errors %></div>
<div class="count mb-1">
<%= number_with_delimiter @counters.errors, ' ' %>
</div>
<div class="desc">Errors</div>
</a>
</li>
<li class="col-sm">
<div class="count mb-1"><%= @counters.retries %></div>
<div class="count mb-1">
<%= number_with_delimiter @counters.retries, ' ' %>
</div>
<div class="desc">Retries</div>
</li>
<li class="col-sm">
<a href="<%= root_path('dlq') %>">
<div class="count mb-1"><%= @counters.dead %></div>
<div class="count mb-1">
<%= number_with_delimiter @counters.dead, ' ' %>
</div>
<div class="desc">Dead</div>
</a>
</li>
Expand Down
28 changes: 21 additions & 7 deletions lib/karafka/web/ui/views/consumers/_counters.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,49 @@
<div class="col-sm-12">
<ul class="list-unstyled row text-center mb-0 mt-0">
<li class="col-sm">
<div class="count mb-1"><%= @counters.messages %></div>
<div class="count mb-1">
<%= number_with_delimiter @counters.messages, ' ' %>
</div>
<div class="desc">Messages</div>
</li>
<li class="col-sm">
<div class="count mb-1"><%= @counters.batches %></div>
<div class="count mb-1">
<%= number_with_delimiter @counters.batches, ' ' %>
</div>
<div class="desc">Batches</div>
</li>
<li class="col-sm">
<div class="count mb-1"><%= @counters.lag_stored %></div>
<div class="count mb-1">
<%= number_with_delimiter @counters.lag_stored, ' ' %>
</div>
<div class="desc">Lag stored</div>
</li>
<li class="col-sm">
<a href="<%= root_path('jobs') %>">
<div class="count mb-1"><%= @counters.busy %></div>
<div class="count mb-1">
<%= number_with_delimiter @counters.busy, ' ' %>
</div>
<div class="desc">Busy</div>
</a>
</li>
<li class="col-sm">
<div class="count mb-1"><%= @counters.enqueued %></div>
<div class="count mb-1">
<%= number_with_delimiter @counters.enqueued, ' ' %>
</div>
<div class="desc">Enqueued</div>
</li>
<li class="col-sm">
<a href="<%= root_path('errors') %>">
<div class="count mb-1"><%= @counters.errors %></div>
<div class="count mb-1">
<%= number_with_delimiter @counters.errors, ' ' %>
</div>
<div class="desc">Errors</div>
</a>
</li>
<li class="col-sm">
<div class="count mb-1"><%= @counters.retries %></div>
<div class="count mb-1">
<%= number_with_delimiter @counters.retries, ' ' %>
</div>
<div class="desc">Retries</div>
</li>
</ul>
Expand Down

0 comments on commit 8150942

Please sign in to comment.