Sha256: 5018251042900690a2e14b86e189df2f26bd9c7f80ed3a890a84654b6640c4ec

Contents?: true

Size: 801 Bytes

Versions: 9

Compression:

Stored size: 801 Bytes

Contents

# frozen_string_literal: true

module Sentry
  class Session
    attr_reader :started, :status

    # 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
    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

    # truncate seconds from the timestamp since we only care about
    # minute level granularity for aggregation
    def aggregation_key
      Time.utc(started.year, started.month, started.day, started.hour, started.min)
    end

    def deep_dup
      dup
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
sentry-ruby-5.4.2 lib/sentry/session.rb
sentry-ruby-core-5.4.2 lib/sentry/session.rb
sentry-ruby-5.4.1 lib/sentry/session.rb
sentry-ruby-core-5.4.1 lib/sentry/session.rb
sentry-ruby-core-5.4.0 lib/sentry/session.rb
sentry-ruby-core-5.3.1 lib/sentry/session.rb
sentry-ruby-core-5.3.0 lib/sentry/session.rb
sentry-ruby-core-5.2.1 lib/sentry/session.rb
sentry-ruby-core-5.2.0 lib/sentry/session.rb