Skip to content

Commit

Permalink
Merge pull request #36 from jorgelbg/goroutines-files
Browse files Browse the repository at this point in the history
Add support for reporting the number of active Goroutines
  • Loading branch information
Audrius Karabanovas authored Feb 27, 2020
2 parents 94f55b2 + 1dc5c48 commit fa0f26f
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 fa0f26f

Please sign in to comment.