Skip to content

Commit 60cbaee

Browse files
committed
feat: Enhance task processing with contextual logging for better error correlation
1 parent a585ae8 commit 60cbaee

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

camunda/internal/worker/worker.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,12 @@ func (w *Worker) processTask(ctx context.Context, task ExternalTask) {
335335

336336
// Create complete factory: handlers can call complete() to get a TaskCompletion
337337
// and then use fluent methods: complete().StringVariable(...).Execute()
338+
// Create a logger pre-attached with process/task context to help correlate
339+
// completion logs with engine-side errors (e.g., optimistic locking).
340+
loggerWithCtx := w.logger.With("processInstanceID", task.ProcessInstanceID, "activityID", task.ActivityID, "topic", task.TopicName)
341+
338342
complete := func() *tasks.TaskCompletion {
339-
return tasks.NewTaskCompletion(w.httpClient, w.workerID, task.ID, w.logger).Context(ctx)
343+
return tasks.NewTaskCompletion(w.httpClient, w.workerID, task.ID, loggerWithCtx).Context(ctx)
340344
}
341345

342346
// Create fail function

0 commit comments

Comments
 (0)