Class: RailsObservatory::ErrorsController
Instance Method Summary
collapse
#duration, #set_duration, #set_time_range
Instance Method Details
#index ⇒ Object
6
7
8
9
10
11
12
13
|
# File 'app/controllers/rails_observatory/errors_controller.rb', line 6
def index
Error.ensure_index
@errors = Error.all
@series_by_fingerprint = TimeSeries.where(name: "error.count", fingerprint: @errors.map(&:fingerprint))
.downsample(12, using: :sum)
.index_by { _1.labels[:fingerprint] }
@count_by_fingerprint = TimeSeries.where(name: "error.count", fingerprint: @errors.map(&:fingerprint)).group(:fingerprint).sum
end
|
#show ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/controllers/rails_observatory/errors_controller.rb', line 15
def show
@time_range = (1.hour.ago..)
@error = Error.find(params[:id])
series = TimeSeries.where(name: "error.count", fingerprint: @error.fingerprint)
.downsample(24, using: :sum)
@count = TimeSeries.where(name: "error.count", fingerprint: @error.fingerprint).slice(2.years.ago..).downsample(1, using: :sum).first.value
@past_24_hours = series.slice(24.hours.ago..).first
@past_7_days = series.slice(7.days.ago..).first
@past_30_days = series.slice(30.days.ago..).first
end
|