Abacn commented on code in PR #34062:
URL: https://github.com/apache/beam/pull/34062#discussion_r1970250877


##########
sdks/python/apache_beam/io/gcp/gcsio.py:
##########
@@ -125,14 +126,32 @@ def create_storage_client(pipeline_options, 
use_credentials=True):
     from google.api_core import client_info
     beam_client_info = client_info.ClientInfo(
         user_agent="apache-beam/%s (GPN:Beam)" % beam_version.__version__)
+
+    # Note: Custom audit entries with "job" key will overwrite this default.
+    extra_headers = {
+        "x-goog-custom-audit-job": google_cloud_options.job_name
+        if google_cloud_options.job_name else "UNKNOWN"

Review Comment:
   wondering if we should attach job_id here (if run on Dataflow). The original 
feature request mentioned that due to job name not unique, while job id is 
unique, and need job id identify the exact Dataflow job



##########
sdks/python/apache_beam/io/gcp/gcsio.py:
##########
@@ -125,14 +126,32 @@ def create_storage_client(pipeline_options, 
use_credentials=True):
     from google.api_core import client_info
     beam_client_info = client_info.ClientInfo(
         user_agent="apache-beam/%s (GPN:Beam)" % beam_version.__version__)
+
+    # Note: Custom audit entries with "job" key will overwrite this default.
+    extra_headers = {
+        "x-goog-custom-audit-job": google_cloud_options.job_name
+        if google_cloud_options.job_name else "UNKNOWN"
+    }
+
+    if google_cloud_options.custom_audit_entries is not None:
+      for entry in google_cloud_options.custom_audit_entries:
+        if entry.startswith('{'):
+          # in the format of {'key': value'}
+          sub_entries = ast.literal_eval(entry)

Review Comment:
   I understand `json.loads` is the purpose here?



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