in lib/elastic_apm.rb [168:199]
def with_transaction(
name = nil,
type = nil,
context: nil,
trace_context: nil
)
unless block_given?
raise ArgumentError,
'expected a block. Do you want `start_transaction\' instead?'
end
return yield(nil) unless agent
begin
transaction =
start_transaction(
name,
type,
context: context,
trace_context: trace_context
)
result = yield transaction
transaction&.outcome ||= Transaction::Outcome::SUCCESS
result
rescue
transaction&.outcome ||= Transaction::Outcome::FAILURE
raise
ensure
end_transaction
end
end