Skip to content

Commit

Permalink
address more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ketsiambaku committed Aug 19, 2024
1 parent 48cfb9b commit a70cf38
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions internal/internal_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ func ensureRequiredParams(params *workerExecutionParameters) {
if params.UserContext == nil {
params.UserContext = context.Background()
}
if params.Monitor.LifeCycle == nil {
params.Monitor.LifeCycle = debug.NewLifeCycle()
if params.EventMonitor.LifeCycle == nil {
params.EventMonitor.LifeCycle = debug.NewLifeCycle()
params.Logger.Debug("No LifeCycle configured for EventMonitor option. Will use the default.")
}
}
Expand Down Expand Up @@ -287,7 +287,7 @@ func newWorkflowTaskWorkerInternal(
identity: params.Identity,
workerType: "DecisionWorker",
shutdownTimeout: params.WorkerStopTimeout,
pollerLifeCycle: params.Monitor.LifeCycle,
pollerLifeCycle: params.EventMonitor.LifeCycle,
},
params.Logger,
params.MetricsScope,
Expand All @@ -312,7 +312,7 @@ func newWorkflowTaskWorkerInternal(
identity: params.Identity,
workerType: "LocalActivityWorker",
shutdownTimeout: params.WorkerStopTimeout,
pollerLifeCycle: params.Monitor.LifeCycle,
pollerLifeCycle: params.EventMonitor.LifeCycle,
},
params.Logger,
params.MetricsScope,
Expand Down Expand Up @@ -492,7 +492,7 @@ func newActivityTaskWorker(
workerType: workerType,
shutdownTimeout: workerParams.WorkerStopTimeout,
userContextCancel: workerParams.UserContextCancel,
pollerLifeCycle: workerParams.Monitor.LifeCycle,
pollerLifeCycle: workerParams.EventMonitor.LifeCycle,
},

workerParams.Logger,
Expand Down
6 changes: 3 additions & 3 deletions internal/internal_worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ func TestWorkerOptionDefaults(t *testing.T) {
Logger: decisionWorker.executionParameters.Logger,
MetricsScope: decisionWorker.executionParameters.MetricsScope,
Identity: decisionWorker.executionParameters.Identity,
Monitor: debug.EventMonitor{debug.NewLifeCycle()},
EventMonitor: debug.EventMonitor{debug.NewLifeCycle()},
},
UserContext: decisionWorker.executionParameters.UserContext,
}
Expand Down Expand Up @@ -1160,7 +1160,7 @@ func TestWorkerOptionNonDefaults(t *testing.T) {
Logger: options.Logger,
MetricsScope: options.MetricsScope,
Identity: options.Identity,
Monitor: debug.EventMonitor{debug.NewLifeCycle()},
EventMonitor: debug.EventMonitor{debug.NewLifeCycle()},
},
}

Expand Down Expand Up @@ -1188,7 +1188,7 @@ func assertWorkerExecutionParamsEqual(t *testing.T, paramsA workerExecutionParam
require.Equal(t, paramsA.NonDeterministicWorkflowPolicy, paramsB.NonDeterministicWorkflowPolicy)
require.Equal(t, paramsA.EnableLoggingInReplay, paramsB.EnableLoggingInReplay)
require.Equal(t, paramsA.DisableStickyExecution, paramsB.DisableStickyExecution)
require.Equal(t, paramsA.Monitor.LifeCycle, paramsB.Monitor.LifeCycle)
require.Equal(t, paramsA.EventMonitor.LifeCycle, paramsB.EventMonitor.LifeCycle)
}

/*
Expand Down
4 changes: 2 additions & 2 deletions internal/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,11 @@ type (
// Deprecated: All bugports are always deprecated and may be removed at any time.
WorkerBugPorts WorkerBugPorts

// Optional: Monitor provides a set of methods that can be used to collect
// Optional: EventMonitor provides a set of methods that can be used to collect
// stats on the Worker for debugging purposes.
// default: internal implementation provided
// Deprecated: in development and very likely to change
Monitor debug.EventMonitor
EventMonitor debug.EventMonitor
}

// WorkerBugPorts allows opt-in enabling of older, possibly buggy behavior, primarily intended to allow temporarily
Expand Down

0 comments on commit a70cf38

Please sign in to comment.