Skip to content

Log request ID and extended request ID with the requestId logger and … #2929

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

Merged
merged 2 commits into from
Jan 4, 2022

Conversation

zoewangg
Copy link
Contributor

@zoewangg zoewangg commented Dec 16, 2021

…request logger

Motivation and Context

#2876

Description

Log request ID and extended request ID with the requestId logger and

Testing

Tested locally.

2021-12-16 15:50:25,457 [main] DEBUG software.amazon.awssdk.request - Received failed response: 400, Request ID: xxxxx, Extended Request ID: not available

2021-12-16 15:50:46,493 [main] DEBUG software.amazon.awssdk.requestId - Received successful response: 200, Request ID: xxxx, Extended Request ID: not available

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed
  • A short description of the change has been added to the CHANGELOG
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@zoewangg zoewangg requested a review from a team as a code owner December 16, 2021 23:51
@zoewangg zoewangg force-pushed the zoewang/requestLogger branch from f44dd0a to 759be4e Compare December 17, 2021 00:16
@@ -94,6 +95,7 @@ public AwsXmlPredicatedResponseHandler(

AwsXmlUnmarshallingContext parsedResponse = parseResponse(httpResponse, executionAttributes);
parsedResponse = decorateContextWithError.apply(parsedResponse);
logRequestId(httpResponse);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this not handled by the combined response handler below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it seems AwsXmlPredicatedResponseHandler is used by s3, and combined response handler is used by all other services. (I just learned it yesterday)

@@ -68,6 +69,8 @@ public CombinedResponseHandler(HttpResponseHandler<OutputT> successResponseHandl
ExecutionAttributes executionAttributes)
throws IOException, InterruptedException {

logRequestId(httpResponse);
Copy link
Contributor

Choose a reason for hiding this comment

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

Any specific reason to have picked this response handler to do the logging?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is where we log the response status code currently, so I just included the request ID here

@zoewangg zoewangg linked an issue Dec 17, 2021 that may be closed by this pull request
@zoewangg zoewangg enabled auto-merge (squash) January 4, 2022 22:23
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 4, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

93.8% 93.8% Coverage
0.0% 0.0% Duplication

@zoewangg zoewangg merged commit fa97ff8 into master Jan 4, 2022
@zoewangg zoewangg deleted the zoewang/requestLogger branch January 5, 2022 21:44
aws-sdk-java-automation added a commit that referenced this pull request Mar 19, 2024
…2012b8724

Pull request: release <- staging/b6832892-c2e4-4c09-a766-b572012b8724
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.

Request ID missing in DEBUG logs
2 participants