Class: Karafka::Web::Pro::Ui::Controllers::ErrorsController

Inherits:
BaseController show all
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 Method Summary collapse

Methods inherited from Ui::Controllers::BaseController

#initialize

Constructor Details

This class inherits a constructor from Karafka::Web::Ui::Controllers::BaseController

Instance Method Details

#indexObject

Lists all the errors from all the partitions



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/karafka/web/pro/ui/controllers/errors_controller.rb', line 22

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

Parameters:

  • partition_id (Integer)

    id of the partition of errors we are interested in



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/karafka/web/pro/ui/controllers/errors_controller.rb', line 40

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,
    @error_messages.map(&:offset)
  )

  render
end

#show(partition_id, offset) ⇒ Object

Shows given error details

Parameters:

  • partition_id (Integer)
  • offset (Integer)


67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/karafka/web/pro/ui/controllers/errors_controller.rb', line 67

def show(partition_id, offset)
  @partition_id = partition_id
  @offset = offset
  @error_message = Models::Message.find(
    errors_topic,
    @partition_id,
    @offset
  )

  watermark_offsets = Models::WatermarkOffsets.find(errors_topic, partition_id)
  paginate(offset, watermark_offsets.low, watermark_offsets.high)

  render
end