Remove go_memstat_lookups_total; added runtime/metrics calculation to… · prometheus/client_golang@062300e (original) (raw)

`@@ -28,176 +28,168 @@ func goRuntimeMemStats() memStatsMetrics {

`

28

28

` {

`

29

29

`desc: NewDesc(

`

30

30

`memstatNamespace("alloc_bytes"),

`

31

``

`-

"Number of bytes allocated and currently in use.",

`

``

31

`+

"Number of bytes allocated in heap and currently in use. Equals to /memory/classes/heap/objects:bytes.",

`

32

32

`nil, nil,

`

33

33

` ),

`

34

34

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.Alloc) },

`

35

35

`valType: GaugeValue,

`

36

36

` }, {

`

37

37

`desc: NewDesc(

`

38

38

`memstatNamespace("alloc_bytes_total"),

`

39

``

`-

"Total number of bytes allocated until now, even if released already.",

`

``

39

`+

"Total number of bytes allocated in heap until now, even if released already. Equals to /gc/heap/allocs:bytes.",

`

40

40

`nil, nil,

`

41

41

` ),

`

42

42

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.TotalAlloc) },

`

43

43

`valType: CounterValue,

`

44

44

` }, {

`

45

45

`desc: NewDesc(

`

46

46

`memstatNamespace("sys_bytes"),

`

47

``

`-

"Number of bytes obtained from system.",

`

``

47

`+

"Number of bytes obtained from system. Equals to /memory/classes/total:byte.",

`

48

48

`nil, nil,

`

49

49

` ),

`

50

50

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.Sys) },

`

51

51

`valType: GaugeValue,

`

52

``

`-

}, {

`

53

``

`-

desc: NewDesc(

`

54

``

`-

memstatNamespace("lookups_total"),

`

55

``

`-

"Total number of pointer lookups.",

`

56

``

`-

nil, nil,

`

57

``

`-

),

`

58

``

`-

eval: func(ms *runtime.MemStats) float64 { return float64(ms.Lookups) },

`

59

``

`-

valType: CounterValue,

`

60

52

` }, {

`

61

53

`desc: NewDesc(

`

62

54

`memstatNamespace("mallocs_total"),

`

63

``

`-

// TODO(bwplotka): We could add go_memstats_heap_objects, probably useful for discovery. Let's gather more feedback, kind of waste of bytes for everybody for compatibility reason.

`

64

``

`-

"Total number of heap objects allocated, both live and gc-ed. Semantically a counter version for go_memstats_heap_objects gauge.",

`

``

55

`+

// TODO(bwplotka): We could add go_memstats_heap_objects, probably useful for discovery. Let's gather more feedback, kind of a waste of bytes for everybody for compatibility reasons to keep both, and we can't really rename/remove useful metric.

`

``

56

`+

"Total number of heap objects allocated, both live and gc-ed. Semantically a counter version for go_memstats_heap_objects gauge. Equals to /gc/heap/allocs:objects + /gc/heap/tiny/allocs:objects.",

`

65

57

`nil, nil,

`

66

58

` ),

`

67

59

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.Mallocs) },

`

68

60

`valType: CounterValue,

`

69

61

` }, {

`

70

62

`desc: NewDesc(

`

71

63

`memstatNamespace("frees_total"),

`

72

``

`-

"Total number of heap objects frees.",

`

``

64

`+

"Total number of heap objects frees. Equals to /gc/heap/frees:objects + /gc/heap/tiny/allocs:objects.",

`

73

65

`nil, nil,

`

74

66

` ),

`

75

67

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.Frees) },

`

76

68

`valType: CounterValue,

