Class: Sentry::Session

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeSession

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_keyObject (readonly)

Returns the value of attribute aggregation_key.



5
6
7
# File 'lib/sentry/session.rb', line 5

def aggregation_key
  @aggregation_key
end

#startedObject (readonly)

Returns the value of attribute started.



5
6
7
# File 'lib/sentry/session.rb', line 5

def started
  @started
end

#statusObject (readonly)

Returns the value of attribute status.



5
6
7
# File 'lib/sentry/session.rb', line 5

def status
  @status
end

Instance Method Details

#closeObject



25
26
27
# File 'lib/sentry/session.rb', line 25

def close
  @status = :exited if @status == :ok
end

#deep_dupObject



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