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

Handle elixir exceptions in MetadataReporter #427

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

tmaszk
Copy link
Contributor

@tmaszk tmaszk commented Jan 30, 2024

I've been testing with the master branch and have discovered a class of errors that is causing MetadataReporter to throw an exception. It occurs when the original exception occurs within an async Task. This PR contains the fix and a unit test to exercise it.

@tmaszk tmaszk changed the title parse elixir exceptions Handle elixir exceptions in MetadataReporter Jan 30, 2024
@XiXiaPdx
Copy link
Contributor

XiXiaPdx commented Feb 6, 2024

@tmaszk I have a question about the new test. I added the test to master, expecting it to fail the assertion but it passes instead. Here is what I see in events. Is that unexpected?

[test/error_test.exs:200: ErrorTest."test Catch a function clause error inside a Task"/1]
events #=> [
  [
    %{
      timestamp: 1707246881.171,
      type: "TransactionError",
      duration: nil,
      databaseDuration: nil,
      "error.class": "FunctionClauseError",
      "error.message": "(FunctionClauseError) no function clause matching in ErrorTest.ErrorDummy.handle_call/3",
      "error.expected": false,
      transactionName: "OtherTransaction/Elixir/ElixirProcess//ErrorTest.ErrorDummy"
    },
    %{
      process: "ErrorTest.ErrorDummy",
      stacktrace: "test/error_test.exs:11: ErrorTest.ErrorDummy.handle_call(:foo, nil, nil)\n(elixir 1.14.4) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2\n(elixir 1.14.4) lib/task/supervised.ex:34: Task.Supervised.reply/4\n(stdlib 5.1.1) proc_lib.erl:241: :proc_lib.init_p_do_apply/3\nanonymous fn() in ErrorTest.\"test Catch a function clause error inside a Task\"/1",
      test_attribute: "test_value"
    },
    %{}
  ]
]

@tmaszk
Copy link
Contributor Author

tmaszk commented Feb 7, 2024

@XiXiaPdx Good question. In my local development, I added the code in this PR on top of #426

If you add the test to the code in #426, the test will fail.

I was trying to keep the PRs as atomic as I could, but I can combine this with #426 if you would rather.

@XiXiaPdx
Copy link
Contributor

XiXiaPdx commented Feb 7, 2024

Oh, I see. Nice catch and thanks again for another contribution!

Copy link
Contributor

@XiXiaPdx XiXiaPdx left a comment

Choose a reason for hiding this comment

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

After #426 is merged, let's merge this.

@tpitale tpitale merged commit c79e1b8 into newrelic:master Feb 14, 2024
11 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