From 1ff5a479d8593d10035e600dd93aa6a87b902f4a Mon Sep 17 00:00:00 2001 From: diogo-nogueira-freiheit Date: Tue, 15 Oct 2024 10:52:57 +0200 Subject: [PATCH 1/4] Made the logs clearer --- services/frontend-service/pkg/service/batch.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/frontend-service/pkg/service/batch.go b/services/frontend-service/pkg/service/batch.go index cb7a77b77..d57670c54 100644 --- a/services/frontend-service/pkg/service/batch.go +++ b/services/frontend-service/pkg/service/batch.go @@ -19,6 +19,7 @@ package service import ( "context" "errors" + "fmt" "time" api "github.com/freiheit-com/kuberpult/pkg/api/v1" @@ -45,9 +46,9 @@ func (b *BatchServiceWithDefaultTimeout) ProcessBatch(ctx context.Context, req * if ctx.Err() != nil { if context.Cause(ctx) == kuberpultTimeoutError { - logger.FromContext(ctx).Warn("Context cancelled due to kuberpult timeout") + logger.FromContext(ctx).Warn(fmt.Sprintf("Context cancelled due to %s", kuberpultTimeoutError.Error())) } else { - logger.FromContext(ctx).Warn("Context cancelled due", zap.Error(context.Cause(ctx))) + logger.FromContext(ctx).Warn("ProcessBatch context cancelled NOT due to kuberpult timeout.", zap.Error(context.Cause(ctx))) } } From 7860a058cf063496751cda2fed7df11003a9ac8c Mon Sep 17 00:00:00 2001 From: diogo-nogueira-freiheit Date: Tue, 15 Oct 2024 10:55:31 +0200 Subject: [PATCH 2/4] Last log change --- services/frontend-service/pkg/service/batch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/frontend-service/pkg/service/batch.go b/services/frontend-service/pkg/service/batch.go index d57670c54..149f02785 100644 --- a/services/frontend-service/pkg/service/batch.go +++ b/services/frontend-service/pkg/service/batch.go @@ -46,7 +46,7 @@ func (b *BatchServiceWithDefaultTimeout) ProcessBatch(ctx context.Context, req * if ctx.Err() != nil { if context.Cause(ctx) == kuberpultTimeoutError { - logger.FromContext(ctx).Warn(fmt.Sprintf("Context cancelled due to %s", kuberpultTimeoutError.Error())) + logger.FromContext(ctx).Warn(fmt.Sprintf("ProcessBatch context cancelled due to %s", kuberpultTimeoutError.Error())) } else { logger.FromContext(ctx).Warn("ProcessBatch context cancelled NOT due to kuberpult timeout.", zap.Error(context.Cause(ctx))) } From ff28e34885557ddf81de69da9d9a0d86a703c01f Mon Sep 17 00:00:00 2001 From: Diogo Nogueira Date: Tue, 15 Oct 2024 11:36:30 +0200 Subject: [PATCH 3/4] Added suggestion for logs consistency. Co-authored-by: Sven Urbanski --- services/frontend-service/pkg/service/batch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/frontend-service/pkg/service/batch.go b/services/frontend-service/pkg/service/batch.go index 149f02785..638e226fb 100644 --- a/services/frontend-service/pkg/service/batch.go +++ b/services/frontend-service/pkg/service/batch.go @@ -46,7 +46,7 @@ func (b *BatchServiceWithDefaultTimeout) ProcessBatch(ctx context.Context, req * if ctx.Err() != nil { if context.Cause(ctx) == kuberpultTimeoutError { - logger.FromContext(ctx).Warn(fmt.Sprintf("ProcessBatch context cancelled due to %s", kuberpultTimeoutError.Error())) + logger.FromContext(ctx).Warn("ProcessBatch context cancelled due to kuberpult timeout error", zap.Error(kuberpultTimeoutError)) } else { logger.FromContext(ctx).Warn("ProcessBatch context cancelled NOT due to kuberpult timeout.", zap.Error(context.Cause(ctx))) } From 5cc22944c4b77f63b9e30a8f61104d435c35a4b1 Mon Sep 17 00:00:00 2001 From: diogo-nogueira-freiheit Date: Tue, 15 Oct 2024 11:45:38 +0200 Subject: [PATCH 4/4] Fixed linting problem --- services/frontend-service/pkg/service/batch.go | 1 - 1 file changed, 1 deletion(-) diff --git a/services/frontend-service/pkg/service/batch.go b/services/frontend-service/pkg/service/batch.go index 638e226fb..d3962718f 100644 --- a/services/frontend-service/pkg/service/batch.go +++ b/services/frontend-service/pkg/service/batch.go @@ -19,7 +19,6 @@ package service import ( "context" "errors" - "fmt" "time" api "github.com/freiheit-com/kuberpult/pkg/api/v1"