Skip to content

Commit d4b4b73

Browse files
authored
Merge pull request #406 from cschleiden/copilot/fix-405
Fix duplicate workflow instance and execution ID fields in logs
2 parents f21dabc + ad97005 commit d4b4b73

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

internal/workflowstate/workflowstate.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/cschleiden/go-workflows/backend/payload"
1111
"github.com/cschleiden/go-workflows/core"
1212
"github.com/cschleiden/go-workflows/internal/command"
13-
"github.com/cschleiden/go-workflows/internal/log"
1413
"github.com/cschleiden/go-workflows/internal/sync"
1514
"go.opentelemetry.io/otel/trace"
1615
)
@@ -85,9 +84,7 @@ func NewWorkflowState(instance *core.WorkflowInstance, logger *slog.Logger, trac
8584
clock: clock,
8685
}
8786

88-
state.logger = NewReplayLogger(state, logger.With(
89-
log.InstanceIDKey, instance.InstanceID,
90-
log.ExecutionIDKey, instance.ExecutionID))
87+
state.logger = NewReplayLogger(state, logger)
9188

9289
return state
9390
}

workflow/executor/executor.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,6 @@ func NewExecutor(
110110
}
111111
}
112112

113-
logger = logger.With(
114-
slog.String(log.InstanceIDKey, instance.InstanceID),
115-
slog.String(log.ExecutionIDKey, instance.ExecutionID),
116-
)
117-
118113
return &executor{
119114
registry: r,
120115
historyProvider: historyProvider,
@@ -326,7 +321,7 @@ func (e *executor) executeNewEvents(newEvents []*history.Event) ([]*history.Even
326321

327322
func (e *executor) Close() {
328323
if e.workflow != nil {
329-
e.logger.Debug("Stopping workflow executor", log.InstanceIDKey, e.workflowState.Instance().InstanceID)
324+
e.logger.Debug("Stopping workflow executor")
330325

331326
// End workflow if running to prevent leaking goroutines
332327
e.workflow.Close()
@@ -335,7 +330,6 @@ func (e *executor) Close() {
335330

336331
func (e *executor) executeEvent(event *history.Event) error {
337332
fields := []any{
338-
log.InstanceIDKey, e.workflowState.Instance().InstanceID,
339333
log.EventIDKey, event.ID,
340334
log.SeqIDKey, event.SequenceID,
341335
log.EventTypeKey, event.Type,

0 commit comments

Comments
 (0)