Add goroutines count to geth metrics (#1077)
This commit is contained in:
parent
f19e3eae8e
commit
93210061ad
|
@ -0,0 +1,23 @@
|
|||
diff --git a/metrics/metrics.go b/metrics/metrics.go
|
||||
index 2356f2b1..802f1363 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
|
||||
if err := ReadDiskStats(diskstats[0]); err == nil {
|
||||
@@ -83,6 +84,10 @@ func CollectProcessMetrics(refresh time.Duration) {
|
||||
diskWrites.Mark(diskstats[location1].WriteCount - diskstats[location2].WriteCount)
|
||||
diskWriteBytes.Mark(diskstats[location1].WriteBytes - diskstats[location2].WriteBytes)
|
||||
}
|
||||
+
|
||||
+ goroutines.Update(int64(runtime.NumGoroutine()))
|
||||
+
|
||||
time.Sleep(refresh)
|
||||
}
|
||||
+
|
||||
}
|
|
@ -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
|
||||
if err := ReadDiskStats(diskstats[0]); err == nil {
|
||||
|
@ -83,6 +84,10 @@ func CollectProcessMetrics(refresh time.Duration) {
|
|||
diskWrites.Mark(diskstats[location1].WriteCount - diskstats[location2].WriteCount)
|
||||
diskWriteBytes.Mark(diskstats[location1].WriteBytes - diskstats[location2].WriteBytes)
|
||||
}
|
||||
|
||||
goroutines.Update(int64(runtime.NumGoroutine()))
|
||||
|
||||
time.Sleep(refresh)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue