From 1dc5c48409f9280f3eb697c5a45d9175fab001b1 Mon Sep 17 00:00:00 2001 From: Jorge Luis Betancourt Gonzalez Date: Mon, 17 Feb 2020 16:03:10 +0100 Subject: [PATCH] Add support for reporting the number of active Goroutines --- collector/beat.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/collector/beat.go b/collector/beat.go index 3caeb37..8d01a0e 100644 --- a/collector/beat.go +++ b/collector/beat.go @@ -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 { @@ -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, + }, }, } }