Class: ElasticAPM::ErrorBuilder Private
- Inherits:
-
Object
- Object
- ElasticAPM::ErrorBuilder
- Defined in:
- lib/elastic_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
-
#build_exception(exception, handled: true) ⇒ Object
private
rubocop:disable Metrics/MethodLength, Metrics/AbcSize.
-
#build_log(message, backtrace: nil, **attrs) ⇒ Object
private
rubocop:enable Metrics/MethodLength, Metrics/AbcSize.
-
#initialize(agent) ⇒ ErrorBuilder
constructor
private
A new instance of ErrorBuilder.
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.
6 7 8 |
# File 'lib/elastic_apm/error_builder.rb', line 6 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.
rubocop:disable Metrics/MethodLength, Metrics/AbcSize
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/elastic_apm/error_builder.rb', line 11 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_current_transaction_fields error if (transaction = ElasticAPM.current_transaction) error.context = transaction.context.dup error.trace_id = transaction.trace_id error.transaction_id = transaction.id error.parent_id = ElasticAPM.current_span&.id || transaction.id 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.
rubocop:enable Metrics/MethodLength, Metrics/AbcSize
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/elastic_apm/error_builder.rb', line 32 def build_log(, backtrace: nil, **attrs) error = Error.new error.log = Error::Log.new(, **attrs) if backtrace add_stacktrace error, :log, backtrace end add_current_transaction_fields error error end |