You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "johnjcasey (via GitHub)" <gi...@apache.org> on 2023/05/10 17:04:54 UTC
[GitHub] [beam] johnjcasey opened a new issue, #26644: [Task]: Update GCSFilesystem User Agent to report being beam
johnjcasey opened a new issue, #26644:
URL: https://github.com/apache/beam/issues/26644
### What needs to happen?
As a request from GCS, update the user agent when connecting to the GCS Filesystem to include "GPN:Beam".
This way, GCS can better identify incoming traffic, and identify it as coming from Beam as opposed to any other source.
See where we set the application name for Java: https://github.com/apache/beam/blob/master/sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/options/GcpOptions.java#L503
### Issue Priority
Priority: 2 (default / most normal work should be filed as P2)
### Issue Components
- [X] Component: Python SDK
- [X] Component: Java SDK
- [X] Component: Go SDK
- [ ] Component: Typescript SDK
- [X] Component: IO connector
- [ ] Component: Beam examples
- [ ] Component: Beam playground
- [ ] Component: Beam katas
- [ ] Component: Website
- [ ] Component: Spark Runner
- [ ] Component: Flink Runner
- [ ] Component: Samza Runner
- [ ] Component: Twister2 Runner
- [ ] Component: Hazelcast Jet Runner
- [ ] Component: Google Cloud Dataflow Runner
--
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: github-unsubscribe@beam.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] kennknowles commented on issue #26644: [Task]: Update GCSFilesystem User Agent to report being beam
Posted by "kennknowles (via GitHub)" <gi...@apache.org>.
kennknowles commented on issue #26644:
URL: https://github.com/apache/beam/issues/26644#issuecomment-1553728338
Noting that the parentheses are semantic: https://stackoverflow.com/questions/2601372/what-is-the-standard-format-for-a-browsers-user-agent-string
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] johnjcasey commented on issue #26644: [Task]: Update GCSFilesystem User Agent to report being beam
Posted by "johnjcasey (via GitHub)" <gi...@apache.org>.
johnjcasey commented on issue #26644:
URL: https://github.com/apache/beam/issues/26644#issuecomment-1563256925
Re-opened as this change needs to be made in python as well
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] johnjcasey commented on issue #26644: [Task]: Update GCSFilesystem User Agent to report being beam
Posted by "johnjcasey (via GitHub)" <gi...@apache.org>.
johnjcasey commented on issue #26644:
URL: https://github.com/apache/beam/issues/26644#issuecomment-1549715036
I updated the ticket to include the parentheses that were also requested
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] Jack8861 commented on issue #26644: [Task]: Update GCSFilesystem User Agent to report being beam
Posted by "Jack8861 (via GitHub)" <gi...@apache.org>.
Jack8861 commented on issue #26644:
URL: https://github.com/apache/beam/issues/26644#issuecomment-1549032764
> @Jack8861, are you working on this?
No, @liferoad , you can go ahead... I need to look into the project before i start contributing
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] lostluck commented on issue #26644: [Task]: Update GCSFilesystem User Agent to report being beam
Posted by "lostluck (via GitHub)" <gi...@apache.org>.
lostluck commented on issue #26644:
URL: https://github.com/apache/beam/issues/26644#issuecomment-1544365148
Similarly for Go, the [`withUserAgent`](https://pkg.go.dev/google.golang.org/api@v0.121.0/option#WithUserAgent) needs to be set as a client option in both spots in the [filesystem abstraction](https://github.com/apache/beam/blob/master/sdks/go/pkg/beam/io/filesystem/gcs/gcs.go#L49) and in both spots in [gcsx the helper package](https://github.com/apache/beam/blob/master/sdks/go/pkg/beam/util/gcsx/gcs.go#L34).
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] johnjcasey closed issue #26644: [Task]: Update GCSFilesystem User Agent to report being beam
Posted by "johnjcasey (via GitHub)" <gi...@apache.org>.
johnjcasey closed issue #26644: [Task]: Update GCSFilesystem User Agent to report being beam
URL: https://github.com/apache/beam/issues/26644
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] shunping-google commented on issue #26644: [Task]: Update GCSFilesystem User Agent to report being beam
Posted by "shunping-google (via GitHub)" <gi...@apache.org>.
shunping-google commented on issue #26644:
URL: https://github.com/apache/beam/issues/26644#issuecomment-1553900277
> https://www.rfc-editor.org/rfc/rfc7231#section-5.5.3 is the spec.
Thank you for pointing this out, Kenn!
The way I added the requested string is incorrect. The spec states that the product name should go first, followed by more product names or comments. In our case, "(GPN:Beam)" is a comment and should be placed after the application name.
The correct user agent string in my former example should be:
"TransportTest **(GPN:Beam)** Google-API-Java-Client/2.0.0".
Note that there will be an empty space between adjacent product names and comments.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] shunping-google commented on issue #26644: [Task]: Update GCSFilesystem User Agent to report being beam
Posted by "shunping-google (via GitHub)" <gi...@apache.org>.
shunping-google commented on issue #26644:
URL: https://github.com/apache/beam/issues/26644#issuecomment-1550324977
.take-issue
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] liferoad commented on issue #26644: [Task]: Update GCSFilesystem User Agent to report being beam
Posted by "liferoad (via GitHub)" <gi...@apache.org>.
liferoad commented on issue #26644:
URL: https://github.com/apache/beam/issues/26644#issuecomment-1548020463
@jack8861, are you working on this?
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] shunping-google commented on issue #26644: [Task]: Update GCSFilesystem User Agent to report being beam
Posted by "shunping-google (via GitHub)" <gi...@apache.org>.
shunping-google commented on issue #26644:
URL: https://github.com/apache/beam/issues/26644#issuecomment-1553358649
The Beam Java APIs to perform operations on GCS are defined in `org.apache.beam.sdk.extensions.gcp.util.GcsUtil.java`. Specifically, the private instance variable `storageClient` of the `Storage` class [(code link)](https://github.com/apache/beam/blob/release-2.47.0/sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/util/GcsUtil.java#L166) is the GCS client API provider. For different GCS operations, storageClient internally constructs the HTTP requests accordingly and send them to GCS for execution. The user agent in the HTTP header is assembled when an HTTP request is constructed.
There are two code paths of invoking GCS APIs in GcsUtil:
* One code path of invoking GCS APIs can be seen in the public method [getObject](https://github.com/apache/beam/blob/release-2.47.0/sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/util/GcsUtil.java#L336) in GcsUtil. It constructs the Get operation request in the following chain:
`com.google.api.services.storage.Storage.Objects.Get`
–> `com.google.api.services.storage.StorageRequest`
–> `com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest`
–> `com.google.api.client.googleapis.services.AbstractGoogleClientRequest`
Inside `AbstractGoogleClientRequest`, the `applicationName` is included as a prefix in the user agent string[(code link)](https://github.com/googleapis/google-api-java-client/blob/v2.2.0/google-api-client/src/main/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequest.java#L131).
* A slightly different code path is in the public method [SeekableByteChannel](https://github.com/apache/beam/blob/release-2.47.0/sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/util/GcsUtil.java#L463) in GcsUtil, where the public method [open](https://github.com/GoogleCloudDataproc/hadoop-connectors/blob/v2.2.6/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorage.java#L155) of the GoogleCloudStorage is called. However, it also internally calls the GCS client API provider previously mentioned to construct HTTP requests: [code link 1](https://github.com/GoogleCloudDataproc/hadoop-connectors/blob/v2.2.6/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageImpl.java#L804), [code link 2](https://github.com/GoogleCloudDataproc/hadoop-connectors/blob/v2.2.6/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageReadChannel.java#L1125), [code link 3](https://github.com/GoogleCloudDataproc/hadoop-
connectors/blob/v2.2.6/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/StorageRequestFactory.java#L40).
* Notice in either code path, `applicationName` under the `Storage` class object is the prefix of the user agent string.
Therefore, to add the requested string "(GPN:Beam)” in the user agent, I propose to prepend it to the original applicationName when creating the builder object of the `Storage` class in [Transport](https://github.com/apache/beam/blob/release-2.47.0/sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/util/Transport.java#L104).
Here is an example user agent string before and after the change.
Before:
"TransportTest Google-API-Java-Client/2.0.0"
After:
"**(GPN:Beam)** TransportTest Google-API-Java-Client/2.0.0"
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] kennknowles commented on issue #26644: [Task]: Update GCSFilesystem User Agent to report being beam
Posted by "kennknowles (via GitHub)" <gi...@apache.org>.
kennknowles commented on issue #26644:
URL: https://github.com/apache/beam/issues/26644#issuecomment-1553730178
https://www.rfc-editor.org/rfc/rfc7231#section-5.5.3 is the spec.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] johnjcasey closed issue #26644: [Task]: Update GCSFilesystem User Agent to report being beam
Posted by "johnjcasey (via GitHub)" <gi...@apache.org>.
johnjcasey closed issue #26644: [Task]: Update GCSFilesystem User Agent to report being beam
URL: https://github.com/apache/beam/issues/26644
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org