-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
User agent 2.1: Track client features #3389
base: develop
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## develop #3389 +/- ##
==========================================
Coverage ? 93.08%
==========================================
Files ? 67
Lines ? 14588
Branches ? 0
==========================================
Hits ? 13579
Misses ? 1009
Partials ? 0 ☔ View full report in Codecov by Sentry. |
return token | ||
|
||
|
||
def reset_token(token): |
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.
This should be called reset_context
. Will fix in later revision.
Description
This PR implements scaffolding for tracking client feature usage in the user agent header. Features that we track are defined in
botocore.useragent._USERAGENT_FEATURE_MAPPINGS
. Whenever a trackable feature is used, its associated metric id is stored. When the user agent string is built, it retrieves all registered features and creates a comma-separated string with them/
prefix. For example, if a request is made using SigV4A signing, the user agent string may look like the following:Note the
m/S
component.Design
I prioritized an approach that tries to minimize invasiveness to the current codebase. Specifically, I wanted to avoid having to plumb some
features
variable to every method that registers a function, mainly so we wouldn't need to update the function signature of potentially all methods. This would also require higher level packages (Boto3, S3Transfer, AWS CLI) to plumb features they register.Initial features to track
There are 5 features tracked to start:
WAITER
: An operation called using a waiter.PAGINATOR
: An operation called using a paginator.S3_TRANSFER
: An operation called using the S3 Transfer Manager.ENDPOINT_OVERRIDE
: An operation called using a user provided endpoint URL.SIGV4A_SIGNING
: An operation called using sigv4a signing.S3Transfer usage will need to be registered in
boto3
and will require a small update tos3transfer
(to pass context from parent to child threads).Caveats
METHOD
attributes to determine the correct feature to register.