Unverified Commit c0f81733 authored by ysaito1001's avatar ysaito1001 Committed by GitHub
Browse files

Allow User Agent to accept business metrics (#3781)

## Motivation and Context
This PR lays the groundwork for emitting and tracking business metrics
related to features like waiters, request compression, and S3 express
within the Rust SDKs. It introduces `BusinessMetric` to the `user_agent`
module and updates `AwsUserAgent` to support its integration.

## Description
While establishing the groundwork for the said motivation, this PR does
not send metrics from features yet.
The PR deprecates existing feature and config metadata, which are now
superseded by the new business metrics.

Related tasks include
- implementing versioning for the user agent string format, e.g.
`ua/2.0` (note that including a user agent version string to
`x-amz-user-agent` could cause many connection recording tests to fail
and may also break semver check in CI just like the [content-length
enforcement test](https://github.com/smithy-lang/smithy-rs/pull/3620)
needed to be disabled to work around it)
- sending metrics from recently implement features, maybe starting with
request compression and RPC V2 Cbor (this will also modify
`x-amz-user-agent` in connection recording tests, so the argument above
applies)

## Testing
- Added unit tests for `BusinessMetric` and `AwsUserAgent`
- Existing tests in CI

## Checklist
- [x] For changes to the AWS SDK, generated SDK code, or SDK runtime
crates, I have created a changelog entry Markdown file in the
`.changelog` directory, specifying "aws-sdk-rust" 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._
parent bb1971a1
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
---
applies_to:
- aws-sdk-rust
authors:
- ysaito1001
references:
- smithy-rs#3781
breaking: false
new_feature: false
bug_fix: false
---
Allow [AwsUserAgent](https://docs.rs/aws-runtime/1.3.1/aws_runtime/user_agent/struct.AwsUserAgent.html) to incorporate business metrics, which now deprecates the existing feature and config metadata.
+178 −5
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ version = "0.60.3"

[[package]]
name = "aws-http"
version = "0.60.5"
version = "0.60.6"
dependencies = [
 "aws-runtime",
]
@@ -149,7 +149,7 @@ dependencies = [

[[package]]
name = "aws-runtime"
version = "1.3.1"
version = "1.4.0"
dependencies = [
 "arbitrary",
 "aws-credential-types",
@@ -163,12 +163,14 @@ dependencies = [
 "aws-types",
 "bytes",
 "bytes-utils",
 "convert_case",
 "fastrand",
 "futures-util",
 "http 0.2.12",
 "http 1.1.0",
 "http-body 0.4.6",
 "http-body 1.0.0",
 "once_cell",
 "percent-encoding",
 "pin-project-lite",
 "proptest",
@@ -282,21 +284,24 @@ dependencies = [

[[package]]
name = "aws-smithy-protocol-test"
version = "0.60.7"
version = "0.62.0"
dependencies = [
 "assert-json-diff",
 "aws-smithy-runtime-api",
 "base64-simd",
 "cbor-diag",
 "http 0.2.12",
 "pretty_assertions",
 "regex-lite",
 "roxmltree",
 "serde_cbor",
 "serde_json",
 "thiserror",
]

[[package]]
name = "aws-smithy-runtime"
version = "1.6.1"
version = "1.6.2"
dependencies = [
 "aws-smithy-async",
 "aws-smithy-http",
@@ -449,6 +454,15 @@ dependencies = [
 "generic-array",
]

[[package]]
name = "bs58"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4"
dependencies = [
 "tinyvec",
]

[[package]]
name = "bumpalo"
version = "3.16.0"
@@ -477,6 +491,25 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"

[[package]]
name = "cbor-diag"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc245b6ecd09b23901a4fbad1ad975701fd5061ceaef6afa93a2d70605a64429"
dependencies = [
 "bs58",
 "chrono",
 "data-encoding",
 "half 2.4.1",
 "nom",
 "num-bigint",
 "num-rational",
 "num-traits",
 "separator",
 "url",
 "uuid",
]

[[package]]
name = "cc"
version = "1.0.99"
@@ -494,6 +527,15 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[package]]
name = "chrono"
version = "0.4.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
dependencies = [
 "num-traits",
]

[[package]]
name = "ciborium"
version = "0.2.2"
@@ -518,7 +560,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9"
dependencies = [
 "ciborium-io",
 "half",
 "half 2.4.1",
]

[[package]]
@@ -552,6 +594,15 @@ version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"

[[package]]
name = "convert_case"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca"
dependencies = [
 "unicode-segmentation",
]

[[package]]
name = "core-foundation"
version = "0.9.4"
@@ -694,6 +745,12 @@ dependencies = [
 "typenum",
]

[[package]]
name = "data-encoding"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2"

[[package]]
name = "der"
version = "0.6.1"
@@ -923,6 +980,12 @@ dependencies = [
 "tracing",
]

[[package]]
name = "half"
version = "1.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403"

[[package]]
name = "half"
version = "2.4.1"
@@ -1079,6 +1142,16 @@ dependencies = [
 "webpki-roots",
]

[[package]]
name = "idna"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
dependencies = [
 "unicode-bidi",
 "unicode-normalization",
]

[[package]]
name = "indexmap"
version = "2.2.6"
@@ -1218,6 +1291,12 @@ version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"

[[package]]
name = "minimal-lexical"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"

[[package]]
name = "miniz_oxide"
version = "0.7.4"
@@ -1238,6 +1317,16 @@ dependencies = [
 "windows-sys 0.48.0",
]

[[package]]
name = "nom"
version = "7.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
dependencies = [
 "memchr",
 "minimal-lexical",
]

[[package]]
name = "nu-ansi-term"
version = "0.46.0"
@@ -1248,6 +1337,16 @@ dependencies = [
 "winapi",
]

[[package]]
name = "num-bigint"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"
dependencies = [
 "num-integer",
 "num-traits",
]

[[package]]
name = "num-conv"
version = "0.1.0"
@@ -1263,6 +1362,17 @@ dependencies = [
 "num-traits",
]

[[package]]
name = "num-rational"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"
dependencies = [
 "num-bigint",
 "num-integer",
 "num-traits",
]

[[package]]
name = "num-traits"
version = "0.2.19"
@@ -1821,6 +1931,12 @@ version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"

[[package]]
name = "separator"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f97841a747eef040fcd2e7b3b9a220a7205926e60488e673d9e4926d27772ce5"

[[package]]
name = "serde"
version = "1.0.203"
@@ -1830,6 +1946,16 @@ dependencies = [
 "serde_derive",
]

[[package]]
name = "serde_cbor"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5"
dependencies = [
 "half 1.8.3",
 "serde",
]

[[package]]
name = "serde_derive"
version = "1.0.203"
@@ -2053,6 +2179,21 @@ dependencies = [
 "serde_json",
]

[[package]]
name = "tinyvec"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938"
dependencies = [
 "tinyvec_macros",
]

[[package]]
name = "tinyvec_macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"

[[package]]
name = "tokio"
version = "1.38.0"
@@ -2212,18 +2353,50 @@ version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94"

[[package]]
name = "unicode-bidi"
version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75"

[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"

[[package]]
name = "unicode-normalization"
version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5"
dependencies = [
 "tinyvec",
]

[[package]]
name = "unicode-segmentation"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202"

[[package]]
name = "untrusted"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"

[[package]]
name = "url"
version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
dependencies = [
 "form_urlencoded",
 "idna",
 "percent-encoding",
]

[[package]]
name = "uuid"
version = "1.8.0"
+1 −1
Original line number Diff line number Diff line
[package]
name = "aws-http"
version = "0.60.5"
version = "0.60.6"
authors = ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>", "Russell Cohen <rcoh@amazon.com>"]
description = "This crate is no longer used by the AWS SDK and is deprecated."
edition = "2021"
+6 −4
Original line number Diff line number Diff line
@@ -31,18 +31,20 @@ pub type InvalidMetadataValue = aws_runtime::user_agent::InvalidMetadataValue;
)]
pub type AdditionalMetadata = aws_runtime::user_agent::AdditionalMetadata;

/// Use aws_runtime::user_agent::FeatureMetadata instead.
/// Use aws_runtime::user_agent::BusinessMetric instead.
#[deprecated(
    since = "0.60.2",
    note = "Use aws_runtime::user_agent::FeatureMetadata instead."
    note = "Use aws_runtime::user_agent::BusinessMetric instead."
)]
#[allow(deprecated)]
pub type FeatureMetadata = aws_runtime::user_agent::FeatureMetadata;

/// Use aws_runtime::user_agent::ConfigMetadata instead.
/// Use aws_runtime::user_agent::BusinessMetric instead.
#[deprecated(
    since = "0.60.2",
    note = "Use aws_runtime::user_agent::ConfigMetadata instead."
    note = "Use aws_runtime::user_agent::BusinessMetric instead."
)]
#[allow(deprecated)]
pub type ConfigMetadata = aws_runtime::user_agent::ConfigMetadata;

/// Use aws_runtime::user_agent::FrameworkMetadata instead.
+3 −1
Original line number Diff line number Diff line
[package]
name = "aws-runtime"
version = "1.3.1"
version = "1.4.0"
authors = ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>"]
description = "Runtime support code for the AWS SDK. This crate isn't intended to be used directly."
edition = "2021"
@@ -30,6 +30,7 @@ http-02x = { package = "http", version = "0.2.3" }
http-body-04x = { package = "http-body", version = "0.4.5" }
http-1x = { package = "http", version = "1.1.0", optional = true }
http-body-1x = { package = "http-body", version = "1.0.0", optional = true }
once_cell = "1.18.0"
percent-encoding = "2.1.0"
pin-project-lite = "0.2.9"
tracing = "0.1"
@@ -43,6 +44,7 @@ aws-smithy-protocol-test = { path = "../../../rust-runtime/aws-smithy-protocol-t
aws-smithy-runtime-api = { path = "../../../rust-runtime/aws-smithy-runtime-api", features = ["test-util"] }
aws-smithy-types = { path = "../../../rust-runtime/aws-smithy-types", features = ["test-util"] }
bytes-utils = "0.1.2"
convert_case = "0.6.0"
futures-util = { version = "0.3.29", default-features = false }
proptest = "1.2"
serde = { version = "1", features = ["derive"]}
Loading