Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit way of failing a "other" transaction #347

Open
VitorTrin opened this issue May 11, 2021 · 3 comments · May be fixed by #470
Open

Explicit way of failing a "other" transaction #347

VitorTrin opened this issue May 11, 2021 · 3 comments · May be fixed by #470

Comments

@VitorTrin
Copy link

VitorTrin commented May 11, 2021

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.

@hdtafur
Copy link

hdtafur commented Aug 12, 2022

@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.

rescue
exception ->
message = NewRelic.Util.Error.format_reason(:error, exception)
NewRelic.DistributedTrace.set_span(:error, message: message)
reraise exception, __STACKTRACE__

@VitorTrin
Copy link
Author

The trace macro wasn't enough for me because I wanted my job transactions to show up as Oban transactions, not Other

@hdtafur
Copy link

hdtafur commented Aug 12, 2022

Do they show up in any distinguishable manner? The tracer documentation indicates that it reports the function name.

@trace :func
def func do
# Will report as `MyModule.func/0`
end
end

I'm invested in this as well since it is something I am also trying to get working with Oban

@binaryseed binaryseed linked a pull request Dec 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants