-
Notifications
You must be signed in to change notification settings - Fork 0
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
ACS-8766: Adjust live-ingester logging to be more descriptive in case of error #666
ACS-8766: Adjust live-ingester logging to be more descriptive in case of error #666
Conversation
…G and in case of error
...src/test/java/org/alfresco/hxi_connector/live_ingester/logging/MaskingPatternLayoutTest.java
Fixed
Show fixed
Hide fixed
.../org/alfresco/hxi_connector/live_ingester/domain/ports/ingestion_engine/DeleteNodeEvent.java
Fixed
Show fixed
Hide fixed
.../org/alfresco/hxi_connector/live_ingester/domain/ports/ingestion_engine/DeleteNodeEvent.java
Fixed
Show fixed
Hide fixed
…ing-to-be-more-descriptive-in-case-of-error # Conflicts: # common-test/src/main/java/org/alfresco/hxi_connector/common/test/docker/util/DockerContainers.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The log quality looks much better 👍
I'm not convinced by the method of masking sensitive data out of the log using a regex. Instead I think it would be better to selectively choose data to be included in the log. With the current proposal then there's a risk that the name of a field could change, e.g. secret
could be renamed token
by a library upgrade, and then the masking would stop working. I don't think any of the tests here would catch this problem either.
I know it's more work, but I think it would be better to create our own text renderers for the problematic fields.
@tpage-alfresco I've adjusted the way of masking stuff according to our conversation on Slack. Please could you review it one more time? 🙏 |
...er/adapters/messaging/hx_insight/storage/connector/PreSignedUrlRequesterIntegrationTest.java
Fixed
Show fixed
Hide fixed
...resco/hxi_connector/live_ingester/adapters/messaging/hx_insight/HxInsightEventPublisher.java
Fixed
Show fixed
Hide fixed
...onnector/live_ingester/adapters/messaging/hx_insight/storage/connector/HttpFileUploader.java
Fixed
Show fixed
Hide fixed
...tor/live_ingester/adapters/messaging/hx_insight/storage/connector/PreSignedUrlRequester.java
Fixed
Show fixed
Hide fixed
...esco/hxi_connector/live_ingester/adapters/messaging/repository/LiveIngesterEventHandler.java
Fixed
Show fixed
Hide fixed
.../hxi_connector/live_ingester/adapters/messaging/transform/request/ATSTransformRequester.java
Fixed
Show fixed
Hide fixed
.../hxi_connector/live_ingester/adapters/messaging/transform/storage/SharedFileStoreClient.java
Fixed
Show fixed
Hide fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, as discussed, you may want to call logMaskedExchangeState
direclty in .process()
instead of creating/calling a private method in each RouteBuilder
it used.
@mpichura fixed - thanks! |
@@ -112,7 +116,7 @@ STORAGE_LOCATION_HEADER, wrapRawToken(fileUploadRequest.storageLocation()), | |||
.withHeaders(headers) | |||
.withBody(fileData) | |||
.request(); | |||
log.atDebug().log("Upload :: {} rendition of the node: {} successfully uploaded to pre-signed URL: {}", fileUploadRequest.contentType(), nodeId, fileUploadRequest.storageLocation().getPath()); | |||
log.info("Storage :: Rendition of type: {} for node: {} successfully uploaded to pre-signed URL: {}", fileUploadRequest.contentType(), nodeId, fileUploadRequest.storageLocation().getPath()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use atInfo()
to avoid the PMD issue (since PMD doesn't know how long the calls to contentType()
, storageLocation()
and getPath()
will take).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed - thanks!
@@ -123,7 +127,7 @@ STORAGE_LOCATION_HEADER, wrapRawToken(fileUploadRequest.storageLocation()), | |||
} | |||
catch (IOException ioe) | |||
{ | |||
log.atDebug().log("Upload :: Stream reset failed due to: {}", ioe.getMessage()); | |||
log.warn("Storage :: Rendition stream NOT reset properly after node %s content upload fail due to: %s".formatted(nodeId, ioe.getMessage()), ioe); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly I think we want atWarn()
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed - thanks!
…ing-to-be-more-descriptive-in-case-of-error # Conflicts: # live-ingester/src/main/java/org/alfresco/hxi_connector/live_ingester/adapters/config/jackson/DeleteNodeEventSerializer.java
…ssing PR comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more change I think is worth doing.
@@ -50,6 +51,8 @@ | |||
public class ATSTransformResponseHandler extends RouteBuilder | |||
{ | |||
private static final String ROUTE_ID = "transform-events-consumer"; | |||
private static final int EXPECTED_STATUS_CODE = 201; | |||
private static final String EXPECTED_STATUS_CODE_REGEX = "[\\s\\S]*\"status\"\\s*:\\s*%s[\\s\\S]*".formatted(EXPECTED_STATUS_CODE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote a comment suggesting this, but it disappeared - thanks GitHub!
private static final String EXPECTED_STATUS_CODE_REGEX = "[\\s\\S]*\"status\"\\s*:\\s*%s[\\s\\S]*".formatted(EXPECTED_STATUS_CODE); | |
private static final String EXPECTED_STATUS_CODE_REGEX = ".*\"status\"\\s*:\\s*%s[^0-9].*".formatted(EXPECTED_STATUS_CODE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explanation: I think that [\\s\\S]
includes all characters so is the same as .
Also the status code should not be followed by another digit (and will be followed by something in a JSON response).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The [\\s\\S]
is similar to .
, but it also includes whitespaces, so it covers bigger set of characters to match whole sentence / paragraph (or JSON) containing expected status
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add the [^0-9]
- this is to prevent the next char from being a number, yes?
…ssing PR comments
…ssing PR comments
…ssing PR comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great - thanks for adding the tests!
…ssing PR comments
https://hyland.atlassian.net/browse/ACS-8766