goanpeca opened a new pull request, #41834:
URL: https://github.com/apache/beam/pull/41834
fixes #39573
The Python S3 filesystem client
(`apache_beam.io.aws.clients.s3.boto3_client.Client`) creates its boto3 client
without a botocore `Config`, so S3 requests from Beam carry only the stock
boto3 user agent. The other cloud clients in the Python SDK already identify
themselves: `gcsio.py` and the Bigtable write client send
`apache-beam/<version> (GPN:Beam)`, `bigquery_tools.py` sends
`apache-beam-<version>`, and the Datastore helper sends
`beam-python-sdk/<version>`.
This passes `config=Config(user_agent_extra='apache-beam/<version>')` to
`session.client(...)`, with the version taken from
`apache_beam.version.__version__` (the same source `gcsio.py` uses). botocore
appends `user_agent_extra` to the composed user agent, so the boto3, botocore,
OS and language segments are unchanged and only a suffix is added, for example
`Boto3/1.44.15 ... Botocore/1.44.15 apache-beam/2.79.0.dev`. Endpoint, region,
SSL and credential handling from `client_options.get_client_kwargs` are
untouched. This makes Beam's S3 traffic identifiable in server access logs when
diagnosing throttling or endpoint issues, including against S3-compatible
endpoints set with `--s3_endpoint_url`.
Tests: `boto3_client_test.py` gets `test_user_agent_contains_beam_version`,
which checks the `Config` passed to the mocked session.
`test_aws_options_passed_to_client` compares the full kwargs dict, so it now
drops `config` before comparing. `CHANGES.md` has an I/Os entry.
This is a fresh version of #39574, which was closed by the stale bot without
review; the change is rebased onto the new `client_options` code path.
R: @shunping
------------------------
Thank you for your contribution! Follow this checklist to help us
incorporate your contribution quickly and easily:
- [ ] If this contribution is large, please file an Apache [Individual
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
- [x] Replace these instructions with a description of your change and why
you have made it.
- [x] Mention the appropriate issue in your description (for example:
`addresses #123` or `fixes #456`).
- [x] Update `CHANGES.md` with noteworthy changes.
See
[CONTRIBUTING.md](https://github.com/apache/beam/blob/master/CONTRIBUTING.md)
for more details.
--
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]