jrmccluskey commented on code in PR #22824:
URL: https://github.com/apache/beam/pull/22824#discussion_r955229634


##########
sdks/go/container/boot.go:
##########
@@ -121,6 +128,25 @@ func main() {
                os.Setenv("RUNNER_CAPABILITIES", 
strings.Join(info.GetRunnerCapabilities(), " "))
        }
 
+       enableGoogleCloudProfiler := strings.Contains(options, 
enableGoogleCloudProfilerOption)
+       if enableGoogleCloudProfiler {
+               if metadata := info.GetMetadata(); metadata != nil {
+                       if jobName, nameExists := metadata["job_name"]; 
nameExists {
+                               if jobId, idExists := metadata["job_id"]; 
idExists {
+                                       os.Setenv(cloudProfilingJobName, 
jobName)
+                                       os.Setenv(cloudProfilingJobID, jobId)
+                                       log.Printf("Cloud Profiling Job Name: 
%v, Job IDL %v", jobName, jobId)
+                               } else {
+                                       log.Println("Required job_id missing 
from metadata, profiling will not be enabled without it.")
+                               }
+                       } else {
+                               log.Println("Required job_name missing from 
metadata, profiling will not be enabled without it.")
+                       }
+               } else {
+                       log.Println("enable_google_cloud_profiler is set to 
true, but no metadata is received from provision server, profiling will not be 
enabled.")
+               }
+       }

Review Comment:
   Done, reasonable change (and also potentially worth making in the other boot 
scripts too)



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