adjust metadata_reporter :transaction report_error #443
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:elixir_agent/lib/new_relic/error/reporter.ex
Line 38 in 56525d9
reason
should be an exception struct (which I believe is further parsed as part of the collection cycle), not the "reason" string explanationthis 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 hereelixir_agent/lib/new_relic/error/metadata_reporter.ex
Line 73 in 56525d9