Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the request/response logging sinks so that when a body is truncated at maxSize/maxBodySize, the log message text explicitly indicates truncation (e.g., ...[truncated ~124KB]) instead of relying on an appended body message.
Changes:
- Introduces a
truncatedvalue on request/response markers and plumbs it through sinks/markers intoMessageComposer. - Updates on-demand and eager logbook sinks/markers to compute and propagate truncation size.
- Adds/updates example endpoints/tests to generate large responses for manual/integration verification.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| request-response/logbook/src/main/java/no/entur/logging/cloud/logbook/AbstractLogLevelSink.java | Propagates truncation from marker into message composition. |
| request-response/logbook/src/main/java/no/entur/logging/cloud/logbook/AbstractLogLevelLogstashLogbackSink.java | Computes truncation for eager markers and returns new marker type. |
| request-response/logbook/src/main/java/no/entur/logging/cloud/logbook/AbstractSingleFieldAppendingMarker.java | Base marker now carries truncation value. |
| request-response/logbook/src/main/java/no/entur/logging/cloud/logbook/LogLevelLogstashLogbackSink.java | Passes truncation into request/response marker constructors. |
| request-response/logbook/src/main/java/no/entur/logging/cloud/logbook/MessageComposer.java | Appends truncation suffix to request/response log messages. |
| request-response/logbook/src/main/java/no/entur/logging/cloud/logbook/RequestResponseSingleFieldAppendingMarker.java | New common marker base that stores truncation metadata. |
| request-response/logbook/src/main/java/no/entur/logging/cloud/logbook/RequestSingleFieldAppendingMarker.java | Accepts truncation value and forwards to base marker. |
| request-response/logbook/src/main/java/no/entur/logging/cloud/logbook/ResponseSingleFieldAppendingMarker.java | Accepts truncation value and forwards to base marker. |
| request-response/logbook/src/main/java/no/entur/logging/cloud/logbook/ondemand/AbstractOndemandSingleFieldAppendingMarker.java | On-demand marker base now stores truncation metadata. |
| request-response/logbook/src/main/java/no/entur/logging/cloud/logbook/ondemand/OndemandLogLevelLogstashLogbackSink.java | Computes truncation for on-demand writers and passes it to markers. |
| request-response/logbook/src/main/java/no/entur/logging/cloud/logbook/ondemand/RequestOndemandSingleFieldAppendingMarker.java | Accepts truncation value and forwards to base. |
| request-response/logbook/src/main/java/no/entur/logging/cloud/logbook/ondemand/ResponseOndemandSingleFieldAppendingMarker.java | Accepts truncation value and forwards to base. |
| request-response/logbook/src/test/java/no/entur/logging/cloud/logbook/AbstractLogLevelLogstashLogbackSinkTest.java | Updates expectations for new marker factory signature/truncation argument. |
| request-response/logbook-test/src/main/java/no/entur/logging/cloud/logbook/logbook/test/PrettyPrintingLogLevelLogstashLogbackSink.java | Passes truncation through pretty-printing marker factory. |
| request-response/logbook-test/src/main/java/no/entur/logging/cloud/logbook/logbook/test/PrettyPrintingRequestSingleFieldAppendingMarker.java | Accepts truncation value. |
| request-response/logbook-test/src/main/java/no/entur/logging/cloud/logbook/logbook/test/PrettyPrintingResponseSingleFieldAppendingMarker.java | Accepts truncation value. |
| request-response/logbook-test/src/main/java/no/entur/logging/cloud/logbook/logbook/test/PrettyPrintingSink.java | Updates overridden message methods to include truncation param. |
| request-response/logbook-test/src/main/java/no/entur/logging/cloud/logbook/logbook/test/ondemand/PrettyPrintingOndemandLogLevelLogstashLogbackSink.java | Computes/passes truncation in pretty-printing on-demand sink. |
| examples/gcp-web-example/src/main/java/org/entur/example/web/rest/DocumentEndpoint.java | Adjusts big response payload shape to exercise truncation. |
| examples/gcp-web-example/src/test/java/org/entur/example/web/WebLoggingFormatWithBigResponsesTest.java | Adds a sleep in test path after big response call. |
| examples/gcp-web-without-test-artifacts-example/src/main/java/org/entur/example/web/rest/DocumentEndpoint.java | Adds a big-response endpoint to produce large JSON responses. |
| examples/gcp-web-without-test-artifacts-example/src/test/java/org/entur/example/web/WebLoggingFormatWithBigResponsesTest.java | Adds an integration test hitting the big-response endpoint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…org/entur/example/web/rest/DocumentEndpoint.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…org/entur/example/web/WebLoggingFormatWithBigResponsesTest.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
erlendnils1
approved these changes
Apr 30, 2026
AlexanderBrevig
approved these changes
Apr 30, 2026
skjolber
added a commit
that referenced
this pull request
Apr 30, 2026
* Add truncated message for request-response-message (#358) * Add truncate message for request-response-logging * Fix truncated length message * Adjust * Adjust * QA * Update examples/gcp-web-without-test-artifacts-example/src/main/java/org/entur/example/web/rest/DocumentEndpoint.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * adjust javadoc * Adjust * Update examples/gcp-web-without-test-artifacts-example/src/test/java/org/entur/example/web/WebLoggingFormatWithBigResponsesTest.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Adjust test method name --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When body
maxSizeis reached, it is truncated. Show this inmessagefield so it is easy to see.The current approach with writing a notification message at the end of the document does not work too well.
New approach:
Also fix some minor bugs, maxSize vs maxBodySize and pretty-printing limit check fail.