Skip to content

Commit 1b5a5c2

Browse files
aajtoddaws-sdk-rust-ci
authored andcommitted
[smithy-rs] remove redundant span attributes and improve log output format (#4075)
## Description smithy-lang/smithy-rs#4052 aligned our spans closer to SRA but the output format resulted in `rpc.service` and `rpc.method` on both the new generated operation span and the internal orchestrator `invoke` span. This resulted in pretty long and clutter log output. This PR cleans up the log output a bit to have only the top level operation span include these attributes. This also fixes a subtle bug where presigned requests wouldn't contain the same top level operation span instrumentation because presigned requests make use of `<Operation>::orchestrate_with_stop_point` and not `<Operation>::orchestrate`. For IMDS and other "manually constructed" operations, I've moved the `invoke` span instrumentation into `Operation::invoke` to ensure we still capture that information in the logs for those use cases. Example output format: ``` 2025-03-28T14:44:02.471068Z DEBUG S3.ListBuckets{rpc.service="S3" rpc.method="ListBuckets" sdk_invocation_id=4073472 rpc.system="aws-api"}:try_op: aws_smithy_runtime::cli ent::orchestrator: beginning attempt #1 ``` ## Checklist <!--- If a checkbox below is not applicable, then please DELETE it rather than leaving it unchecked --> - [x] For changes to the smithy-rs codegen or runtime crates, I have created a changelog entry Markdown file in the `.changelog` directory, specifying "client," "server," or both in the `applies_to` key. ---- _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 a250cbe commit 1b5a5c2

File tree

17,162 files changed

+180949
-174621
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

17,162 files changed

+180949
-174621
lines changed

examples/cross_service/photo_asset_management/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ aws-sdk-dynamodb= { version = "1.72.0", path = "../../../sdk/dynamodb" }
3535
aws-sdk-rekognition= { version = "1.68.0", path = "../../../sdk/rekognition" }
3636
aws-sdk-s3= { version = "1.83.0", path = "../../../sdk/s3" }
3737
aws-sdk-sns= { version = "1.66.0", path = "../../../sdk/sns" }
38-
aws-smithy-runtime= { version = "1.8.1", path = "../../../sdk/aws-smithy-runtime" }
38+
aws-smithy-runtime= { version = "1.8.2", path = "../../../sdk/aws-smithy-runtime" }
3939
aws-smithy-types-convert= { version = "0.60.9", path = "../../../sdk/aws-smithy-types-convert", features = ["convert-chrono"] }
4040

4141
[dependencies.aws_lambda_events]

examples/cross_service/rest_ses/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ aws-sdk-cloudwatchlogs= { version = "1.77.0", path = "../../../sdk/cloudwatchlog
3434
aws-sdk-rdsdata= { version = "1.67.0", path = "../../../sdk/rdsdata" }
3535
aws-sdk-ses= { version = "1.68.0", path = "../../../sdk/ses" }
3636
aws-smithy-types= { version = "1.3.0", path = "../../../sdk/aws-smithy-types" }
37-
aws-smithy-runtime= { version = "1.8.1", path = "../../../sdk/aws-smithy-runtime" }
37+
aws-smithy-runtime= { version = "1.8.2", path = "../../../sdk/aws-smithy-runtime" }
3838

3939
[dependencies.chrono]
4040
version = "0.4.22"
@@ -69,7 +69,7 @@ features = ["v4", "serde"]
6969
once_cell = "1.15.0"
7070
rand = "0.8.5"
7171
wiremock = "0.5.15"
72-
aws-smithy-runtime= { version = "1.8.1", path = "../../../sdk/aws-smithy-runtime" }
72+
aws-smithy-runtime= { version = "1.8.2", path = "../../../sdk/aws-smithy-runtime" }
7373

7474
[dev-dependencies.fake]
7575
version = "2.5.0"

examples/examples/custom-root-certificates/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ publish = false
1111
rustls = "0.21.9"
1212
aws-config= { version = "1.6.1", path = "../../../sdk/aws-config", features = ["behavior-version-latest"] }
1313
aws-sdk-s3= { version = "1.83.0", path = "../../../sdk/s3", default-features = false }
14-
aws-smithy-runtime= { version = "1.8.1", path = "../../../sdk/aws-smithy-runtime", features = ["tls-rustls"] }
14+
aws-smithy-runtime= { version = "1.8.2", path = "../../../sdk/aws-smithy-runtime", features = ["tls-rustls"] }
1515

1616
[dependencies.tokio]
1717
version = "1.21.2"

examples/examples/dynamodb/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ tracing = "0.1"
1919
aws-config= { version = "1.6.1", path = "../../../sdk/aws-config", features = ["behavior-version-latest"] }
2020
aws-http= { version = "0.60.6", path = "../../../sdk/aws-http" }
2121
aws-sdk-dynamodb= { version = "1.72.0", path = "../../../sdk/dynamodb" }
22-
aws-smithy-runtime= { version = "1.8.1", path = "../../../sdk/aws-smithy-runtime", features = ["test-util"] }
22+
aws-smithy-runtime= { version = "1.8.2", path = "../../../sdk/aws-smithy-runtime", features = ["test-util"] }
2323
aws-smithy-types= { version = "1.3.0", path = "../../../sdk/aws-smithy-types" }
2424

2525
[dependencies.clap]

examples/examples/s3/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ serde_json = "1"
2525
chrono = "0.4.38"
2626
aws-config= { version = "1.6.1", path = "../../../sdk/aws-config", features = ["behavior-version-latest"] }
2727
aws-sdk-s3= { version = "1.83.0", path = "../../../sdk/s3", features = ["rt-tokio"] }
28-
aws-smithy-runtime= { version = "1.8.1", path = "../../../sdk/aws-smithy-runtime" }
28+
aws-smithy-runtime= { version = "1.8.2", path = "../../../sdk/aws-smithy-runtime" }
2929
aws-smithy-runtime-api= { version = "1.7.4", path = "../../../sdk/aws-smithy-runtime-api", features = ["client"] }
3030
aws-smithy-types= { version = "1.3.0", path = "../../../sdk/aws-smithy-types", features = ["http-body-0-4-x"] }
3131

examples/examples/testing/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ aws-config= { version = "1.6.1", path = "../../../sdk/aws-config", features = ["
1919
aws-credential-types= { version = "1.2.2", path = "../../../sdk/aws-credential-types", features = ["hardcoded-credentials"] }
2020
aws-sdk-s3= { version = "1.83.0", path = "../../../sdk/s3" }
2121
aws-smithy-types= { version = "1.3.0", path = "../../../sdk/aws-smithy-types" }
22-
aws-smithy-runtime= { version = "1.8.1", path = "../../../sdk/aws-smithy-runtime", features = ["test-util"] }
22+
aws-smithy-runtime= { version = "1.8.2", path = "../../../sdk/aws-smithy-runtime", features = ["test-util"] }
2323
aws-smithy-runtime-api= { version = "1.7.4", path = "../../../sdk/aws-smithy-runtime-api", features = ["test-util"] }
2424
aws-types= { version = "1.3.6", path = "../../../sdk/aws-types" }
2525

examples/examples/tls/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ path = "src/lib.rs"
1717
webpki-roots = "0.22.4"
1818
rustls = "0.20.6"
1919
aws-config= { version = "1.6.1", path = "../../../sdk/aws-config", features = ["behavior-version-latest"] }
20-
aws-smithy-runtime= { version = "1.8.1", path = "../../../sdk/aws-smithy-runtime" }
20+
aws-smithy-runtime= { version = "1.8.2", path = "../../../sdk/aws-smithy-runtime" }
2121
aws-sdk-kms= { version = "1.66.0", path = "../../../sdk/kms", default-features = false }
2222

2323
[dependencies.tokio]

examples/test-utils/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ http = "0.2"
1313
tokio = "1.33.0"
1414
aws-config= { version = "1.6.1", path = "../../sdk/aws-config" }
1515
aws-smithy-types= { version = "1.3.0", path = "../../sdk/aws-smithy-types" }
16-
aws-smithy-runtime= { version = "1.8.1", path = "../../sdk/aws-smithy-runtime", features = ["test-util"] }
16+
aws-smithy-runtime= { version = "1.8.2", path = "../../sdk/aws-smithy-runtime", features = ["test-util"] }
1717
aws-types= { version = "1.3.6", path = "../../sdk/aws-types" }
1818

1919
[lib]

sdk/accessanalyzer/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ version = "0.61.3"
3737
[dependencies.aws-smithy-runtime]
3838
path = "../aws-smithy-runtime"
3939
features = ["client"]
40-
version = "1.8.1"
40+
version = "1.8.2"
4141

4242
[dependencies.aws-smithy-runtime-api]
4343
path = "../aws-smithy-runtime-api"

sdk/accessanalyzer/src/operation/apply_archive_rule.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,7 @@ impl ApplyArchiveRule {
2727
.expect("correct error type")
2828
})
2929
};
30-
use ::tracing::Instrument;
3130
let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
32-
// Create a parent span for the entire operation. Includes a random, internal-only,
33-
// seven-digit ID for the operation orchestration so that it can be correlated in the logs.
34-
.instrument(::tracing::debug_span!(
35-
"AccessAnalyzer.ApplyArchiveRule",
36-
"rpc.service" = "AccessAnalyzer",
37-
"rpc.method" = "ApplyArchiveRule",
38-
"sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
39-
"rpc.system" = "aws-api",
40-
))
4131
.await
4232
.map_err(map_err)?;
4333
let output = context.finalize().map_err(map_err)?;
@@ -60,7 +50,17 @@ impl ApplyArchiveRule {
6050
>,
6151
> {
6252
let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
53+
use ::tracing::Instrument;
6354
::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("AccessAnalyzer", "ApplyArchiveRule", input, runtime_plugins, stop_point)
55+
// Create a parent span for the entire operation. Includes a random, internal-only,
56+
// seven-digit ID for the operation orchestration so that it can be correlated in the logs.
57+
.instrument(::tracing::debug_span!(
58+
"AccessAnalyzer.ApplyArchiveRule",
59+
"rpc.service" = "AccessAnalyzer",
60+
"rpc.method" = "ApplyArchiveRule",
61+
"sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
62+
"rpc.system" = "aws-api",
63+
))
6464
.await
6565
}
6666

0 commit comments

Comments
 (0)