You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "liferoad (via GitHub)" <gi...@apache.org> on 2024/04/25 13:51:25 UTC

Re: [PR] [Python] add job name to the gcs user-agent string [beam]

liferoad commented on code in PR #31097:
URL: https://github.com/apache/beam/pull/31097#discussion_r1579512595


##########
sdks/python/apache_beam/io/gcp/gcsio.py:
##########
@@ -110,12 +110,15 @@ def __init__(self, storage_client=None, pipeline_options=None):
         pipeline_options = PipelineOptions.from_dictionary(pipeline_options)
       credentials = auth.get_service_credentials(pipeline_options)
       if credentials:
+        job_name = pipeline_options.view_as(GoogleCloudOptions).job_name
+        if not job_name:
+          job_name = "UNKNOWN"
         storage_client = storage.Client(
             credentials=credentials.get_google_auth_credentials(),
             project=pipeline_options.view_as(GoogleCloudOptions).project,
             extra_headers={
-                "User-Agent": "apache-beam/%s (GPN:Beam)" %
-                beam_version.__version__
+                "User-Agent": "apache-beam/%s job-name/%s (GPN:Beam)" %
+                (beam_version.__version__, job_name)

Review Comment:
   or we could add a new key like "Job-Name"?



-- 
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