Skip to content

Commit 062300e

Browse files
bwplotkaArthurSens
andauthored
Remove go_memstat_lookups_total; added runtime/metrics calculation to memstat metric's help. (#1577)
* Removeed go_memstat_lookups_total which was always set to 0; added runtime/metrics info to memstat metric helps. I know we ideally should not remove any metric from default list, but this one is always zero, so let's save everyone's money. Signed-off-by: bwplotka <[email protected]> * Update prometheus/go_collector.go Co-authored-by: Arthur Silva Sens <[email protected]> Signed-off-by: Bartlomiej Plotka <[email protected]> --------- Signed-off-by: bwplotka <[email protected]> Signed-off-by: Bartlomiej Plotka <[email protected]> Co-authored-by: Arthur Silva Sens <[email protected]>
1 parent aa3c00d commit 062300e

File tree

4 files changed

+24
-32
lines changed

4 files changed

+24
-32
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## Unreleased
22

3+
* [CHANGE] go-collector: Remove `go_memstat_lookups_total` metric which was always 0; Go runtime stopped sharing pointer lookup statistics.
4+
35
## 1.19.0 / 2023-02-27
46

57
The module `prometheus/common v0.48.0` introduced an incompatibility when used together with client_golang (See https://github.com/prometheus/client_golang/pull/1448 for more details). If your project uses client_golang and you want to use `prometheus/common v0.48.0` or higher, please update client_golang to v1.19.0.

prometheus/collectors/go_collector_latest.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ var (
4747
// go_memstats_alloc_bytes
4848
// go_memstats_alloc_bytes_total
4949
// go_memstats_sys_bytes
50-
// go_memstats_lookups_total
5150
// go_memstats_mallocs_total
5251
// go_memstats_frees_total
5352
// go_memstats_heap_alloc_bytes

prometheus/collectors/go_collector_latest_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ var memstatMetrics = []string{
5050
"go_memstats_heap_objects",
5151
"go_memstats_heap_released_bytes",
5252
"go_memstats_heap_sys_bytes",
53-
"go_memstats_lookups_total",
5453
"go_memstats_mallocs_total",
5554
"go_memstats_mcache_inuse_bytes",
5655
"go_memstats_mcache_sys_bytes",

prometheus/go_collector.go

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,176 +28,168 @@ func goRuntimeMemStats() memStatsMetrics {
2828
{
2929
desc: NewDesc(
3030
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.",
3232
nil, nil,
3333
),
3434
eval: func(ms *runtime.MemStats) float64 { return float64(ms.Alloc) },
3535
valType: GaugeValue,
3636
}, {
3737
desc: NewDesc(
3838
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.",
4040
nil, nil,
4141
),
4242
eval: func(ms *runtime.MemStats) float64 { return float64(ms.TotalAlloc) },
4343
valType: CounterValue,
4444
}, {
4545
desc: NewDesc(
4646
memstatNamespace("sys_bytes"),
47-
"Number of bytes obtained from system.",
47+
"Number of bytes obtained from system. Equals to /memory/classes/total:byte.",
4848
nil, nil,
4949
),
5050
eval: func(ms *runtime.MemStats) float64 { return float64(ms.Sys) },
5151
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,
6052
}, {
6153
desc: NewDesc(
6254
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.",
6557
nil, nil,
6658
),
6759
eval: func(ms *runtime.MemStats) float64 { return float64(ms.Mallocs) },
6860
valType: CounterValue,
6961
}, {
7062
desc: NewDesc(
7163
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.",
7365
nil, nil,
7466
),
7567
eval: func(ms *runtime.MemStats) float64 { return float64(ms.Frees) },
7668
valType: CounterValue,
7769
}, {
7870
desc: NewDesc(
7971
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.",
8173
nil, nil,
8274
),
8375
eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapAlloc) },
8476
valType: GaugeValue,
8577
}, {
8678
desc: NewDesc(
8779
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.",
8981
nil, nil,
9082
),
9183
eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapSys) },
9284
valType: GaugeValue,
9385
}, {
9486
desc: NewDesc(
9587
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.",
9789
nil, nil,
9890
),
9991
eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapIdle) },
10092
valType: GaugeValue,
10193
}, {
10294
desc: NewDesc(
10395
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",
10597
nil, nil,
10698
),
10799
eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapInuse) },
108100
valType: GaugeValue,
109101
}, {
110102
desc: NewDesc(
111103
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.",
113105
nil, nil,
114106
),
115107
eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapReleased) },
116108
valType: GaugeValue,
117109
}, {
118110
desc: NewDesc(
119111
memstatNamespace("heap_objects"),
120-
"Number of currently allocated objects.",
112+
"Number of currently allocated objects. Equals to /gc/heap/objects:objects.",
121113
nil, nil,
122114
),
123115
eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapObjects) },
124116
valType: GaugeValue,
125117
}, {
126118
desc: NewDesc(
127119
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.",
129121
nil, nil,
130122
),
131123
eval: func(ms *runtime.MemStats) float64 { return float64(ms.StackInuse) },
132124
valType: GaugeValue,
133125
}, {
134126
desc: NewDesc(
135127
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.",
137129
nil, nil,
138130
),
139131
eval: func(ms *runtime.MemStats) float64 { return float64(ms.StackSys) },
140132
valType: GaugeValue,
141133
}, {
142134
desc: NewDesc(
143135
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.",
145137
nil, nil,
146138
),
147139
eval: func(ms *runtime.MemStats) float64 { return float64(ms.MSpanInuse) },
148140
valType: GaugeValue,
149141
}, {
150142
desc: NewDesc(
151143
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.",
153145
nil, nil,
154146
),
155147
eval: func(ms *runtime.MemStats) float64 { return float64(ms.MSpanSys) },
156148
valType: GaugeValue,
157149
}, {
158150
desc: NewDesc(
159151
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.",
161153
nil, nil,
162154
),
163155
eval: func(ms *runtime.MemStats) float64 { return float64(ms.MCacheInuse) },
164156
valType: GaugeValue,
165157
}, {
166158
desc: NewDesc(
167159
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.",
169161
nil, nil,
170162
),
171163
eval: func(ms *runtime.MemStats) float64 { return float64(ms.MCacheSys) },
172164
valType: GaugeValue,
173165
}, {
174166
desc: NewDesc(
175167
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.",
177169
nil, nil,
178170
),
179171
eval: func(ms *runtime.MemStats) float64 { return float64(ms.BuckHashSys) },
180172
valType: GaugeValue,
181173
}, {
182174
desc: NewDesc(
183175
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.",
185177
nil, nil,
186178
),
187179
eval: func(ms *runtime.MemStats) float64 { return float64(ms.GCSys) },
188180
valType: GaugeValue,
189181
}, {
190182
desc: NewDesc(
191183
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.",
193185
nil, nil,
194186
),
195187
eval: func(ms *runtime.MemStats) float64 { return float64(ms.OtherSys) },
196188
valType: GaugeValue,
197189
}, {
198190
desc: NewDesc(
199191
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.",
201193
nil, nil,
202194
),
203195
eval: func(ms *runtime.MemStats) float64 { return float64(ms.NextGC) },

0 commit comments

Comments
 (0)