Class: Sentry::Session
- Inherits:
-
Object
- Object
- Sentry::Session
- Defined in:
- lib/sentry/session.rb
Constant Summary collapse
- STATUSES =
TODO-neel add :crashed after adding handled mechanism
%i[ok errored exited]
- AGGREGATE_STATUSES =
%i[errored exited]
Instance Attribute Summary collapse
-
#aggregation_key ⇒ Object
readonly
Returns the value of attribute aggregation_key.
-
#started ⇒ Object
readonly
Returns the value of attribute started.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #close ⇒ Object
- #deep_dup ⇒ Object
-
#initialize ⇒ Session
constructor
A new instance of Session.
-
#update_from_exception(_exception = nil) ⇒ Object
TODO-neel add :crashed after adding handled mechanism.
Constructor Details
#initialize ⇒ Session
Returns a new instance of Session.
11 12 13 14 15 16 17 18 |
# File 'lib/sentry/session.rb', line 11 def initialize @started = Sentry.utc_now @status = :ok # truncate seconds from the timestamp since we only care about # minute level granularity for aggregation @aggregation_key = Time.utc(@started.year, @started.month, @started.day, @started.hour, @started.min) end |
Instance Attribute Details
#aggregation_key ⇒ Object (readonly)
Returns the value of attribute aggregation_key.
5 6 7 |
# File 'lib/sentry/session.rb', line 5 def aggregation_key @aggregation_key end |
#started ⇒ Object (readonly)
Returns the value of attribute started.
5 6 7 |
# File 'lib/sentry/session.rb', line 5 def started @started end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/sentry/session.rb', line 5 def status @status end |
Instance Method Details
#close ⇒ Object
25 26 27 |
# File 'lib/sentry/session.rb', line 25 def close @status = :exited if @status == :ok end |
#deep_dup ⇒ Object
29 30 31 |
# File 'lib/sentry/session.rb', line 29 def deep_dup dup end |
#update_from_exception(_exception = nil) ⇒ Object
TODO-neel add :crashed after adding handled mechanism
21 22 23 |
# File 'lib/sentry/session.rb', line 21 def update_from_exception(_exception = nil) @status = :errored end |