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

Skip stacktrace for exceptions when stacktrace is not relevant. #110785

Merged
merged 4 commits into from
Jul 12, 2024

Conversation

mosche
Copy link
Contributor

@mosche mosche commented Jul 11, 2024

As discussed last week, in order to improve error logging this PR skips the creation of stacktraces for a number of common and expected exceptions where there's no value having one.

Despite having no (meaningful) stacktrace, the exceptions are nevertheless good to be aware of as they may signal (in)stability.

They could be filtered out from logs and be monitored using APM metrics only. However, that would likely hurt discoverability and break existing flows of devs when investigating issues.

If only removing (costly) stacktraces when not relevant, we will be able to continue aggregating all exceptions by means of error.type.

Note:

  • If a cause / or suppressed exceptions with a stacktrace exist, these will be printed regardless of course.
  • EcsJsonLayout uses printStackTrace, this way error.stack_trace will still exist containing the output of the exception's toString(). This PR omit error.stack_trace entirely in that case.

Relates to ES-7097

These exceptions are expected and don't imply bugs, their stacktrace
isn't relevant and should not be logged.

Relates to ES-7097
@mosche mosche requested a review from a team as a code owner July 11, 2024 14:59
@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label v8.16.0 labels Jul 11, 2024
@mosche mosche added :Core/Infra/Core Core issues without another label :Core/Infra/Logging Log management and logging utilities >non-issue and removed needs:triage Requires assignment of a team area label labels Jul 11, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Jul 11, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@mosche mosche merged commit e1a091f into elastic:main Jul 12, 2024
15 checks passed
@mosche mosche deleted the ES-7097_skip_stacktrace_if_irrelevant branch July 12, 2024 08:48
@@ -27,4 +27,9 @@ public NodeNotConnectedException(DiscoveryNode node, String msg) {
public NodeNotConnectedException(StreamInput in) throws IOException {
super(in);
}

@Override
public Throwable fillInStackTrace() {
Copy link
Contributor

Choose a reason for hiding this comment

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

would it make sense to have a common abstract 'nonprintable exception' class?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label :Core/Infra/Logging Log management and logging utilities >non-issue Team:Core/Infra Meta label for core/infra team v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants