Skip to content

Commit

Permalink
show worker queue size in the cluster status
Browse files Browse the repository at this point in the history
  • Loading branch information
mkabilov committed Aug 28, 2017
1 parent f44c8e1 commit 53ceede
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 8 additions & 2 deletions pkg/controller/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,15 @@ func (c *Controller) GetStatus() *spec.ControllerStatus {
clustersCnt := len(c.clusters)
c.clustersMu.RUnlock()

queueSizes := make(map[int]int, c.opConfig.Workers)
for workerID, queue := range c.clusterEventQueues {
queueSizes[workerID] = len(queue.ListKeys())
}

return &spec.ControllerStatus{
LastSyncTime: atomic.LoadInt64(&c.lastClusterSyncTime),
Clusters: clustersCnt,
LastSyncTime: atomic.LoadInt64(&c.lastClusterSyncTime),
Clusters: clustersCnt,
WorkerQueueSize: queueSizes,
}
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/spec/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ type ClusterStatus struct {

// ControllerStatus describes status of the controller
type ControllerStatus struct {
LastSyncTime int64
Clusters int
LastSyncTime int64
Clusters int
WorkerQueueSize map[int]int
}

// QueueDump describes cache.FIFO queue
Expand Down

0 comments on commit 53ceede

Please sign in to comment.