Skip to content

Commit

Permalink
Add number of goroutines to reported metrics (elastic#12135)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoriano authored and ph committed May 21, 2019
1 parent 6335904 commit 2083a22
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add `decode_csv_fields` processor. {pull}11753[11753]
- Add `convert` processor for converting data types of fields. {issue}8124[8124] {pull}11686[11686]
- New `extract_array` processor. {pull}11761[11761]
- Add number of goroutines to reported metrics. {pull}12135[12135]

*Auditbeat*

Expand Down
8 changes: 8 additions & 0 deletions libbeat/cmd/instance/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func setupMetrics(name string) error {

monitoring.NewFunc(beatMetrics, "memstats", reportMemStats, monitoring.Report)
monitoring.NewFunc(beatMetrics, "cpu", reportBeatCPU, monitoring.Report)
monitoring.NewFunc(beatMetrics, "runtime", reportRuntime, monitoring.Report)

setupPlatformSpecificMetrics()

Expand Down Expand Up @@ -246,3 +247,10 @@ func reportSystemCPUUsage(_ monitoring.Mode, V monitoring.Visitor) {

monitoring.ReportInt(V, "cores", int64(process.NumCPU))
}

func reportRuntime(_ monitoring.Mode, V monitoring.Visitor) {
V.OnRegistryStart()
defer V.OnRegistryFinished()

monitoring.ReportInt(V, "goroutines", int64(runtime.NumGoroutine()))
}
3 changes: 3 additions & 0 deletions libbeat/docs/http-endpoint.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ curl -XGET 'localhost:5066/stats?pretty'
"memory_alloc": 9433384,
"memory_total": 492478864,
"rss": 50405376
},
"runtime": {
"goroutines": 22
}
},
"libbeat": {
Expand Down
1 change: 1 addition & 0 deletions libbeat/monitoring/report/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ var gauges = map[string]bool{
"beat.handles.open": true,
"beat.handles.limit.hard": true,
"beat.handles.limit.soft": true,
"beat.runtime.goroutines": true,
"system.load.1": true,
"system.load.5": true,
"system.load.15": true,
Expand Down

0 comments on commit 2083a22

Please sign in to comment.