Sha256: 91690d5ec5bfb661646d29abfc03dfa36f5e7072b2ca67dc0bab1cdd8c238fba

Contents?: true

Size: 815 Bytes

Versions: 30

Compression:

Stored size: 815 Bytes

Contents

# frozen_string_literal: true

module Sentry
  class Session
    attr_reader :started, :status, :aggregation_key

    # TODO-neel add :crashed after adding handled mechanism
    STATUSES = %i[ok errored exited]
    AGGREGATE_STATUSES = %i[errored exited]

    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

    # TODO-neel add :crashed after adding handled mechanism
    def update_from_exception(_exception = nil)
      @status = :errored
    end

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

    def deep_dup
      dup
    end
  end
end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
sentry-ruby-5.22.3 lib/sentry/session.rb
sentry-ruby-core-5.22.3 lib/sentry/session.rb
sentry-ruby-core-5.22.2 lib/sentry/session.rb
sentry-ruby-5.22.2 lib/sentry/session.rb
sentry-ruby-core-5.22.1 lib/sentry/session.rb
sentry-ruby-5.22.1 lib/sentry/session.rb
sentry-ruby-5.22.0 lib/sentry/session.rb
sentry-ruby-core-5.22.0 lib/sentry/session.rb
sentry-ruby-5.21.0 lib/sentry/session.rb
sentry-ruby-core-5.21.0 lib/sentry/session.rb
sentry-ruby-5.20.1 lib/sentry/session.rb
sentry-ruby-core-5.20.1 lib/sentry/session.rb
sentry-ruby-5.20.0 lib/sentry/session.rb
sentry-ruby-core-5.20.0 lib/sentry/session.rb
sentry-ruby-core-5.19.0 lib/sentry/session.rb
sentry-ruby-5.19.0 lib/sentry/session.rb
sentry-ruby-core-5.18.2 lib/sentry/session.rb
sentry-ruby-5.18.2 lib/sentry/session.rb
sentry-ruby-core-5.18.1 lib/sentry/session.rb
sentry-ruby-5.18.1 lib/sentry/session.rb