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.

Parameters:

  • crashed (Boolean) (defaults to: false)
  • stacktrace (Array) (defaults to: nil)


7
8
9
10
11
12
13
# File 'lib/sentry/interfaces/threads.rb', line 7

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) ⇒ ThreadsInterface

Builds the ThreadsInterface with given backtrace and stacktrace_builder. Patch this method if you want to change a threads interface’s stacktrace frames.

Parameters:

Returns:

See Also:



37
38
39
40
# File 'lib/sentry/interfaces/threads.rb', line 37

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

Instance Method Details

#to_hashHash

Returns:

  • (Hash)


16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sentry/interfaces/threads.rb', line 16

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