feat: add Diffgram user agent to S3 storage clients - #1634
Draft
goanpeca wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Related issue: #1633
boto3clients built byDataToolsS3andDataToolsMiniosend the stock botocore user agent, so Diffgram traffic is indistinguishable from any other boto3 caller in bucket access logs and storage side metrics. This appends adiffgram/<version>token to the existing agent string usingConfig.user_agent_extra, which is the supported botocore way to add to the user agent rather than replace it.The version is read from the existing
DIFFGRAM_VERSION_TAGsetting and falls back todevwhen it is not set, so there is no new configuration to manage and the module level constant cannot raise on import.Config(user_agent_extra=...).merge(config or Config())keeps every caller supplied option, so thesignature_version='s3v4'config used byIS_DIFFGRAM_S3_V4_SIGNATUREand by the MinIO connector still applies.Both S3 client factories are covered: the AWS one in
shared/data_tools_core_s3.pyand theendpoint_urlone inshared/data_tools_core_minio.py, which is also the path used for other S3 compatible endpoints.Resulting agent string, for example:
Boto3/1.18.1 md/Botocore#1.21.1 ua/2.0 os/linux lang/python#3.11.1 Botocore/1.21.1 diffgram/dev.No new settings, no new dependencies, and no change to endpoints, signing, verification, or request behavior.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.
I have...
!to the type prefix if Breaking Changes. (not applicable, this only adds a token to an outgoing header)signature_versionsurvives the merge)Breaking Changes including adding required params: none.
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.
I have...