Class: Sentry::ThreadsInterface

Inherits:
Object
  • Object
show all
Defined in:
lib/sentry/interfaces/threads.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(crashed: false, stacktrace: nil) ⇒ ThreadsInterface

Returns a new instance of ThreadsInterface.



3
4
5
6
7
8
9
# File 'lib/sentry/interfaces/threads.rb', line 3

def initialize(crashed: false, stacktrace: nil)
  @id = Thread.current.object_id
  @name = Thread.current.name
  @current = true
  @crashed = crashed
  @stacktrace = stacktrace
end

Class Method Details

.build(backtrace:, stacktrace_builder:, **options) ⇒ Object

patch this method if you want to change a threads interface’s stacktrace frames also see StacktraceBuilder.build.



27
28
29
30
# File 'lib/sentry/interfaces/threads.rb', line 27

def self.build(backtrace:, stacktrace_builder:, **options)
  stacktrace = stacktrace_builder.build(backtrace: backtrace) if backtrace
  new(**options, stacktrace: stacktrace)
end

Instance Method Details

#to_hashObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/sentry/interfaces/threads.rb', line 11

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