Skip to content

Commit a76dc18

Browse files
authored
Add invocation ID to root level “invoke” operation span (#3671)
## Motivation and Context The `invoke` debug span now includes invocation IDs for operation invocations. It is a random unique ID per client and shared across retries for the same operation. Example debug trace output with the changes in this PR: ``` 2024-05-29T17:50:22.230526Z DEBUG invoke{service=s3 operation=ListObjectsV2 sdk_invocation_id=4652364}:try_op:try_attempt: aws_smithy_runtime_api::client::interceptors::context: entering 'before deserialization' phase ``` ## Description Note that this invocation ID is currently for internal use only to improve debuggability when looking at logs (usually with customers). Note also that the invocation ID is not related to [that used in amz-sdk-invocation-id](#2626) (we [attempted to make it related](#3661) but decided to go for this two-way door approach). In sum, this PR is meant to be simple, and if we are to augment the functionality (e.g. make the ID configurable or make it related to that in `amz-sdk-invocation-id`), we can do so without breaking anything. ## Testing Relies on the existing tests in CI ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
1 parent 5bd44f2 commit a76dc18

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

rust-runtime/aws-smithy-runtime/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aws-smithy-runtime"
3-
version = "1.5.4"
3+
version = "1.5.5"
44
authors = ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>", "Zelda Hessler <zhessler@amazon.com>"]
55
description = "The new smithy runtime crate"
66
edition = "2021"

rust-runtime/aws-smithy-runtime/src/client/orchestrator.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ pub async fn invoke_with_stop_point(
168168
.maybe_timeout(operation_timeout_config)
169169
.await
170170
}
171-
.instrument(debug_span!("invoke", service = %service_name, operation = %operation_name))
171+
// Include a random, internal-only, seven-digit ID for the operation invocation so that it can be correlated in the logs.
172+
.instrument(debug_span!("invoke", service = %service_name, operation = %operation_name, sdk_invocation_id = fastrand::u32(1_000_000..10_000_000)))
172173
.await
173174
}
174175

0 commit comments

Comments
 (0)