Explicit way of failing a "other" transaction
VitorTrin opened this issue · comments
Is your feature request related to a problem? Please describe.
The NewRelic.start_transaction()
automaticaly catches exceptions and reports errors, which is great for most use cases, but sometimes you can't raise and you still would like to report something. For example, inside Oban jobs, raises are caught by Oban and never end up reported.
Describe the solution you'd like
Add the NewRelic.stop_transaction/1
function. The argument of this function is the error that will be reported
Describe alternatives you've considered
Directly calling NewRelic.Transaction.Reporter.fail/1
with varied levels of success.
@VitorTrin I'm curious, is this not accomplishable by decorating the Oban perform function with something like @trace :perform
. Unless I'm misunderstanding how the trace macro works, it does seem to raise the exception after creating a span for it.
elixir_agent/lib/new_relic/tracer/macro.ex
Lines 194 to 199 in f109ced
The trace macro wasn't enough for me because I wanted my job transactions to show up as Oban
transactions, not Other
Do they show up in any distinguishable manner? The tracer documentation indicates that it reports the function name.
elixir_agent/lib/new_relic/tracer.ex
Lines 23 to 27 in f109ced
I'm invested in this as well since it is something I am also trying to get working with Oban