`

77

69

` }, {

`

78

70

`desc: NewDesc(

`

79

71

`memstatNamespace("heap_alloc_bytes"),

`

80

``

`-

"Number of heap bytes allocated and currently in use.",

`

``

72

`+

"Number of heap bytes allocated and currently in use, same as go_memstats_alloc_bytes. Equals to /memory/classes/heap/objects:bytes.",

`

81

73

`nil, nil,

`

82

74

` ),

`

83

75

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapAlloc) },

`

84

76

`valType: GaugeValue,

`

85

77

` }, {

`

86

78

`desc: NewDesc(

`

87

79

`memstatNamespace("heap_sys_bytes"),

`

88

``

`-

"Number of heap bytes obtained from system.",

`

``

80

`+

"Number of heap bytes obtained from system. Equals to /memory/classes/heap/objects:bytes + /memory/classes/heap/unused:bytes + /memory/classes/heap/released:bytes + /memory/classes/heap/free:bytes.",

`

89

81

`nil, nil,

`

90

82

` ),

`

91

83

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapSys) },

`

92

84

`valType: GaugeValue,

`

93

85

` }, {

`

94

86

`desc: NewDesc(

`

95

87

`memstatNamespace("heap_idle_bytes"),

`

96

``

`-

"Number of heap bytes waiting to be used.",

`

``

88

`+

"Number of heap bytes waiting to be used. Equals to /memory/classes/heap/released:bytes + /memory/classes/heap/free:bytes.",

`

97

89

`nil, nil,

`

98

90

` ),

`

99

91

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapIdle) },

`

100

92

`valType: GaugeValue,

`

101

93

` }, {

`

102

94

`desc: NewDesc(

`

103

95

`memstatNamespace("heap_inuse_bytes"),

`

104

``

`-

"Number of heap bytes that are in use.",

`

``

96

`+

"Number of heap bytes that are in use. Equals to /memory/classes/heap/objects:bytes + /memory/classes/heap/unused:bytes",

`

105

97

`nil, nil,

`

106

98

` ),

`

107

99

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapInuse) },

`

108

100

`valType: GaugeValue,

`

109

101

` }, {

`

110

102

`desc: NewDesc(

`

111

103

`memstatNamespace("heap_released_bytes"),

`

112

``

`-

"Number of heap bytes released to OS.",

`

``

104

`+

"Number of heap bytes released to OS. Equals to /memory/classes/heap/released:bytes.",

`

113

105

`nil, nil,

`

114

106

` ),

`

115

107

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapReleased) },

`

116

108

`valType: GaugeValue,

`

117

109

` }, {

`

118

110

`desc: NewDesc(

`

119

111

`memstatNamespace("heap_objects"),

`

120

``

`-

"Number of currently allocated objects.",

`

``

112

`+

"Number of currently allocated objects. Equals to /gc/heap/objects:objects.",

`

121

113

`nil, nil,

`

122

114

` ),

`

123

115

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapObjects) },

`

124

116

`valType: GaugeValue,

`

125

117

` }, {

`

126

118

`desc: NewDesc(

`

127

119

`memstatNamespace("stack_inuse_bytes"),

`

128

``

`-

"Number of bytes in use by the stack allocator.",

`

``

120

`+

"Number of bytes obtained from system for stack allocator in non-CGO environments. Equals to /memory/classes/heap/stacks:bytes.",

`

129

121

`nil, nil,

`

130

122

` ),

`

131

123

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.StackInuse) },

`

132

124

`valType: GaugeValue,

`

133

125

` }, {

`

134

126

`desc: NewDesc(

`

135

127

`memstatNamespace("stack_sys_bytes"),

`

136

``

`-

"Number of bytes obtained from system for stack allocator.",

`

``

128

`+

"Number of bytes obtained from system for stack allocator. Equals to /memory/classes/heap/stacks:bytes + /memory/classes/os-stacks:bytes.",

`

137

129

`nil, nil,

`

138

130

` ),

`

139

131

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.StackSys) },

`

140

132

`valType: GaugeValue,

