Skip to content

Commit

Permalink
Add support for reporting the number of active Goroutines
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgelbg committed Feb 17, 2020
1 parent 94f55b2 commit 1dc5c48
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions collector/beat.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ type BeatStats struct {
MemoryTotal float64 `json:"memory_total"`
RSS float64 `json:"rss"`
} `json:"memstats"`

Runtime struct {
Goroutines uint64 `json:"goroutines"`
} `json:"runtime"`
}

type beatCollector struct {
Expand Down Expand Up @@ -145,6 +149,17 @@ func NewBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
},
valType: prometheus.GaugeValue,
},
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "runtime", "goroutines"),
"beat.runtime.goroutines",
nil, nil,
),
eval: func(stats *Stats) float64 {
return float64(stats.Beat.Runtime.Goroutines)
},
valType: prometheus.GaugeValue,
},
},
}
}
Expand Down

0 comments on commit 1dc5c48

Please sign in to comment.