Repository navigation
Send the amz-sdk-invocation-id and amz-sdk-request headers from AWS clients - #947
Open
AlexDaines wants to merge 3 commits into
Open
AlexDaines wants to merge 3 commits into
AlexDaines wants to merge 3 commits into
Conversation
Every attempt of a call now carries the same random UUID in amz-sdk-invocation-id, and each call gets a new one, so a service can tell which requests are attempts of the same call. The header is set once, before the retry loop, so it is signed with the request.
Each attempt now carries its attempt number and the most attempts the call's retry strategy allows, as in attempt=2; max=3, so a service can see how the SDK retries. When the strategy has no max_attempts of 1 or more, the header carries only the attempt number. The header is set on each attempt before it is signed.
AlexDaines
marked this pull request as ready for review
November 20, 2026 19:52
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.
Issue #, if available: N/A
Description of changes:
AWS clients don't send the
amz-sdk-invocation-idandamz-sdk-requestheaders. The headers let a service group the attempts of one call and see the attempt number. botocore sets both inadd_retry_headers.This change adds
RetryHeadersInterceptortosmithy_aws_core.interceptors.retry_headers, and a generator integration that adds it to every client of a service with theaws.api#servicetrait:amz-sdk-invocation-idholds a random UUID. The interceptor sets it once for each call, before the first attempt, so every attempt of the call sends the same value and the signature covers it.amz-sdk-requestholdsattempt=N; max=M.maxis themax_attemptsof the call's retry strategy. When that value is missing or isn't a positive integer, the header holds onlyattempt=N. This change doesn't send thettlpart, which botocore adds on a retry from theDateheader of the previous response and the read timeout (_calculate_ttl).If the caller set either header, the interceptor overwrites it. That's deliberate: the values describe the SDK's own attempts, and a botocore request also goes out with botocore's values.
The two headers are in separate commits. The commit for
amz-sdk-invocation-idalso has the generator integration and the regenerated protocol test clients. The commit foramz-sdk-requestchanges onlysmithy-aws-core, not the generator.In aws-sdk-python,
test_should_set_retry_headersis skipped with a TODO for these headers. I ran it against a Lambda client generated from this change, and it passes. I'll remove that skip once a release has this change.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.