Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for reporting the number of active Goroutines #36

Merged
merged 1 commit into from
Feb 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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