`

141

133

` }, {

`

142

134

`desc: NewDesc(

`

143

135

`memstatNamespace("mspan_inuse_bytes"),

`

144

``

`-

"Number of bytes in use by mspan structures.",

`

``

136

`+

"Number of bytes in use by mspan structures. Equals to /memory/classes/metadata/mspan/inuse:bytes.",

`

145

137

`nil, nil,

`

146

138

` ),

`

147

139

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.MSpanInuse) },

`

148

140

`valType: GaugeValue,

`

149

141

` }, {

`

150

142

`desc: NewDesc(

`

151

143

`memstatNamespace("mspan_sys_bytes"),

`

152

``

`-

"Number of bytes used for mspan structures obtained from system.",

`

``

144

`+

"Number of bytes used for mspan structures obtained from system. Equals to /memory/classes/metadata/mspan/inuse:bytes + /memory/classes/metadata/mspan/free:bytes.",

`

153

145

`nil, nil,

`

154

146

` ),

`

155

147

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.MSpanSys) },

`

156

148

`valType: GaugeValue,

`

157

149

` }, {

`

158

150

`desc: NewDesc(

`

159

151

`memstatNamespace("mcache_inuse_bytes"),

`

160

``

`-

"Number of bytes in use by mcache structures.",

`

``

152

`+

"Number of bytes in use by mcache structures. Equals to /memory/classes/metadata/mcache/inuse:bytes.",

`

161

153

`nil, nil,

`

162

154

` ),

`

163

155

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.MCacheInuse) },

`

164

156

`valType: GaugeValue,

`

165

157

` }, {

`

166

158

`desc: NewDesc(

`

167

159

`memstatNamespace("mcache_sys_bytes"),

`

168

``

`-

"Number of bytes used for mcache structures obtained from system.",

`

``

160

`+

"Number of bytes used for mcache structures obtained from system. Equals to /memory/classes/metadata/mcache/inuse:bytes + /memory/classes/metadata/mcache/free:bytes.",

`

169

161

`nil, nil,

`

170

162

` ),

`

171

163

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.MCacheSys) },

`

172

164

`valType: GaugeValue,

`

173

165

` }, {

`

174

166

`desc: NewDesc(

`

175

167

`memstatNamespace("buck_hash_sys_bytes"),

`

176

``

`-

"Number of bytes used by the profiling bucket hash table.",

`

``

168

`+

"Number of bytes used by the profiling bucket hash table. Equals to /memory/classes/profiling/buckets:bytes.",

`

177

169

`nil, nil,

`

178

170

` ),

`

179

171

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.BuckHashSys) },

`

180

172

`valType: GaugeValue,

`

181

173

` }, {

`

182

174

`desc: NewDesc(

`

183

175

`memstatNamespace("gc_sys_bytes"),

`

184

``

`-

"Number of bytes used for garbage collection system metadata.",

`

``

176

`+

"Number of bytes used for garbage collection system metadata. Equals to /memory/classes/metadata/other:bytes.",

`

185

177

`nil, nil,

`

186

178

` ),

`

187

179

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.GCSys) },

`

188

180

`valType: GaugeValue,

`

189

181

` }, {

`

190

182

`desc: NewDesc(

`

191

183

`memstatNamespace("other_sys_bytes"),

`

192

``

`-

"Number of bytes used for other system allocations.",

`

``

184

`+

"Number of bytes used for other system allocations. Equals to /memory/classes/other:bytes.",

`

193

185

`nil, nil,

`

194

186

` ),

`

195

187

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.OtherSys) },

`

196

188

`valType: GaugeValue,

`

197

189

` }, {

`

198

190

`desc: NewDesc(

`

199

191

`memstatNamespace("next_gc_bytes"),

`

200

``

`-

"Number of heap bytes when next garbage collection will take place.",

`

``

192

`+

"Number of heap bytes when next garbage collection will take place. Equals to /gc/heap/goal:bytes.",

`

201

193

`nil, nil,

`

202

194

` ),

`

203

195

`eval: func(ms *runtime.MemStats) float64 { return float64(ms.NextGC) },

`