mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-09 04:17:51 +00:00
Merge pull request #600 from raskle/432-memory-metrics
runtime memory metrics
This commit is contained in:
commit
25a031d5b2
1 changed files with 9 additions and 0 deletions
|
|
@ -463,6 +463,7 @@ func (s *Server) monitorRuntime() {
|
|||
return
|
||||
}
|
||||
|
||||
var m runtime.MemStats
|
||||
ticker := time.NewTicker(s.MetricInterval)
|
||||
defer ticker.Stop()
|
||||
|
||||
|
|
@ -484,6 +485,14 @@ func (s *Server) monitorRuntime() {
|
|||
|
||||
// Record the number of go routines
|
||||
s.Holder.Stats.Gauge("goroutines", float64(runtime.NumGoroutine()), 1.0)
|
||||
|
||||
// Runtime memory metrics
|
||||
runtime.ReadMemStats(&m)
|
||||
s.Holder.Stats.Gauge("HeapAlloc", float64(m.HeapAlloc), 1.0)
|
||||
s.Holder.Stats.Gauge("HeapInuse", float64(m.HeapInuse), 1.0)
|
||||
s.Holder.Stats.Gauge("StackInuse", float64(m.StackInuse), 1.0)
|
||||
s.Holder.Stats.Gauge("Mallocs", float64(m.Mallocs), 1.0)
|
||||
s.Holder.Stats.Gauge("Frees", float64(m.Frees), 1.0)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue