Skip to content

Commit

Permalink
Exposing waiting job count as metric
Browse files Browse the repository at this point in the history
  • Loading branch information
laszlocph committed Jul 10, 2019
1 parent ca67aff commit f0c641f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/drone-server/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ func setupMetrics(g *errgroup.Group, store_ store.Store) {
Name: "pending_jobs",
Help: "Total number of pending build processes.",
})
waitingJobs := promauto.NewGauge(prometheus.GaugeOpts{
Namespace: "drone",
Name: "waiting_jobs",
Help: "Total number of builds waiting on deps.",
})
runningJobs := promauto.NewGauge(prometheus.GaugeOpts{
Namespace: "drone",
Name: "running_jobs",
Expand Down Expand Up @@ -237,6 +242,7 @@ func setupMetrics(g *errgroup.Group, store_ store.Store) {
for {
stats := droneserver.Config.Services.Queue.Info(nil)
pendingJobs.Set(float64(stats.Stats.Pending))
waitingJobs.Set(float64(stats.Stats.WaitingOnDeps))
runningJobs.Set(float64(stats.Stats.Running))
workers.Set(float64(stats.Stats.Workers))
time.Sleep(500 * time.Millisecond)
Expand Down

0 comments on commit f0c641f

Please sign in to comment.