Class: SentryErrorPresenter

Inherits:
Gitlab::View::Presenter::Delegated show all
Defined in:
app/presenters/sentry_error_presenter.rb

Defined Under Namespace

Classes: FrequencyStruct

Instance Method Summary collapse

Methods inherited from Gitlab::View::Presenter::Delegated

#initialize

Methods included from Gitlab::Utils::DelegatorOverride

#delegator_override, #delegator_override_with, #delegator_target, validator, validators, verify!

Methods included from Gitlab::View::Presenter::Base

#__subject__, #can?, #declarative_policy_delegate, #is_a?, #path_with_line_numbers, #present, #url_builder, #web_path, #web_url

Methods included from Gitlab::Allowable

#can?

Methods included from Gitlab::Routing

includes_helpers, redirect_legacy_paths, url_helpers

Constructor Details

This class inherits a constructor from Gitlab::View::Presenter::Delegated

Instance Method Details

#first_seenObject



8
9
10
# File 'app/presenters/sentry_error_presenter.rb', line 8

def first_seen
  DateTime.parse(error.first_seen)
end

#frequencyObject



20
21
22
23
24
25
26
# File 'app/presenters/sentry_error_presenter.rb', line 20

def frequency
  utc_offset = Time.zone_offset('UTC')

  error.frequency.map do |f|
    FrequencyStruct.new(time: Time.at(f[0], in: utc_offset), count: f[1])
  end
end

#last_seenObject



12
13
14
# File 'app/presenters/sentry_error_presenter.rb', line 12

def last_seen
  DateTime.parse(error.last_seen)
end

#project_idObject



16
17
18
# File 'app/presenters/sentry_error_presenter.rb', line 16

def project_id
  Gitlab::GlobalId.build(model_name: 'SentryProject', id: error.project_id).to_s
end