Skip to content

Commit 50c825b

Browse files
authored
Reducing verbosity of various logs (#3664)
## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here --> Our logs had several entries that were extremely verbose and made them harder to sort through. This change aims to reduce the verbosity of those logs to something more manageable. ## Description <!--- Describe your changes in detail --> - Removed the logging of the full IMDS Client struct, replaced with a message that it was truncated - Removed logging the full `Configbag` in a couple places in `RuntimeComponentsBuilder` - Removed logging of full `ProvideCredentials` objects in the CredentialsProviderChain` and replaced with just their names There are some verbose logs I did not remove because I was not sure of their usefulness. Most notably the `PartitionResolver` struct logs several hundred lines of region information each time it appears. Happy to truncate that as well if those logs aren't too helpful. ## Testing <!--- Please describe in detail how you tested your changes --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> This was tested locally by running the SDK [logging example](https://docs.aws.amazon.com/sdk-for-rust/latest/dg/logging.html) code with `RUST_LOG=trace` prepended to the `cargo run` command. For comparison, when saved as a .txt file, the old logs take up `2.8MB` and the new logs take `273KB` for the same operation. ## Checklist <!--- If a checkbox below is not applicable, then please DELETE it rather than leaving it unchecked --> - [x] I have updated `CHANGELOG.next.toml` if I made changes to the smithy-rs codegen or runtime crates ---- _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 a76dc18 commit 50c825b

File tree

6 files changed

+35
-7
lines changed

6 files changed

+35
-7
lines changed

CHANGELOG.next.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,10 @@
99
# message = "Fix typos in module documentation for generated crates"
1010
# references = ["smithy-rs#920"]
1111
# meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client | server | all"}
12-
# author = "rcoh"
12+
# author = "rcoh"
13+
14+
[[smithy-rs]]
15+
message = "Reduce verbosity of various debug logs"
16+
references = ["smithy-rs#3664"]
17+
meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client"}
18+
author = "landonxjames"

aws/rust-runtime/aws-config/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-config"
3-
version = "1.5.0"
3+
version = "1.5.1"
44
authors = [
55
"AWS Rust SDK Team <aws-sdk-rust@amazon.com>",
66
"Russell Cohen <rcoh@amazon.com>",

aws/rust-runtime/aws-config/src/imds/region.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,26 @@ use crate::provider_config::ProviderConfig;
1414
use aws_smithy_types::error::display::DisplayErrorContext;
1515
use aws_types::os_shim_internal::Env;
1616
use aws_types::region::Region;
17+
use std::fmt::Debug;
1718
use tracing::Instrument;
1819

1920
/// IMDSv2 Region Provider
2021
///
2122
/// This provider is included in the default region chain, so it does not need to be used manually.
22-
#[derive(Debug)]
2323
pub struct ImdsRegionProvider {
2424
client: Client,
2525
env: Env,
2626
}
2727

28+
impl Debug for ImdsRegionProvider {
29+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
30+
f.debug_struct("ImdsRegionProvider")
31+
.field("client", &"IMDS client truncated for readability")
32+
.field("env", &self.env)
33+
.finish()
34+
}
35+
}
36+
2837
const REGION_PATH: &str = "/latest/meta-data/placement/region";
2938

3039
impl ImdsRegionProvider {

aws/rust-runtime/aws-config/src/meta/credentials/chain.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use aws_credential_types::{
99
};
1010
use aws_smithy_types::error::display::DisplayErrorContext;
1111
use std::borrow::Cow;
12+
use std::fmt::Debug;
1213
use tracing::Instrument;
1314

1415
/// Credentials provider that checks a series of inner providers
@@ -31,11 +32,25 @@ use tracing::Instrument;
3132
/// .or_else("Profile", ProfileFileCredentialsProvider::builder().build());
3233
/// # }
3334
/// ```
34-
#[derive(Debug)]
3535
pub struct CredentialsProviderChain {
3636
providers: Vec<(Cow<'static, str>, Box<dyn ProvideCredentials>)>,
3737
}
3838

39+
impl Debug for CredentialsProviderChain {
40+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
41+
f.debug_struct("CredentialsProviderChain")
42+
.field(
43+
"providers",
44+
&self
45+
.providers
46+
.iter()
47+
.map(|provider| &provider.0)
48+
.collect::<Vec<&Cow<'static, str>>>(),
49+
)
50+
.finish()
51+
}
52+
}
53+
3954
impl CredentialsProviderChain {
4055
/// Create a `CredentialsProviderChain` that begins by evaluating this provider
4156
pub fn first_try(

rust-runtime/aws-smithy-runtime-api/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-api"
3-
version = "1.6.1"
3+
version = "1.6.2"
44
authors = ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>", "Zelda Hessler <zhessler@amazon.com>"]
55
description = "Smithy runtime types."
66
edition = "2021"

rust-runtime/aws-smithy-runtime-api/src/client/runtime_components.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,6 @@ impl RuntimeComponents {
483483
};
484484
}
485485

486-
tracing::trace!(runtime_components=?self, cfg=?cfg, "validating final config");
487486
for validator in self.config_validators() {
488487
validator.validate_final_config(self, cfg)?;
489488
}
@@ -875,7 +874,6 @@ impl RuntimeComponentsBuilder {
875874
};
876875
}
877876

878-
tracing::trace!(runtime_components=?self, cfg=?cfg, "validating base client config");
879877
for validator in self.config_validators() {
880878
validator.validate_base_client_config(self, cfg)?;
881879
}

0 commit comments

Comments
 (0)