lib/elastic_apm/error_builder.rb in elastic-apm-1.1.0 vs lib/elastic_apm/error_builder.rb in elastic-apm-2.0.0
- old
+ new
@@ -5,10 +5,11 @@
class ErrorBuilder
def initialize(agent)
@agent = agent
end
+ # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
def build_exception(exception, handled: true)
error = Error.new
error.exception = Error::Exception.new(exception, handled: handled)
if exception.backtrace
@@ -17,13 +18,17 @@
add_transaction_id 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
+ # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
def build_log(message, backtrace: nil, **attrs)
error = Error.new
error.log = Error::Log.new(message, **attrs)