Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix request compression #3820

Merged
merged 7 commits into from
Sep 18, 2024
Merged

Conversation

Velfi
Copy link
Contributor

@Velfi Velfi commented Sep 5, 2024

Description

This PR includes several fixes for request compression:

  • aws_smithy_compression::body::compress::CompressedBody will no longer incorrectly return the inner body's SizeHint, returning SizeHint::default() instead.
  • Fixed a bug where compressed payloads would have an incorrect content length, causing those requests to hang.
  • Compress in-memory request payloads instead of the previous lazy approach.

Testing

Tests are included. Additionally, I ran a reproducer for a user issues to ensure that their use case works:

#[tokio::test]
async fn use_case_reproducer() {
    tracing_subscriber::fmt::init();
    let shared_config = aws_config::from_env()
        .region(aws_sdk_cloudwatch::config::Region::new("us-west-2"))
        .load()
        .await;
    let service_config = aws_sdk_cloudwatch::config::Config::from(&shared_config)
        .to_builder()
        .request_min_compression_size_bytes(1)
        .build();
    let client = Client::from_conf(service_config);

    tracing::info!("sending metrics...");
    client
        .put_metric_data()
        .namespace("CloudWatchTestMetricsBrivinc")
        .metric_data(
            aws_sdk_cloudwatch::types::MetricDatum::builder()
                .metric_name(format!("MyMetricNameIsALittleLong"))
                .value(0.0)
                .build(),
        )
        .send()
        .await
        .unwrap();
}

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Velfi Velfi requested review from a team as code owners September 5, 2024 16:24
Copy link

github-actions bot commented Sep 5, 2024

A new generated diff is ready to view.

A new doc preview is ready to view.

Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@Velfi Velfi changed the title don't pass through inner SizeHint for CompressedBody Fix request compression Sep 18, 2024
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Copy link
Contributor

@ysaito1001 ysaito1001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left minor comments, but LGTM!

Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Copy link
Contributor

@aajtodd aajtodd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix and ship (Yuki's callout).

Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@Velfi Velfi added this pull request to the merge queue Sep 18, 2024
Merged via the queue into main with commit 1cecc3b Sep 18, 2024
44 checks passed
@Velfi Velfi deleted the zhessler-fix-compressed-payload-content-length branch September 18, 2024 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants