You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/12/20 12:28:22 UTC

[GitHub] [beam] daria-malkova commented on a change in pull request #16241: [BEAM-13440] [Playground] Implement initialization of Cloud Logger

daria-malkova commented on a change in pull request #16241:
URL: https://github.com/apache/beam/pull/16241#discussion_r772322167



##########
File path: playground/backend/internal/environment/application.go
##########
@@ -90,14 +90,22 @@ type ApplicationEnvs struct {
 
 	// pipelineExecuteTimeout is timeout for code processing
 	pipelineExecuteTimeout time.Duration
+
+	// launchSite is a launch site of application
+	launchSite string
+
+	// googleProjectId is the Google Сloud project id
+	googleProjectId string
 }
 
 // NewApplicationEnvs constructor for ApplicationEnvs
-func NewApplicationEnvs(workingDir string, cacheEnvs *CacheEnvs, pipelineExecuteTimeout time.Duration) *ApplicationEnvs {
+func NewApplicationEnvs(workingDir, launchSite, googleCloudProjectId string, cacheEnvs *CacheEnvs, pipelineExecuteTimeout time.Duration) *ApplicationEnvs {

Review comment:
       googleCloudProjectId -> usually it is just named projectId

##########
File path: playground/backend/internal/environment/environment_service.go
##########
@@ -40,6 +40,10 @@ const (
 	cacheKeyExpirationTimeKey     = "KEY_EXPIRATION_TIME"
 	pipelineExecuteTimeoutKey     = "PIPELINE_EXPIRATION_TIMEOUT"
 	protocolTypeKey               = "PROTOCOL_TYPE"
+	launchSiteKey                 = "LAUNCH_SITE"
+	googleProjectIdKey            = "GOOGLE_CLOUD_PROJECT"
+	defaultLaunchSite             = "local"
+	defaultGoogleProjectId        = ""

Review comment:
       do we need a default project id if it is empty?

##########
File path: playground/backend/internal/logger/logger.go
##########
@@ -32,6 +33,25 @@ const (
 
 var handlers []Handler
 
+// SetupLogger constructs logger by application environment
+// Add handlers in root logger:
+//   CloudLoggingHandler - if server running on App Engine
+//   StdHandler - if server running locally
+func SetupLogger(ctx context.Context, launchSite, googleProjectId string) {
+	switch launchSite {
+	case "app_engine":

Review comment:
       constant




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