Skip to content
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

Include "(GPN:Beam)" in user-agent of GCS HTTP request header for Java. #26770

Merged
merged 4 commits into from May 23, 2023
Merged

Include "(GPN:Beam)" in user-agent of GCS HTTP request header for Java. #26770

merged 4 commits into from May 23, 2023

Conversation

ghost
Copy link

@ghost ghost commented May 18, 2023

This PR should fix #26644 for Java SDKs.

  • Append "(GPN:Beam)" to the application name, which is then used in constructing the user agent string by GCS client APIs.
  • Add a unit test.

For more details, please see the comment here.


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.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI.

* Prepend "(GPN:Beam)" to the application name, which is then used in constructing the user agent string by GCS client APIs.
* Add a unit test.
@ghost ghost changed the title Include "(GPN:Beam)" in the user agent of GCS HTTP request header. Include "(GPN:Beam)" in the user agent of GCS HTTP request header for Java. May 18, 2023
@ghost ghost changed the title Include "(GPN:Beam)" in the user agent of GCS HTTP request header for Java. Include "(GPN:Beam)" in user-agent of GCS HTTP request header for Java. May 18, 2023
@github-actions
Copy link
Contributor

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @Abacn for label java.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@ghost
Copy link
Author

ghost commented May 19, 2023

Run Java_Examples_Dataflow PreCommit

@bvolpato
Copy link
Contributor

Run Java PreCommit

@bvolpato
Copy link
Contributor

Run Java_GCP_IO_Direct PreCommit

Storage.Objects.Get getObject = storageClient.objects().get("testbucket", "testobject");
// An example of user agent string will be like
// "TransportTest (GPN:Beam) Google-API-Java-Client/2.0.0"
assertThat(getObject.getRequestHeaders().getUserAgent(), containsString("(GPN:Beam)"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we discovered the possible problem in code review, how about also checking that the userAgent string is valid. Or at least that if you split it on space that the GPN:Beam is not the first.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@johnjcasey johnjcasey merged commit 6d928db into apache:master May 23, 2023
@ghost ghost deleted the shunping-playpen branch May 23, 2023 14:11
cushon pushed a commit to cushon/beam that referenced this pull request May 24, 2024
…a. (apache#26770)

* Include "(GPN:Beam)" in the user agent of GCS HTTP request header.

* Prepend "(GPN:Beam)" to the application name, which is then used in constructing the user agent string by GCS client APIs.
* Add a unit test.

* Run spotlessApply for format.

* Add '(GPN:Beam)' after the origin application name

* Check and ensure the user agent string meets the minimum requirement.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Update GCSFilesystem User Agent to report being beam
4 participants