shunping commented on code in PR #35903: URL: https://github.com/apache/beam/pull/35903#discussion_r2292529866
########## sdks/java/container/boot.go: ########## @@ -196,25 +196,22 @@ func main() { enableGoogleCloudProfiler := strings.Contains(options, enableGoogleCloudProfilerOption) enableGoogleCloudHeapSampling := strings.Contains(options, enableGoogleCloudHeapSamplingOption) if enableGoogleCloudProfiler { - if metadata := info.GetMetadata(); metadata != nil { - if jobName, nameExists := metadata["job_name"]; nameExists { - if jobId, idExists := metadata["job_id"]; idExists { - if enableGoogleCloudHeapSampling { - args = append(args, fmt.Sprintf(googleCloudProfilerAgentHeapArgs, jobName, jobId)) - } else { - args = append(args, fmt.Sprintf(googleCloudProfilerAgentBaseArgs, jobName, jobId)) - } - logger.Printf(ctx, "Turning on Cloud Profiling. Profile heap: %t", enableGoogleCloudHeapSampling) - } else { - logger.Printf(ctx, "Required job_id missing from metadata, profiling will not be enabled without it.") - } - } else { - logger.Printf(ctx, "Required job_name missing from metadata, profiling will not be enabled without it.") - } - } else { - logger.Printf(ctx, "enable_google_cloud_profiler is set to true, but no metadata is received from provision server, profiling will not be enabled.") - } - } + metadata := info.GetMetadata() + profilerServiceName := ExtractProfilerServiceName(options, metadata) + + if profilerServiceName != "" { + if jobId, idExists := metadata["job_id"]; idExists { Review Comment: Looks like the case of missing job name is no longer handled here. Any reason? -- 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-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org