Class: RoundhouseUi::ErrorGroups
- Inherits:
-
Object
- Object
- RoundhouseUi::ErrorGroups
- Defined in:
- lib/roundhouse_ui/error_groups.rb
Overview
Groups failing jobs across the retry + dead sets (and the sidekiq-failures
failed set, when opted in) by a fingerprint of job class + error class —
so one bad deploy reads as a single issue with a count, not thousands of
identical rows. Used by the Errors page and the dashboard's "top failing"
panel, so the aggregation lives here rather than in a controller.
Defined Under Namespace
Classes: Result
Constant Summary collapse
- DEFAULT_SCAN_LIMIT =
cap entries scanned per pass; surfaced honestly
1_000
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(query: nil, limit: DEFAULT_SCAN_LIMIT) ⇒ ErrorGroups
constructor
A new instance of ErrorGroups.
Constructor Details
#initialize(query: nil, limit: DEFAULT_SCAN_LIMIT) ⇒ ErrorGroups
Returns a new instance of ErrorGroups.
14 15 16 17 |
# File 'lib/roundhouse_ui/error_groups.rb', line 14 def initialize(query: nil, limit: DEFAULT_SCAN_LIMIT) @query = query.to_s.strip @limit = limit end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/roundhouse_ui/error_groups.rb', line 19 def call groups = {} scanned = 0 truncated = false sources.each do |source, set| set.each do |entry| scanned += 1 if scanned > @limit truncated = true break end record(groups, source, entry) end break if truncated end list = groups.values.sort_by { |g| -g[:count] } list = list.select { |g| "#{g[:klass]} #{g[:error]}".downcase.include?(@query.downcase) } if @query.present? Result.new(groups: list, scanned: scanned, truncated: truncated) end |