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

chore: Adjust checksum middlewares' log levels #1907

Merged
merged 2 commits into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public struct FlexibleChecksumsRequestMiddleware<OperationStackInput, OperationS
try builder.setAwsChunkedHeaders() // x-amz-decoded-content-length
}
} else if case(.noStream) = builder.body {
logger.info("Request body is empty. Skipping request checksum calculation...")
logger.debug("Request body is empty. Skipping request checksum calculation...")
return
}

Expand Down Expand Up @@ -82,7 +82,7 @@ public struct FlexibleChecksumsRequestMiddleware<OperationStackInput, OperationS
if requestChecksumRequired || (attributes.requestChecksumCalculation == .whenSupported) {
// If requestChecksumRequired == true OR RequestChecksumCalculation == when_supported, use CRC32 as default algorithm.
checksumHashFunction = ChecksumAlgorithm.from(string: "crc32")!
logger.info("No algorithm chosen by user. Defaulting to CRC32 checksum algorithm.")
logger.debug("No algorithm chosen by user. Defaulting to CRC32 checksum algorithm.")
// If the input member tied to `requestAlgorithmMember` has `@httpHeader` trait in model,
// manually set the header with the name from `@httpHeader` trait with SDK's default algorithm: CRC32.
// This needs to be manually added here because user didn't configure checksumAlgorithm but we're sending default checksum.
Expand All @@ -92,9 +92,9 @@ public struct FlexibleChecksumsRequestMiddleware<OperationStackInput, OperationS
}
} else {
// If requestChecksumRequired == false AND RequestChecksumCalculation == when_required, skip calculation.
logger.info("Checksum not required for the operation.")
logger.info("Client config `requestChecksumCalculation` set to `.whenRequired`")
logger.info("No checksum algorithm chosen by the user. Skipping checksum calculation...")
logger.debug("Checksum not required for the operation.")
logger.debug("Client config `requestChecksumCalculation` set to `.whenRequired`")
logger.debug("No checksum algorithm chosen by the user. Skipping checksum calculation...")
return
}
}
Expand Down Expand Up @@ -137,7 +137,7 @@ public struct FlexibleChecksumsRequestMiddleware<OperationStackInput, OperationS

func calculateAndAddChecksumHeader(data: Data?) async throws {
guard let data else {
logger.info("Request body is empty. Skipping request checksum calculation...")
logger.debug("Request body is empty. Skipping request checksum calculation...")
return
}
if builder.headers.value(for: checksumHashHeaderName) == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public struct FlexibleChecksumsResponseMiddleware<OperationStackInput, Operation
private func validateChecksum(response: HTTPResponse, logger: any LogAgent, attributes: Context) async throws {
// Exit if validation should not be performed
if validationMode != "ENABLED" && attributes.responseChecksumValidation == .whenRequired {
logger.info("Checksum validation should not be performed! Skipping workflow...")
logger.debug("Checksum validation should not be performed! Skipping workflow...")
return
}

Expand All @@ -53,7 +53,7 @@ public struct FlexibleChecksumsResponseMiddleware<OperationStackInput, Operation
guard let checksumHeader = checksumHeaderIsPresent else {
let message =
"User requested checksum validation, but the response headers did not contain any valid checksums"
logger.warn(message)
logger.debug(message)
return
}

Expand All @@ -75,7 +75,7 @@ public struct FlexibleChecksumsResponseMiddleware<OperationStackInput, Operation
switch response.body {
case .data(let data):
guard let data else {
logger.info("Response body is empty. Skipping response checksum validation...")
logger.debug("Response body is empty. Skipping response checksum validation...")
return
}

Expand All @@ -98,7 +98,7 @@ public struct FlexibleChecksumsResponseMiddleware<OperationStackInput, Operation
attributes.httpResponse = response
attributes.httpResponse?.body = validatingStream
case .noStream:
logger.info("Response body is empty. Skipping response checksum validation...")
logger.debug("Response body is empty. Skipping response checksum validation...")
return
}
}
Expand Down
Loading