Class: Karafka::Web::Ui::Pro::Controllers::Errors

Inherits:
Controllers::Base show all
Includes:
Lib::Paginations
Defined in:
lib/karafka/web/ui/pro/controllers/errors.rb

Overview

Errors details controller

Instance Method Summary collapse

Methods inherited from Controllers::Base

#initialize

Constructor Details

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

Instance Method Details

#indexObject

Lists all the errors from all the partitions



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

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



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

def partition(partition_id)
  @partition_id = partition_id
  @watermark_offsets = Ui::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)


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

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

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

  render
end