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

Add Gzip request compression feature #2344

Merged
merged 11 commits into from
Dec 7, 2023
Merged

Conversation

wty-Bryant
Copy link
Contributor

Add Gzip request compression feature to operations supporting that trait. Insert middleware to those op's stack and enable toggling the compression via client options, env config and shared config profile.

@wty-Bryant wty-Bryant requested a review from a team as a code owner November 2, 2023 19:25
@@ -370,6 +389,41 @@ func (c EnvConfig) getAppID(context.Context) (string, bool, error) {
return c.AppID, len(c.AppID) > 0, nil
}

func setRequestMinCompressSizeBytes(bytes **int64) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we using a double pointer? **int64?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this threshold field's default value is not 0, so to distinguish whether or not it has been configured it is represented as a *int64 in config, and thus we need to set it using double pointer

Copy link
Contributor

Choose a reason for hiding this comment

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

I would have just used/implemented setInt[64]PtrFromEnv and then inlined the range check, but this is fine.

},
WantErr: true,
},
45: {
Copy link
Contributor

Choose a reason for hiding this comment

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

whats bad about this case? is there a limit on the size? if so, can we add a comment here specifying that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup, the size exceeds max by 1 byte. I can add a comment

return nil
}

func updateDisableRequestCompression(disable **bool, sec ini.Section, key string) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

why double pointer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same reason above

Copy link
Contributor

Choose a reason for hiding this comment

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

FYI you can just use updateBoolPtrFromEnv or whatever it's called.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updateBoolPtr in sharedconfig doesn't return error for invalid value, I will just keep that

@isaiahvita
Copy link
Contributor

can you also generate at least 1 service so we can see. ideally, if there is not a specific service youre testing, i like to generate one vanilla service (like lambda), and S3

Copy link
Contributor Author

@wty-Bryant wty-Bryant left a comment

Choose a reason for hiding this comment

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

for this issue, I actually generate and test cloudwatch.PutMetricData() op with the compression trait, I can publish that first for your testing

if err != nil {
return fmt.Errorf("invalid value for env var, %s=%s, need int64",
awsRequestMinCompressionSizeBytes, b)
} else if byte < 0 || byte > 10485760 {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you pull (exporting if needed) the const from the smithy-go side?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

Copy link
Contributor

@lucix-aws lucix-aws left a comment

Choose a reason for hiding this comment

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

fixandship, great work

@wty-Bryant wty-Bryant merged commit be06f02 into main Dec 7, 2023
12 checks passed
@wty-Bryant wty-Bryant deleted the feat-request-compression-2 branch December 7, 2023 07:51
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.

None yet

3 participants