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

adjust metadata_reporter :transaction report_error #443

Conversation

rlchu
Copy link
Collaborator

@rlchu rlchu commented Oct 9, 2024

This PR fixes a bug within lib/new_relic/error/metadata_reporter.ex which can emerge when upgrading from Elixir 1.14 to 1.15 which could manifest as reported errors which were formerly on the Elixir level could report as being wrapped on the Erlang level.

Compare to the use of the NewRelic.Transaction.Reporter.error in this PR to here:

-- can see the reason should be an exception struct (which I believe is further parsed as part of the collection cycle), not the "reason" string explanation

NewRelic.Transaction.Reporter.error(%{
      kind: kind,
      reason: exception,
      stack: stacktrace
    })

this reason exception and stacktrace can be extracted directly from the metadata.reason tuple:
{_exception_type, reason, stacktrace, _expected} = parse_reason(metadata.reason)
can instead simply be {exception, stacktrace} = metadata.reason.

When a direct 'reason' string was being passed instead of the expected exception struct, this can manifest as an 'erlang wrapped' error in reporting -- what was (ErrorType) <message> becomes (ErlangError) Erlang Error: (ErrorType) <msesage> and further metadata is misreported, including for example expected errors being flipped to false (as a result of landing here

defp parse_reason({exception, stacktrace}) do
)

@CLAassistant
Copy link

CLAassistant commented Oct 9, 2024

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@rlchu rlchu marked this pull request as ready for review October 9, 2024 16:11
Copy link
Contributor

@tpitale tpitale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Good catch, that's a tricky one.

@tpitale tpitale merged commit 2d1830a into newrelic:master Oct 9, 2024
8 of 13 checks passed
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 this pull request may close these issues.

3 participants