Class: Airbrake::Filters::ThreadFilter Private

Inherits:
Object
  • Object
show all
Defined in:
lib/airbrake-ruby/filters/thread_filter.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Attaches thread & fiber local variables along with general thread information.

Constant Summary collapse

SAFE_CLASSES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Returns the list of classes that can be safely converted to JSON.

Returns:

  • (Array<Class>)

    the list of classes that can be safely converted to JSON

[
  NilClass,
  TrueClass,
  FalseClass,
  String,
  Symbol,
  Regexp,
  Numeric,
].freeze
IGNORE_PREFIX =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Variables starting with this prefix are not attached to a notice.

'_'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeThreadFilter

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ThreadFilter.



27
28
29
# File 'lib/airbrake-ruby/filters/thread_filter.rb', line 27

def initialize
  @weight = 110
end

Instance Attribute Details

#weightInteger (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Integer)


8
9
10
# File 'lib/airbrake-ruby/filters/thread_filter.rb', line 8

def weight
  @weight
end

Instance Method Details

#call(notice) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

This is a mandatory method required by any filter integrated with FilterChain.

Parameters:

  • notice (Notice)

    the notice to be filtered

See Also:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/airbrake-ruby/filters/thread_filter.rb', line 32

def call(notice)
  th = Thread.current
  thread_info = {}

  if (vars = thread_variables(th)).any?
    thread_info[:thread_variables] = vars
  end

  if (vars = fiber_variables(th)).any?
    thread_info[:fiber_variables] = vars
  end

  if (name = th.name)
    thread_info[:name] = name
  end

  add_thread_info(th, thread_info)

  notice[:params][:thread] = thread_info
end