-
Notifications
You must be signed in to change notification settings - Fork 40
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
UserAgent Updates #414
UserAgent Updates #414
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #414 +/- ##
=======================================
Coverage 89.37% 89.37%
=======================================
Files 20 20
Lines 5854 5866 +12
=======================================
+ Hits 5232 5243 +11
- Misses 622 623 +1
|
source/s3_util.c
Outdated
|
||
const size_t user_agent_product_version_length = | ||
g_user_agent_header_product_name.len + forward_slash.len + g_s3_client_version.len; | ||
struct aws_byte_cursor platform_cursor = aws_s3_get_current_platform_info()->instance_type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussion point: This call can result in an imds call for one time. Should we define a new API which returns instance type only if we know it already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated it to only use cached results.
source/s3_platform_info.c
Outdated
if (!cached_only) { | ||
aws_s3_get_ec2_instance_type(loader); | ||
} | ||
/* will never be mutated after the above call. */ | ||
return &loader->lock_data.current_env_platform_info; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmmm, we are touching the lock_data. I haven't dig deep into the implementation, but the comment says "will never be mutated after the above call", but, we can now skip aws_s3_get_ec2_instance_type
, will it be a possible race condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks in theory, yes. In practice, this would not have occurred since the flow is that this API is called first to determine target_throughput, and the S3 client is created later with that target_throughput. I have updated the method to use an API with locks instead, since it can have a race condition in theory and in practice in the future.
Description of changes:
Adds platform/ec2InstanceType if available to the user agent header. Here is new header value:
or
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.