Class: Karafka::Web::Pro::Ui::Controllers::ErrorsController
- Inherits:
-
BaseController
- Object
- Ui::Controllers::BaseController
- BaseController
- Karafka::Web::Pro::Ui::Controllers::ErrorsController
- Defined in:
- lib/karafka/web/pro/ui/controllers/errors_controller.rb
Overview
Errors details controller
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
-
#index ⇒ Object
Lists all the errors from all the partitions.
- #partition(partition_id) ⇒ Object
-
#show(partition_id, offset) ⇒ Object
Shows given error details.
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
#index ⇒ Object
Lists all the errors from all the partitions
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/karafka/web/pro/ui/controllers/errors_controller.rb', line 14 def index @topic_id = errors_topic @partitions_count = Models::ClusterInfo.partitions_count(errors_topic) @active_partitions, materialized_page, @limited = Paginators::Partitions.call( @partitions_count, @params.current_page ) @error_messages, next_page = Models::Message.topic_page( errors_topic, @active_partitions, materialized_page ) paginate(@params.current_page, next_page) render end |
#partition(partition_id) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/karafka/web/pro/ui/controllers/errors_controller.rb', line 32 def partition(partition_id) @topic_id = errors_topic @partition_id = partition_id @watermark_offsets = Models::WatermarkOffsets.find(errors_topic, @partition_id) @partitions_count = Models::ClusterInfo.partitions_count(errors_topic) previous_offset, @error_messages, next_offset = Models::Message.offset_page( errors_topic, @partition_id, @params.current_offset, @watermark_offsets ) paginate( previous_offset, @params.current_offset, next_offset, # If message is an array, it means it's a compacted dummy offset representation @error_messages.map { || .is_a?(Array) ? .last : .offset } ) render end |
#show(partition_id, offset) ⇒ Object
Shows given error details
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/karafka/web/pro/ui/controllers/errors_controller.rb', line 60 def show(partition_id, offset) @partition_id = partition_id @offset = offset watermark_offsets = Models::WatermarkOffsets.find(errors_topic, partition_id) @error_message = Models::Message.find( errors_topic, partition_id, offset, watermark_offsets: watermark_offsets ) paginate(offset, watermark_offsets.low, watermark_offsets.high) render end |