Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit fa0f26f

Browse files
author
Audrius Karabanovas
authored
Merge pull request #36 from jorgelbg/goroutines-files
Add support for reporting the number of active Goroutines
2 parents 94f55b2 + 1dc5c48 commit fa0f26f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

collector/beat.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ type BeatStats struct {
3636
MemoryTotal float64 `json:"memory_total"`
3737
RSS float64 `json:"rss"`
3838
} `json:"memstats"`
39+
40+
Runtime struct {
41+
Goroutines uint64 `json:"goroutines"`
42+
} `json:"runtime"`
3943
}
4044

4145
type beatCollector struct {
@@ -145,6 +149,17 @@ func NewBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
145149
},
146150
valType: prometheus.GaugeValue,
147151
},
152+
{
153+
desc: prometheus.NewDesc(
154+
prometheus.BuildFQName(beatInfo.Beat, "runtime", "goroutines"),
155+
"beat.runtime.goroutines",
156+
nil, nil,
157+
),
158+
eval: func(stats *Stats) float64 {
159+
return float64(stats.Beat.Runtime.Goroutines)
160+
},
161+
valType: prometheus.GaugeValue,
162+
},
148163
},
149164
}
150165
}

0 commit comments

Comments
 (0)