From f606d0ce1ee820f7982625ffbbdba0bc0a6ec22e Mon Sep 17 00:00:00 2001 From: Justin Kaseman Date: Mon, 18 Nov 2024 11:21:34 -0800 Subject: [PATCH 1/2] Log workflow name with engine starting for workflow --- core/services/workflows/engine.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/services/workflows/engine.go b/core/services/workflows/engine.go index b958e171c0c..9ab8284cf78 100644 --- a/core/services/workflows/engine.go +++ b/core/services/workflows/engine.go @@ -352,7 +352,7 @@ func (e *Engine) init(ctx context.Context) { } } - e.logger.Info("engine initialized") + e.logger.Infof("engine initialized for %s", e.workflow.name) logCustMsg(ctx, e.cma, "workflow registered", e.logger) e.afterInit(true) } From f0a18674c13abe7b7d7c01d83e275127aaf03e3c Mon Sep 17 00:00:00 2001 From: Justin Kaseman Date: Fri, 29 Nov 2024 15:36:14 -0800 Subject: [PATCH 2/2] Decode workflow name --- core/services/workflows/engine.go | 11 ++++++++++- core/services/workflows/engine_test.go | 16 ++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/core/services/workflows/engine.go b/core/services/workflows/engine.go index 9ab8284cf78..b1fca324d94 100644 --- a/core/services/workflows/engine.go +++ b/core/services/workflows/engine.go @@ -352,7 +352,16 @@ func (e *Engine) init(ctx context.Context) { } } - e.logger.Infof("engine initialized for %s", e.workflow.name) + var name string + if e.workflow != nil { + nameBytes, err := hex.DecodeString(e.workflow.name) + if err != nil { + e.logger.Errorf("failed to decode workflow name: %s", e.workflow.name) + } + name = string(nameBytes[:]) + } + + e.logger.Infof("engine initialized for %s", name) logCustMsg(ctx, e.cma, "workflow registered", e.logger) e.afterInit(true) } diff --git a/core/services/workflows/engine_test.go b/core/services/workflows/engine_test.go index 3a2bc17bc36..f976b4bf0a9 100644 --- a/core/services/workflows/engine_test.go +++ b/core/services/workflows/engine_test.go @@ -41,6 +41,8 @@ import ( const testWorkflowId = "" const hardcodedWorkflow = ` +name: "hcwf" + triggers: - id: "mercury-trigger@1.0.0" config: @@ -165,12 +167,14 @@ func newTestEngine(t *testing.T, reg *coreCap.Registry, sdkSpec sdk.WorkflowSpec reg.SetLocalRegistry(&testConfigProvider{}) cfg := Config{ - WorkflowID: testWorkflowId, - Lggr: logger.TestLogger(t), - Registry: reg, - Workflow: sdkSpec, - maxRetries: 1, - retryMs: 100, + WorkflowID: testWorkflowId, + WorkflowName: sdkSpec.Name, + WorkflowOwner: sdkSpec.Owner, + Lggr: logger.TestLogger(t), + Registry: reg, + Workflow: sdkSpec, + maxRetries: 1, + retryMs: 100, afterInit: func(success bool) { if success { close(initSuccessful)