status-go/_assets/patches/geth/0035-add_goroutines_metrics...

24 lines
979 B
Diff

diff --git a/metrics/metrics.go b/metrics/metrics.go
index 2a2b804e..d4d703df 100644
--- a/metrics/metrics.go
+++ b/metrics/metrics.go
@@ -56,6 +56,7 @@ func CollectProcessMetrics(refresh time.Duration) {
memFrees := GetOrRegisterMeter("system/memory/frees", DefaultRegistry)
memInuse := GetOrRegisterMeter("system/memory/inuse", DefaultRegistry)
memPauses := GetOrRegisterMeter("system/memory/pauses", DefaultRegistry)
+ goroutines := GetOrRegisterGauge("system/goroutines", DefaultRegistry)
var diskReads, diskReadBytes, diskWrites, diskWriteBytes Meter
var diskReadBytesCounter, diskWriteBytesCounter Counter
@@ -89,6 +90,10 @@ func CollectProcessMetrics(refresh time.Duration) {
diskReadBytesCounter.Inc(diskstats[location1].ReadBytes - diskstats[location2].ReadBytes)
diskWriteBytesCounter.Inc(diskstats[location1].WriteBytes - diskstats[location2].WriteBytes)
}
+
+ goroutines.Update(int64(runtime.NumGoroutine()))
+
time.Sleep(refresh)
}
+
}