Class: StackifyRubyAPM::ErrorBuilder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/stackify_apm/error_builder.rb

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.

Instance Method Summary collapse

Constructor Details

#initialize(agent) ⇒ ErrorBuilder

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 ErrorBuilder.



8
9
10
# File 'lib/stackify_apm/error_builder.rb', line 8

def initialize(agent)
  @agent = agent
end

Instance Method Details

#build_exception(exception, handled: true) ⇒ Object

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.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/stackify_apm/error_builder.rb', line 12

def build_exception(exception, handled: true)
  error = Error.new
  error.exception = Error::Exception.new(exception, handled: handled)

  if exception.backtrace
    add_stacktrace error, :exception, exception.backtrace
  end

  add_transaction_id error

  if (transaction = StackifyRubyAPM.current_transaction)
    error.context = transaction.context.dup
  end

  error
end

#build_log(message, backtrace: nil, **attrs) ⇒ Object

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.



29
30
31
32
33
34
35
36
37
# File 'lib/stackify_apm/error_builder.rb', line 29

def build_log(message, backtrace: nil, **attrs)
  error = Error.new
  error.log = Error::Log.new(message, **attrs)

  add_stacktrace error, :log, backtrace if backtrace
  add_transaction_id error

  error
end