From 2bfdaa602bf2cfa0f748d3eccc53979cbbe055d7 Mon Sep 17 00:00:00 2001 From: Miguel Varela Ramos Date: Fri, 9 Apr 2021 11:55:20 +0200 Subject: [PATCH 1/2] Improve async gateway logging with tags --- async-gateway/main.go | 6 ++++-- async-gateway/service.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/async-gateway/main.go b/async-gateway/main.go index b37a51661f..2be97bfb92 100644 --- a/async-gateway/main.go +++ b/async-gateway/main.go @@ -30,7 +30,8 @@ import ( ) const ( - _defaultPort = "8080" + _defaultPort = "8080" + _asyncAPIKind = "AsyncAPI" ) func createLogger() (*zap.Logger, error) { @@ -101,6 +102,8 @@ func main() { log.Fatal("apiName argument was not provided") } + log = log.With(zap.String("apiKind", _asyncAPIKind), zap.String("apiName", apiName)) + sess, err := session.NewSessionWithOptions(session.Options{ Config: aws.Config{ Region: region, @@ -112,7 +115,6 @@ func main() { } s3Storage := NewS3(sess, *bucket) - sqsQueue := NewSQS(*queueURL, sess) svc := NewService(*clusterName, apiName, sqsQueue, s3Storage, log) diff --git a/async-gateway/service.go b/async-gateway/service.go index 3769f787c6..f11257bdff 100644 --- a/async-gateway/service.go +++ b/async-gateway/service.go @@ -53,7 +53,7 @@ func NewService(clusterName, apiName string, queue Queue, storage Storage, logge // CreateWorkload enqueues an async workload request and uploads the request payload to S3 func (s *service) CreateWorkload(id string, payload io.Reader, contentType string) (string, error) { prefix := s.workloadStoragePrefix() - log := s.logger.With(zap.String("id", "id"), zap.String("contentType", contentType)) + log := s.logger.With(zap.String("id", id), zap.String("contentType", contentType)) payloadPath := fmt.Sprintf("%s/%s/payload", prefix, id) log.Debug("uploading payload", zap.String("path", payloadPath)) From d248e176ff530817afbcaa209d57ea8e569c84ee Mon Sep 17 00:00:00 2001 From: Miguel Varela Ramos Date: Mon, 12 Apr 2021 12:09:06 +0200 Subject: [PATCH 2/2] Remove unnecessary logging tags --- async-gateway/main.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/async-gateway/main.go b/async-gateway/main.go index 2be97bfb92..f24f0da602 100644 --- a/async-gateway/main.go +++ b/async-gateway/main.go @@ -30,8 +30,7 @@ import ( ) const ( - _defaultPort = "8080" - _asyncAPIKind = "AsyncAPI" + _defaultPort = "8080" ) func createLogger() (*zap.Logger, error) { @@ -102,8 +101,6 @@ func main() { log.Fatal("apiName argument was not provided") } - log = log.With(zap.String("apiKind", _asyncAPIKind), zap.String("apiName", apiName)) - sess, err := session.NewSessionWithOptions(session.Options{ Config: aws.Config{ Region: region,