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

Logbook fault tolerancy #1739

Merged
merged 5 commits into from
Apr 10, 2024
Merged

Logbook fault tolerancy #1739

merged 5 commits into from
Apr 10, 2024

Conversation

kasmarian
Copy link
Member

@kasmarian kasmarian commented Jan 21, 2024

Description

This change introduces 2 different fallback mechanisms (possible overlapping):

  • in httpclient(5), okhttp(2) and spring interceptors. Where in case of exceptions, logbook will fall back to noop stage and will not fail the overall request/response processing by an application
  • in DefaultLogbook. Where request stage preparing method (RequestWritingStage process(final HttpRequest originalRequest, final Strategy strategy)), as well as request writing and response write methods of the DefaultRequestWritingStage (new inner class) will be intercepting all RuntimeExceptions and will not fail the request processing. This approach may be sufficient to cover the cases of library dependent interceptors.

Motivation and Context

As of now, when Logbook is causing RuntimeExceptions, it affects not only the ability to write the request/response logs, but prevents clients from operating normally. This should not be the case.

Related issues: #1693, #1702

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

This change is aimed to make the DefaultLogbook not fail the request processing, if there are issues while writing request or response logs. Instead, it will fallback to Noop stage
This change introduces a fallback in interceptors to noop stage, when there are exceptions while writing request or response logs.
@kasmarian kasmarian changed the title [WIP] Logbook failt tolerancy [WIP] Logbook fault tolerancy Mar 5, 2024
@kasmarian kasmarian marked this pull request as ready for review April 8, 2024 19:04
@lukasniemeier-zalando
Copy link
Member

👍

@kasmarian kasmarian changed the title [WIP] Logbook fault tolerancy Logbook fault tolerancy Apr 10, 2024
@kasmarian kasmarian merged commit 285bab2 into main Apr 10, 2024
2 checks passed
@kasmarian kasmarian deleted the logbook-failt-tolerancy branch April 10, 2024 14:46
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.

2 participants