Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions internal/internal_poller_autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@ func newPollerScaler(
options pollerAutoScalerOptions,
logger *zap.Logger,
hooks ...func()) *pollerAutoScaler {
ctx, cancel := context.WithCancel(context.Background())
if !options.Enabled {
return nil
}

ctx, cancel := context.WithCancel(context.Background())
return &pollerAutoScaler{
isDryRun: options.DryRun,
cooldownTime: options.Cooldown,
Expand Down
6 changes: 6 additions & 0 deletions internal/internal_task_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1406,6 +1406,12 @@ func newActivityTaskHandlerWithCustomProvider(
registry *registry,
activityProvider activityProvider,
) ActivityTaskHandler {
if params.Tracer == nil {
params.Tracer = opentracing.NoopTracer{}
}
if params.WorkerStats.ActivityTracker == nil {
params.WorkerStats.ActivityTracker = debug.NewNoopActivityTracker()
}
return &activityTaskHandlerImpl{
taskListName: params.TaskList,
identity: params.Identity,
Expand Down
1 change: 0 additions & 1 deletion internal/internal_task_handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,6 @@ func (t *TaskHandlersTestSuite) TestLocalActivityRetry_DecisionHeartbeatFail() {
WorkerOptions: WorkerOptions{
Identity: "test-id-1",
Logger: t.logger,
Tracer: opentracing.NoopTracer{},
},
WorkerStopChannel: stopCh,
}
Expand Down
6 changes: 6 additions & 0 deletions internal/internal_task_pollers.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,12 @@ func (wtp *workflowTaskPoller) RespondTaskCompleted(completedRequest interface{}
}

func newLocalActivityPoller(params workerExecutionParameters, laTunnel *localActivityTunnel) *localActivityTaskPoller {
if params.Tracer == nil {
params.Tracer = opentracing.NoopTracer{}
}
if params.WorkerStats.ActivityTracker == nil {
params.WorkerStats.ActivityTracker = debug.NewNoopActivityTracker()
}
handler := &localActivityTaskHandler{
userContext: params.UserContext,
metricsScope: metrics.NewTaggedScope(params.MetricsScope),
Expand Down
3 changes: 3 additions & 0 deletions internal/internal_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ func newWorkflowWorker(
}

func ensureRequiredParams(params *workerExecutionParameters) {
if params.Tracer == nil {
params.Tracer = opentracing.NoopTracer{}
}
if params.Identity == "" {
params.Identity = getWorkerIdentity(params.TaskList)
}
Expand Down
5 changes: 2 additions & 3 deletions internal/internal_worker_interfaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"time"

"github.com/golang/mock/gomock"
"github.com/opentracing/opentracing-go"
"github.com/stretchr/testify/suite"
"go.uber.org/zap/zaptest"

Expand Down Expand Up @@ -184,7 +183,7 @@ func (s *InterfacesTestSuite) TestInterface() {
MaxConcurrentActivityTaskPollers: 4,
MaxConcurrentDecisionTaskPollers: 4,
Logger: zaptest.NewLogger(s.T()),
Tracer: opentracing.NoopTracer{}},
},
}

domainStatus := m.DomainStatusRegistered
Expand Down Expand Up @@ -216,7 +215,7 @@ func (s *InterfacesTestSuite) TestInterface() {
MaxConcurrentActivityTaskPollers: 10,
MaxConcurrentDecisionTaskPollers: 10,
Logger: zaptest.NewLogger(s.T()),
Tracer: opentracing.NoopTracer{}},
},
}

// Register activity instances and launch the worker.
Expand Down
5 changes: 3 additions & 2 deletions internal/internal_worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ func (s *internalWorkerTestSuite) TestNoActivitiesOrWorkflows() {
assert.Empty(t, w.registry.getRegisteredActivities())
assert.Empty(t, w.registry.GetRegisteredWorkflowTypes())
assert.NoError(t, w.Start())
w.Stop()
}

func (s *internalWorkerTestSuite) TestWorkerStartFailsWithInvalidDomain() {
Expand Down Expand Up @@ -1141,8 +1142,8 @@ func TestWorkerOptionNonDefaults(t *testing.T) {
DataConverter: &defaultDataConverter{},
BackgroundActivityContext: context.Background(),
Logger: zap.NewNop(),
MetricsScope: tally.NoopScope,
Tracer: opentracing.NoopTracer{},
MetricsScope: tally.NewTestScope("", nil),
Tracer: opentracing.GlobalTracer(),
}

aggWorker, err := newAggregatedWorker(nil, domain, taskList, options)
Expand Down
5 changes: 5 additions & 0 deletions internal/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ import (
"github.com/stretchr/testify/assert"
)

func TestMain(m *testing.M) {
EnableVerboseLogging(true)
m.Run()
}

func Test_NewWorker(t *testing.T) {
tests := []struct {
name string
Expand Down
Loading