Skip to content

Commit d6ca3f7

Browse files
committed
Fix incorrect tasklogger
1 parent ba01649 commit d6ca3f7

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

internal/worker/workflow.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ func (wtw *WorkflowTaskWorker) Start(ctx context.Context) error {
6464

6565
// Complete implements TaskWorker.
6666
func (wtw *WorkflowTaskWorker) Complete(ctx context.Context, result *workflow.ExecutionResult, t *backend.WorkflowTask) error {
67-
logger := wtw.taskLogger(t)
67+
logger := wtw.logger.With(
68+
slog.String(log.TaskIDKey, t.ID),
69+
slog.String(log.InstanceIDKey, t.WorkflowInstance.InstanceID),
70+
slog.String(log.ExecutionIDKey, t.WorkflowInstance.ExecutionID),
71+
)
6872

6973
state := result.State
7074
if state == core.WorkflowInstanceStateFinished || state == core.WorkflowInstanceStateContinuedAsNew {
@@ -159,7 +163,10 @@ func (wtw *WorkflowTaskWorker) getExecutor(ctx context.Context, t *backend.Workf
159163

160164
if !ok {
161165
executor, err = workflow.NewExecutor(
162-
wtw.taskLogger(t),
166+
wtw.logger.With(
167+
slog.String(log.InstanceIDKey, t.WorkflowInstance.InstanceID),
168+
slog.String(log.ExecutionIDKey, t.WorkflowInstance.ExecutionID),
169+
),
163170
wtw.backend.Tracer(),
164171
wtw.registry,
165172
wtw.backend.Converter(),
@@ -181,11 +188,3 @@ func (wtw *WorkflowTaskWorker) getExecutor(ctx context.Context, t *backend.Workf
181188

182189
return executor, nil
183190
}
184-
185-
func (wtw *WorkflowTaskWorker) taskLogger(t *backend.WorkflowTask) *slog.Logger {
186-
return wtw.logger.With(
187-
slog.String(log.TaskIDKey, t.ID),
188-
slog.String(log.InstanceIDKey, t.WorkflowInstance.InstanceID),
189-
slog.String(log.ExecutionIDKey, t.WorkflowInstance.ExecutionID),
190-
)
191-
}

0 commit comments

Comments
 (0)