Class: RoundhouseUi::Day

Inherits:
Struct
  • Object
show all
Defined in:
lib/roundhouse_ui/history.rb

Overview

Daily processed and failed counts, for the one question every other number on the dashboard cannot answer: is this normal?

30,655 failures is alarming or unremarkable depending on the day, and a live throughput chart that starts empty on every page load cannot tell you which.

Sidekiq already records this — Sidekiq::Stats::History keeps a counter per day and Roundhouse ignored it entirely. So this needs no storage of its own, no migration, and it works on every Sidekiq install. See #61.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dateObject

Returns the value of attribute date

Returns:

  • (Object)

    the current value of date



11
12
13
# File 'lib/roundhouse_ui/history.rb', line 11

def date
  @date
end

#failedObject

Returns the value of attribute failed

Returns:

  • (Object)

    the current value of failed



11
12
13
# File 'lib/roundhouse_ui/history.rb', line 11

def failed
  @failed
end

#processedObject

Returns the value of attribute processed

Returns:

  • (Object)

    the current value of processed



11
12
13
# File 'lib/roundhouse_ui/history.rb', line 11

def processed
  @processed
end

Instance Method Details

#failure_rateObject

Share of the day's work that failed. The line worth drawing: counts move with traffic, so a busy Monday looks worse than a quiet Sunday even when nothing changed. A rate does not.



15
16
17
18
19
20
# File 'lib/roundhouse_ui/history.rb', line 15

def failure_rate
  total = processed.to_i + failed.to_i
  return 0.0 if total.zero?

  failed.to_i / total.to_f
end

#quiet?Boolean

Returns:

  • (Boolean)


22
# File 'lib/roundhouse_ui/history.rb', line 22

def quiet? = processed.to_i.zero? && failed.to_i.zero?