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, context: nil, handled: true) ⇒ Object private
- #build_log(message, context: nil, backtrace: nil, **attrs) ⇒ Object private
-
#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.
23 24 25 |
# File 'lib/elastic_apm/error_builder.rb', line 23 def initialize(agent) @agent = agent end |
Instance Method Details
#build_exception(exception, context: nil, 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.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/elastic_apm/error_builder.rb', line 27 def build_exception(exception, context: nil, handled: true) error = Error.new context: context || Context.new error.exception = Error::Exception.from_exception(exception, handled: handled) Util.reverse_merge!(error.context.labels, @agent.config.default_labels) if exception.backtrace add_stacktrace error, :exception, exception.backtrace end add_current_transaction_fields error, ElasticAPM.current_transaction error end |
#build_log(message, context: nil, 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.
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/elastic_apm/error_builder.rb', line 43 def build_log(, context: nil, backtrace: nil, **attrs) error = Error.new context: context || Context.new error.log = Error::Log.new(, **attrs) if backtrace add_stacktrace error, :log, backtrace end add_current_transaction_fields error, ElasticAPM.current_transaction error end |