-
- Downloads
Provide business metrics for RPC V2 CBOR, Gzip request compression, paginator, and waiter (#3793)
## Motivation and Context Version `User-Agent` header string and begin tracking business metrics in that header ## Description This PR versions `User-Agent` string and the version is set to `2.1`. Furthermore, we track business metrics for SDK features in `User-Agent` header. Specifically, we now track the following metrics in the User-Agent header: - RPC V2 CBOR (M) - Gzip request compression (L) - paginator (C) - waiter (B) Each letter corresponds to a metric value defined [in the specification](https://github.com/smithy-lang/smithy-rs/blob/3f3c874c9f16ad65e80e5dfb7a6b8076d6342149/aws/rust-runtime/aws-runtime/src/user_agent/metrics.rs#L207-L226)). #### Overall implementation strategy #### Since business metrics is an AWS-specific concept, the `aws-smithy-runtime` crate cannot directly reference it or call `AwsUserAgent::add_business_metric`. Instead, the crate tracks Smithy SDK features using the config bag with the `StoreAppend` mode. During the execution of `UserAgentInterceptor::modify_before_signing`, this method retrieves the SDK features from the config bag and converts them into business metrics. This implies that any SDK features—whether specific to Smithy or AWS—that we intend to track must be added to the config bag prior to the invocation of the `modify_before_signing` method. ## Testing - Added a test-only utility function, `assert_ua_contains_metric_values`, in the `aws-runtime` crate to verify the presence of metric values in the `User-Agent` string. Since the position of metric values in the `business-metrics` string may change as new metrics are introduced (e.g., previously `m/A` but now `m/C,A,B`), it is essential that this function accounts for potential variations and does not rely solely on substring matching. - Added unit and integration tests to verify tracking of the business metrics introduced in this PR: RPC V2 CBOR, Gzip request compression, paginator, and waiter. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
Showing
- aws/rust-runtime/Cargo.lock 1 addition, 1 deletionaws/rust-runtime/Cargo.lock
- aws/rust-runtime/aws-runtime/Cargo.toml 4 additions, 2 deletionsaws/rust-runtime/aws-runtime/Cargo.toml
- aws/rust-runtime/aws-runtime/src/user_agent.rs 31 additions, 7 deletionsaws/rust-runtime/aws-runtime/src/user_agent.rs
- aws/rust-runtime/aws-runtime/src/user_agent/interceptor.rs 62 additions, 31 deletionsaws/rust-runtime/aws-runtime/src/user_agent/interceptor.rs
- aws/rust-runtime/aws-runtime/src/user_agent/metrics.rs 27 additions, 0 deletionsaws/rust-runtime/aws-runtime/src/user_agent/metrics.rs
- aws/rust-runtime/aws-runtime/src/user_agent/test_util.rs 122 additions, 0 deletionsaws/rust-runtime/aws-runtime/src/user_agent/test_util.rs
- aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsRuntimeType.kt 3 additions, 0 deletions...n/kotlin/software/amazon/smithy/rustsdk/AwsRuntimeType.kt
- aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/UserAgentDecoratorTest.kt 68 additions, 0 deletions.../software/amazon/smithy/rustsdk/UserAgentDecoratorTest.kt
- aws/sdk/integration-tests/ec2/Cargo.toml 2 additions, 1 deletionaws/sdk/integration-tests/ec2/Cargo.toml
- aws/sdk/integration-tests/ec2/tests/paginators.rs 24 additions, 1 deletionaws/sdk/integration-tests/ec2/tests/paginators.rs
- aws/sdk/integration-tests/ec2/tests/waiters.rs 39 additions, 0 deletionsaws/sdk/integration-tests/ec2/tests/waiters.rs
- codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/RustClientCodegenPlugin.kt 2 additions, 0 deletions...thy/rust/codegen/client/smithy/RustClientCodegenPlugin.kt
- codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/StaticSdkFeatureTrackerDecorator.kt 60 additions, 0 deletions...smithy/customizations/StaticSdkFeatureTrackerDecorator.kt
- codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/PaginatorGenerator.kt 6 additions, 1 deletion...st/codegen/client/smithy/generators/PaginatorGenerator.kt
- codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/waiters/WaitableGenerator.kt 6 additions, 1 deletion...gen/client/smithy/generators/waiters/WaitableGenerator.kt
- codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/CargoDependency.kt 6 additions, 0 deletions...azon/smithy/rust/codegen/core/rustlang/CargoDependency.kt
- rust-runtime/aws-smithy-runtime/Cargo.toml 1 addition, 1 deletionrust-runtime/aws-smithy-runtime/Cargo.toml
- rust-runtime/aws-smithy-runtime/src/client.rs 2 additions, 0 deletionsrust-runtime/aws-smithy-runtime/src/client.rs
- rust-runtime/aws-smithy-runtime/src/client/sdk_feature.rs 19 additions, 0 deletionsrust-runtime/aws-smithy-runtime/src/client/sdk_feature.rs
- rust-runtime/inlineable/Cargo.toml 2 additions, 1 deletionrust-runtime/inlineable/Cargo.toml
Loading
Please register or sign in to comment