Skip to content

Commit 9909396

Browse files
authored
Create new poller thread pool usage metrics (#1275)
Create new poller thread pool usage metrics. ConcurrentTaskQuota is the number of buffer in poller thread channel and ConcurrentTaskRunning is current utilization of that channel. If ConcurrentTaskRunning is exceeding ConcurrentTaskQuota, polling will halt and result in under utilization and backlog as a result.
1 parent c0700c7 commit 9909396

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

internal/common/metrics/constants.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,7 @@ const (
114114
MemoryUsedHeap = CadenceMetricsPrefix + "memory-used-heap"
115115
MemoryUsedStack = CadenceMetricsPrefix + "memory-used-stack"
116116
NumGoRoutines = CadenceMetricsPrefix + "num-go-routines"
117+
118+
ConcurrentTaskQuota = CadenceMetricsPrefix + "concurrent-task-quota"
119+
ConcurrentTaskRunning = CadenceMetricsPrefix + "concurrent-task-running"
117120
)

internal/internal_worker_base.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ func (bw *baseWorker) runPoller() {
252252
case <-bw.shutdownCh:
253253
return
254254
case <-bw.pollerRequestCh:
255+
bw.metricsScope.Gauge(metrics.ConcurrentTaskQuota).Update(float64(cap(bw.pollerRequestCh)))
256+
bw.metricsScope.Gauge(metrics.ConcurrentTaskRunning).Update(float64(cap(bw.pollerRequestCh) - len(bw.pollerRequestCh)))
255257
if bw.sessionTokenBucket != nil {
256258
bw.sessionTokenBucket.waitForAvailableToken()
257259
}

0 commit comments

Comments
 (0)