goanpeca opened a new pull request, #39574:
URL: https://github.com/apache/beam/pull/39574

   Addresses #39573
   
   `apache_beam.io.aws.clients.s3.boto3_client.Client` builds its boto3 client 
without a botocore `Config`, so every S3 request Beam makes goes out with the 
stock boto3 user agent and carries nothing identifying the caller as Beam. The 
other cloud clients in the Python SDK all tag themselves already: `gcsio.py` 
sends `apache-beam/<version> (GPN:Beam)`, `bigquery_tools.py` sends 
`apache-beam-<version>`, and the Datastore helper sends 
`beam-python-sdk/<version>`. The S3 client is the odd one out.
   
   This passes `Config(user_agent_extra='apache-beam/%s' % 
beam_version.__version__)` when constructing the client. botocore appends 
`user_agent_extra` to the end of the composed user agent, so the boto3, 
botocore, platform, and language segments are all preserved and only a suffix 
is added. The version comes from `apache_beam.version.__version__`, the same 
source `gcsio.py` uses. The practical benefit is that Beam's S3 traffic becomes 
identifiable in server access logs, which helps when diagnosing throttling or 
endpoint problems against Amazon S3 and against any other S3-compatible 
endpoint reached through `--s3_endpoint_url`.
   
   Tests: a new `ClientUserAgentTest` in `client_test.py` constructs the client 
from a default `S3Options()` and asserts the composed 
`client.client.meta.config.user_agent` contains `apache-beam/<version>`. It is 
guarded with `@unittest.skipIf(boto3_client is None, ...)` following the 
pattern already used in `s3filesystem_test.py`, and client construction needs 
no credentials and no region, so it runs offline. yapf and ruff are clean on 
both files.
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us 
incorporate your contribution quickly and easily:
   
    - [ ] Mention the appropriate issue in your description (for example: 
`addresses #123`), if applicable. This will automatically add a link to the 
pull request in the issue. If you would like the issue to automatically close 
on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
    - [ ] Update `CHANGES.md` with noteworthy changes.
    - [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more 
tips on [how to make review process 
smoother](https://github.com/apache/beam/blob/master/CONTRIBUTING.md#make-the-reviewers-job-easier).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to