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

NR-64056 Error grouping #1195

Merged
merged 19 commits into from
Apr 6, 2023
Merged

NR-64056 Error grouping #1195

merged 19 commits into from
Apr 6, 2023

Conversation

jtduffy
Copy link
Contributor

@jtduffy jtduffy commented Apr 3, 2023

Implements the error grouping feature:

  • Callback handler and error data classes
  • API upgrade for callback registration
  • Callback invoked for each error reported to NR
  • Javadocs
  • Associated unit tests

Copy link
Contributor

@obenkenobi obenkenobi left a comment

Choose a reason for hiding this comment

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

Overall this looks good. There are some NPE risks and minor code style comments I'd like to be addressed beforehand.

Agent.LOG.warning(MessageFormat.format("Customer errorGroupCallback implementation threw an exception: {0}", e.getMessage()));
NewRelic.getAgent().getLogger().log(Level.WARNING, "Customer errorGroupCallback implementation threw an exception: {0}", e.getMessage());
NewRelic.getAgent().getLogger().log(Level.FINEST, "Customer errorGroupCallback implementation stacktrace {0}:",
Arrays.toString(e.getStackTrace()).replace(",", "\n"));
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd avoid the manual stack trace to string code there. You could use

NewRelic.getAgent().getLogger().log(Level.FINEST, e, "Customer errorGroupCallback stacktrace.");

though it will repeat the message.

So another option would be:

if (NewRelic.getAgent().getLogger().isLoggable(Level.FINEST)) {
  NewRelic.getAgent().getLogger().log(Level.FINEST, e, "Customer errorGroupCallback threw an exception.");
} else {
  NewRelic.getAgent().getLogger().log(Level.WARNING, "Customer errorGroupCallback implementation threw an exception: {0}", e.getMessage());
}

@jtduffy jtduffy merged commit 3062016 into main Apr 6, 2023
@jtduffy jtduffy deleted the NR-64056-error-group branch April 6, 2023 19:32
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.

5 participants