@@ -168,6 +168,8 @@ func createPollRetryPolicy() backoff.RetryPolicy {
168168
169169func newBaseWorker (options baseWorkerOptions , logger * zap.Logger , metricsScope tally.Scope , sessionTokenBucket * sessionTokenBucket ) * baseWorker {
170170 ctx , cancel := context .WithCancel (context .Background ())
171+ logger = logger .With (zapcore.Field {Key : tagWorkerType , Type : zapcore .StringType , String : options .workerType })
172+ metricsScope = tagScope (metricsScope , tagWorkerType , options .workerType )
171173
172174 concurrency := & worker.ConcurrencyLimit {
173175 PollerPermit : worker .NewResizablePermit (options .pollerCount ),
@@ -192,8 +194,8 @@ func newBaseWorker(options baseWorkerOptions, logger *zap.Logger, metricsScope t
192194 shutdownCh : make (chan struct {}),
193195 taskLimiter : rate .NewLimiter (rate .Limit (options .maxTaskPerSecond ), 1 ),
194196 retrier : backoff .NewConcurrentRetrier (pollOperationRetryPolicy ),
195- logger : logger . With (zapcore. Field { Key : tagWorkerType , Type : zapcore . StringType , String : options . workerType }) ,
196- metricsScope : tagScope ( metricsScope , tagWorkerType , options . workerType ) ,
197+ logger : logger ,
198+ metricsScope : metricsScope ,
197199 concurrency : concurrency ,
198200 concurrencyAutoScaler : concurrencyAS ,
199201 taskQueueCh : make (chan interface {}), // no buffer, so poller only able to poll new task after previous is dispatched.
0 commit comments