forked from mirror/client_golang
continue to fix errors
This commit is contained in:
parent
59305998f6
commit
5e9294fbb7
|
@ -10,11 +10,11 @@ type goCollector struct {
|
||||||
goroutines Gauge
|
goroutines Gauge
|
||||||
gcDesc *Desc
|
gcDesc *Desc
|
||||||
alloc Gauge
|
alloc Gauge
|
||||||
totalAlloc Gauge
|
totalAlloc Counter
|
||||||
sys Gauge
|
sys Counter
|
||||||
lookups Gauge
|
lookups Counter
|
||||||
mallocs Gauge
|
mallocs Counter
|
||||||
frees Gauge
|
frees Counter
|
||||||
heapAlloc Gauge
|
heapAlloc Gauge
|
||||||
heapSys Gauge
|
heapSys Gauge
|
||||||
heapIdle Gauge
|
heapIdle Gauge
|
||||||
|
@ -77,7 +77,7 @@ func NewGoCollector() *goCollector {
|
||||||
Name: "heap_alloc_bytes",
|
Name: "heap_alloc_bytes",
|
||||||
Help: "Number heap bytes allocated and still in use.",
|
Help: "Number heap bytes allocated and still in use.",
|
||||||
}),
|
}),
|
||||||
heapSys: NewCounter(GaugeOpts{
|
heapSys: NewGauge(GaugeOpts{
|
||||||
Namespace: "go",
|
Namespace: "go",
|
||||||
Subsystem: "memstats",
|
Subsystem: "memstats",
|
||||||
Name: "heap_sys_bytes",
|
Name: "heap_sys_bytes",
|
||||||
|
@ -114,18 +114,18 @@ func NewGoCollector() *goCollector {
|
||||||
func (c *goCollector) Describe(ch chan<- *Desc) {
|
func (c *goCollector) Describe(ch chan<- *Desc) {
|
||||||
ch <- c.goroutines.Desc()
|
ch <- c.goroutines.Desc()
|
||||||
ch <- c.gcDesc
|
ch <- c.gcDesc
|
||||||
ch <- m.alloc.Desc()
|
ch <- c.alloc.Desc()
|
||||||
ch <- m.totalAlloc.Desc()
|
ch <- c.totalAlloc.Desc()
|
||||||
ch <- m.sys.Desc()
|
ch <- c.sys.Desc()
|
||||||
ch <- m.lookups.Desc()
|
ch <- c.lookups.Desc()
|
||||||
ch <- m.mallocs.Desc()
|
ch <- c.mallocs.Desc()
|
||||||
ch <- m.frees.Desc()
|
ch <- c.frees.Desc()
|
||||||
ch <- m.heapAlloc.Desc()
|
ch <- c.heapAlloc.Desc()
|
||||||
ch <- m.heapSys.Desc()
|
ch <- c.heapSys.Desc()
|
||||||
ch <- m.heapIdle.Desc()
|
ch <- c.heapIdle.Desc()
|
||||||
ch <- m.heapInuse.Desc()
|
ch <- c.heapInuse.Desc()
|
||||||
ch <- m.heapReleased.Desc()
|
ch <- c.heapReleased.Desc()
|
||||||
ch <- m.heapObjects.Desc()
|
ch <- c.heapObjects.Desc()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect returns the current state of all metrics of the collector.
|
// Collect returns the current state of all metrics of the collector.
|
||||||
|
@ -147,28 +147,28 @@ func (c *goCollector) Collect(ch chan<- Metric) {
|
||||||
var ms runtime.MemStats
|
var ms runtime.MemStats
|
||||||
runtime.ReadMemStats(&ms)
|
runtime.ReadMemStats(&ms)
|
||||||
|
|
||||||
m.alloc.Set(float64(ms.Alloc))
|
c.alloc.Set(float64(ms.Alloc))
|
||||||
ch <- m.alloc
|
ch <- c.alloc
|
||||||
m.totalAlloc.Set(float64(ms.TotalAlloc))
|
c.totalAlloc.Set(float64(ms.TotalAlloc))
|
||||||
ch <- m.totalAlloc
|
ch <- c.totalAlloc
|
||||||
m.sys.Set(float64(ms.Sys))
|
c.sys.Set(float64(ms.Sys))
|
||||||
ch <- m.sys
|
ch <- c.sys
|
||||||
m.lookups.Set(float64(ms.Lookups))
|
c.lookups.Set(float64(ms.Lookups))
|
||||||
ch <- m.lookups
|
ch <- c.lookups
|
||||||
m.mallocs.Set(float64(ms.Mallocs))
|
c.mallocs.Set(float64(ms.Mallocs))
|
||||||
ch <- m.mallocs
|
ch <- c.mallocs
|
||||||
m.frees.Set(float64(ms.Frees))
|
c.frees.Set(float64(ms.Frees))
|
||||||
ch <- m.frees
|
ch <- c.frees
|
||||||
m.heapAlloc.Set(float64(ms.HeapAlloc))
|
c.heapAlloc.Set(float64(ms.HeapAlloc))
|
||||||
ch <- m.heapAlloc
|
ch <- c.heapAlloc
|
||||||
m.heapSys.Set(float64(ms.HeapSys))
|
c.heapSys.Set(float64(ms.HeapSys))
|
||||||
ch <- m.heapSys
|
ch <- c.heapSys
|
||||||
m.heapIdle.Set(float64(ms.HeapIdle))
|
c.heapIdle.Set(float64(ms.HeapIdle))
|
||||||
ch <- m.heapIdle
|
ch <- c.heapIdle
|
||||||
m.heapInuse.Set(float64(ms.HeapInuse))
|
c.heapInuse.Set(float64(ms.HeapInuse))
|
||||||
ch <- m.heapInuse
|
ch <- c.heapInuse
|
||||||
m.heapReleased.Set(float64(ms.HeapReleased))
|
c.heapReleased.Set(float64(ms.HeapReleased))
|
||||||
ch <- m.heapReleased
|
ch <- c.heapReleased
|
||||||
m.heapObjects.Set(float64(ms.HeapObjects))
|
c.heapObjects.Set(float64(ms.HeapObjects))
|
||||||
ch <- m.heapObjects
|
ch <- c.heapObjects
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue