Sha256: 2fafd9f74225974351d7a5254e8856c574f6a2ec8ce3f13b032ccd06217e6c86

Contents?: true

Size: 1.13 KB

Versions: 69

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

module Sentry
  class ThreadsInterface
    # @param crashed [Boolean]
    # @param stacktrace [Array]
    def initialize(crashed: false, stacktrace: nil)
      @id = Thread.current.object_id
      @name = Thread.current.name
      @current = true
      @crashed = crashed
      @stacktrace = stacktrace
    end

    # @return [Hash]
    def to_hash
      {
        values: [
          {
            id: @id,
            name: @name,
            crashed: @crashed,
            current: @current,
            stacktrace: @stacktrace&.to_hash
          }
        ]
      }
    end

    # Builds the ThreadsInterface with given backtrace and stacktrace_builder.
    # Patch this method if you want to change a threads interface's stacktrace frames.
    # @see StacktraceBuilder.build
    # @param backtrace [Array]
    # @param stacktrace_builder [StacktraceBuilder]
    # @param crashed [Hash]
    # @return [ThreadsInterface]
    def self.build(backtrace:, stacktrace_builder:, **options)
      stacktrace = stacktrace_builder.build(backtrace: backtrace) if backtrace
      new(**options, stacktrace: stacktrace)
    end
  end
end

Version data entries

69 entries across 69 versions & 2 rubygems

Version Path
sentry-ruby-5.17.0 lib/sentry/interfaces/threads.rb
sentry-ruby-core-5.17.0 lib/sentry/interfaces/threads.rb
sentry-ruby-core-5.16.1 lib/sentry/interfaces/threads.rb
sentry-ruby-5.16.1 lib/sentry/interfaces/threads.rb
sentry-ruby-5.16.0 lib/sentry/interfaces/threads.rb
sentry-ruby-core-5.16.0 lib/sentry/interfaces/threads.rb
sentry-ruby-5.15.2 lib/sentry/interfaces/threads.rb
sentry-ruby-core-5.15.2 lib/sentry/interfaces/threads.rb
sentry-ruby-core-5.15.1 lib/sentry/interfaces/threads.rb
sentry-ruby-5.15.1 lib/sentry/interfaces/threads.rb
sentry-ruby-5.15.0 lib/sentry/interfaces/threads.rb
sentry-ruby-core-5.15.0 lib/sentry/interfaces/threads.rb
sentry-ruby-5.14.0 lib/sentry/interfaces/threads.rb
sentry-ruby-core-5.14.0 lib/sentry/interfaces/threads.rb
sentry-ruby-5.13.0 lib/sentry/interfaces/threads.rb
sentry-ruby-core-5.13.0 lib/sentry/interfaces/threads.rb
sentry-ruby-5.12.0 lib/sentry/interfaces/threads.rb
sentry-ruby-core-5.12.0 lib/sentry/interfaces/threads.rb
sentry-ruby-core-5.11.0 lib/sentry/interfaces/threads.rb
sentry-ruby-5.11.0 lib/sentry/interfaces/threads.rb