Class: Karafka::Web::Pro::Ui::Controllers::Topics::OffsetsController
- Inherits:
-
BaseController
- Object
- Ui::Controllers::BaseController
- BaseController
- BaseController
- Karafka::Web::Pro::Ui::Controllers::Topics::OffsetsController
- Defined in:
- lib/karafka/web/pro/ui/controllers/topics/offsets_controller.rb
Overview
Controller responsible for viewing topics offsets details
Constant Summary
Constants inherited from Ui::Controllers::BaseController
Ui::Controllers::BaseController::Models
Instance Attribute Summary
Attributes inherited from Ui::Controllers::BaseController
Instance Method Summary collapse
-
#show(topic_name) ⇒ Object
Displays high and low offsets for given topic.
Methods inherited from Ui::Controllers::BaseController
Methods included from Ui::Controllers::Requests::Hookable
included, #run_after_hooks, #run_before_hooks
Constructor Details
This class inherits a constructor from Karafka::Web::Ui::Controllers::BaseController
Instance Method Details
#show(topic_name) ⇒ Object
Displays high and low offsets for given topic
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/karafka/web/pro/ui/controllers/topics/offsets_controller.rb', line 49 def show(topic_name) @topic = Models::Topic.find(topic_name) @active_partitions, _materialized_page, @limited = Paginators::Partitions.call( @topic.partition_count, @params.current_page ) all_offsets = Admin.read_watermark_offsets(topic_name => @active_partitions) offsets = @active_partitions.map do |partition_id| part_offsets = all_offsets.fetch(topic_name).fetch(partition_id) { partition_id: partition_id, low: part_offsets.first, high: part_offsets.last, diff: part_offsets.last - part_offsets.first } end @offsets = refine(offsets) next_page = @active_partitions.last < @topic.partition_count - 1 paginate(@params.current_page, next_page) render end |