NewGoCollector is the obsolete version of collectors.NewGoCollector. See there for documentation. Deprecated: Use collectors.NewGoCollector instead.
()
| 40 | // |
| 41 | // Deprecated: Use collectors.NewGoCollector instead. |
| 42 | func NewGoCollector() Collector { |
| 43 | msMetrics := goRuntimeMemStats() |
| 44 | msMetrics = append(msMetrics, struct { |
| 45 | desc *Desc |
| 46 | eval func(*runtime.MemStats) float64 |
| 47 | valType ValueType |
| 48 | }{ |
| 49 | // This metric is omitted in Go1.17+, see https://github.com/prometheus/client_golang/issues/842#issuecomment-861812034 |
| 50 | desc: NewDesc( |
| 51 | memstatNamespace("gc_cpu_fraction"), |
| 52 | "The fraction of this program's available CPU time used by the GC since the program started.", |
| 53 | nil, nil, |
| 54 | ), |
| 55 | eval: func(ms *runtime.MemStats) float64 { return ms.GCCPUFraction }, |
| 56 | valType: GaugeValue, |
| 57 | }) |
| 58 | return &goCollector{ |
| 59 | base: newBaseGoCollector(), |
| 60 | msLast: &runtime.MemStats{}, |
| 61 | msRead: runtime.ReadMemStats, |
| 62 | msMaxWait: time.Second, |
| 63 | msMaxAge: 5 * time.Minute, |
| 64 | msMetrics: msMetrics, |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | // Describe returns all descriptions of the collector. |
| 69 | func (c *goCollector) Describe(ch chan<- *Desc) { |