Skip to content

Commit a987ff3

Browse files
authored
Worker queue size in the status api endpoint
2 parents f44c8e1 + 53ceede commit a987ff3

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

pkg/controller/status.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,15 @@ func (c *Controller) GetStatus() *spec.ControllerStatus {
5151
clustersCnt := len(c.clusters)
5252
c.clustersMu.RUnlock()
5353

54+
queueSizes := make(map[int]int, c.opConfig.Workers)
55+
for workerID, queue := range c.clusterEventQueues {
56+
queueSizes[workerID] = len(queue.ListKeys())
57+
}
58+
5459
return &spec.ControllerStatus{
55-
LastSyncTime: atomic.LoadInt64(&c.lastClusterSyncTime),
56-
Clusters: clustersCnt,
60+
LastSyncTime: atomic.LoadInt64(&c.lastClusterSyncTime),
61+
Clusters: clustersCnt,
62+
WorkerQueueSize: queueSizes,
5763
}
5864
}
5965

pkg/spec/types.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ type ClusterStatus struct {
102102

103103
// ControllerStatus describes status of the controller
104104
type ControllerStatus struct {
105-
LastSyncTime int64
106-
Clusters int
105+
LastSyncTime int64
106+
Clusters int
107+
WorkerQueueSize map[int]int
107108
}
108109

109110
// QueueDump describes cache.FIFO queue

0 commit comments

Comments
 (0)