1
2
3
4
5 package metrics
6
7 import "internal/godebugs"
8
9
10 type Description struct {
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 Name string
35
36
37 Description string
38
39
40
41
42
43 Kind ValueKind
44
45
46
47
48
49
50 Cumulative bool
51 }
52
53
54
55 var allDesc = []Description{
56 {
57 Name: "/cgo/go-to-c-calls:calls",
58 Description: "Count of calls made from Go to C by the current process.",
59 Kind: KindUint64,
60 Cumulative: true,
61 },
62 {
63 Name: "/cpu/classes/gc/mark/assist:cpu-seconds",
64 Description: "Estimated total CPU time goroutines spent performing GC tasks " +
65 "to assist the GC and prevent it from falling behind the application. " +
66 "This metric is an overestimate, and not directly comparable to " +
67 "system CPU time measurements. Compare only with other /cpu/classes " +
68 "metrics.",
69 Kind: KindFloat64,
70 Cumulative: true,
71 },
72 {
73 Name: "/cpu/classes/gc/mark/dedicated:cpu-seconds",
74 Description: "Estimated total CPU time spent performing GC tasks on " +
75 "processors (as defined by GOMAXPROCS) dedicated to those tasks. " +
76 "This metric is an overestimate, and not directly comparable to " +
77 "system CPU time measurements. Compare only with other /cpu/classes " +
78 "metrics.",
79 Kind: KindFloat64,
80 Cumulative: true,
81 },
82 {
83 Name: "/cpu/classes/gc/mark/idle:cpu-seconds",
84 Description: "Estimated total CPU time spent performing GC tasks on " +
85 "spare CPU resources that the Go scheduler could not otherwise find " +
86 "a use for. This should be subtracted from the total GC CPU time to " +
87 "obtain a measure of compulsory GC CPU time. " +
88 "This metric is an overestimate, and not directly comparable to " +
89 "system CPU time measurements. Compare only with other /cpu/classes " +
90 "metrics.",
91 Kind: KindFloat64,
92 Cumulative: true,
93 },
94 {
95 Name: "/cpu/classes/gc/pause:cpu-seconds",
96 Description: "Estimated total CPU time spent with the application paused by " +
97 "the GC. Even if only one thread is running during the pause, this is " +
98 "computed as GOMAXPROCS times the pause latency because nothing else " +
99 "can be executing. This is the exact sum of samples in " +
100 "/sched/pauses/total/gc:seconds if each sample is multiplied by " +
101 "GOMAXPROCS at the time it is taken. This metric is an overestimate, " +
102 "and not directly comparable to system CPU time measurements. Compare " +
103 "only with other /cpu/classes metrics.",
104 Kind: KindFloat64,
105 Cumulative: true,
106 },
107 {
108 Name: "/cpu/classes/gc/total:cpu-seconds",
109 Description: "Estimated total CPU time spent performing GC tasks. " +
110 "This metric is an overestimate, and not directly comparable to " +
111 "system CPU time measurements. Compare only with other /cpu/classes " +
112 "metrics. Sum of all metrics in /cpu/classes/gc.",
113 Kind: KindFloat64,
114 Cumulative: true,
115 },
116 {
117 Name: "/cpu/classes/idle:cpu-seconds",
118 Description: "Estimated total available CPU time not spent executing any Go or Go runtime code. " +
119 "In other words, the part of /cpu/classes/total:cpu-seconds that was unused. " +
120 "This metric is an overestimate, and not directly comparable to " +
121 "system CPU time measurements. Compare only with other /cpu/classes " +
122 "metrics.",
123 Kind: KindFloat64,
124 Cumulative: true,
125 },
126 {
127 Name: "/cpu/classes/scavenge/assist:cpu-seconds",
128 Description: "Estimated total CPU time spent returning unused memory to the " +
129 "underlying platform in response eagerly in response to memory pressure. " +
130 "This metric is an overestimate, and not directly comparable to " +
131 "system CPU time measurements. Compare only with other /cpu/classes " +
132 "metrics.",
133 Kind: KindFloat64,
134 Cumulative: true,
135 },
136 {
137 Name: "/cpu/classes/scavenge/background:cpu-seconds",
138 Description: "Estimated total CPU time spent performing background tasks " +
139 "to return unused memory to the underlying platform. " +
140 "This metric is an overestimate, and not directly comparable to " +
141 "system CPU time measurements. Compare only with other /cpu/classes " +
142 "metrics.",
143 Kind: KindFloat64,
144 Cumulative: true,
145 },
146 {
147 Name: "/cpu/classes/scavenge/total:cpu-seconds",
148 Description: "Estimated total CPU time spent performing tasks that return " +
149 "unused memory to the underlying platform. " +
150 "This metric is an overestimate, and not directly comparable to " +
151 "system CPU time measurements. Compare only with other /cpu/classes " +
152 "metrics. Sum of all metrics in /cpu/classes/scavenge.",
153 Kind: KindFloat64,
154 Cumulative: true,
155 },
156 {
157 Name: "/cpu/classes/total:cpu-seconds",
158 Description: "Estimated total available CPU time for user Go code " +
159 "or the Go runtime, as defined by GOMAXPROCS. In other words, GOMAXPROCS " +
160 "integrated over the wall-clock duration this process has been executing for. " +
161 "This metric is an overestimate, and not directly comparable to " +
162 "system CPU time measurements. Compare only with other /cpu/classes " +
163 "metrics. Sum of all metrics in /cpu/classes.",
164 Kind: KindFloat64,
165 Cumulative: true,
166 },
167 {
168 Name: "/cpu/classes/user:cpu-seconds",
169 Description: "Estimated total CPU time spent running user Go code. This may " +
170 "also include some small amount of time spent in the Go runtime. " +
171 "This metric is an overestimate, and not directly comparable to " +
172 "system CPU time measurements. Compare only with other /cpu/classes " +
173 "metrics.",
174 Kind: KindFloat64,
175 Cumulative: true,
176 },
177 {
178 Name: "/gc/cleanups/executed:cleanups",
179 Description: "Approximate total count of cleanup functions (created by runtime.AddCleanup) " +
180 "executed by the runtime. Subtract /gc/cleanups/queued:cleanups to approximate " +
181 "cleanup queue length. Useful for detecting slow cleanups holding up the queue.",
182 Kind: KindUint64,
183 Cumulative: true,
184 },
185 {
186 Name: "/gc/cleanups/queued:cleanups",
187 Description: "Approximate total count of cleanup functions (created by runtime.AddCleanup) " +
188 "queued by the runtime for execution. Subtract from /gc/cleanups/executed:cleanups " +
189 "to approximate cleanup queue length. Useful for detecting slow cleanups holding up the queue.",
190 Kind: KindUint64,
191 Cumulative: true,
192 },
193 {
194 Name: "/gc/cycles/automatic:gc-cycles",
195 Description: "Count of completed GC cycles generated by the Go runtime.",
196 Kind: KindUint64,
197 Cumulative: true,
198 },
199 {
200 Name: "/gc/cycles/forced:gc-cycles",
201 Description: "Count of completed GC cycles forced by the application.",
202 Kind: KindUint64,
203 Cumulative: true,
204 },
205 {
206 Name: "/gc/cycles/total:gc-cycles",
207 Description: "Count of all completed GC cycles.",
208 Kind: KindUint64,
209 Cumulative: true,
210 },
211 {
212 Name: "/gc/finalizers/executed:finalizers",
213 Description: "Total count of finalizer functions (created by runtime.SetFinalizer) " +
214 "executed by the runtime. Subtract /gc/finalizers/queued:finalizers to approximate " +
215 "finalizer queue length. Useful for detecting finalizers overwhelming the queue, " +
216 "either by being too slow, or by there being too many of them.",
217 Kind: KindUint64,
218 Cumulative: true,
219 },
220 {
221 Name: "/gc/finalizers/queued:finalizers",
222 Description: "Total count of finalizer functions (created by runtime.SetFinalizer) and " +
223 "queued by the runtime for execution. Subtract from /gc/finalizers/executed:finalizers " +
224 "to approximate finalizer queue length. Useful for detecting slow finalizers holding up the queue.",
225 Kind: KindUint64,
226 Cumulative: true,
227 },
228 {
229 Name: "/gc/gogc:percent",
230 Description: "Heap size target percentage configured by the user, otherwise 100. This " +
231 "value is set by the GOGC environment variable, and the runtime/debug.SetGCPercent " +
232 "function.",
233 Kind: KindUint64,
234 },
235 {
236 Name: "/gc/gomemlimit:bytes",
237 Description: "Go runtime memory limit configured by the user, otherwise " +
238 "math.MaxInt64. This value is set by the GOMEMLIMIT environment variable, and " +
239 "the runtime/debug.SetMemoryLimit function.",
240 Kind: KindUint64,
241 },
242 {
243 Name: "/gc/heap/allocs-by-size:bytes",
244 Description: "Distribution of heap allocations by approximate size. " +
245 "Bucket counts increase monotonically. " +
246 "Note that this does not include tiny objects as defined by " +
247 "/gc/heap/tiny/allocs:objects, only tiny blocks.",
248 Kind: KindFloat64Histogram,
249 Cumulative: true,
250 },
251 {
252 Name: "/gc/heap/allocs:bytes",
253 Description: "Cumulative sum of memory allocated to the heap by the application.",
254 Kind: KindUint64,
255 Cumulative: true,
256 },
257 {
258 Name: "/gc/heap/allocs:objects",
259 Description: "Cumulative count of heap allocations triggered by the application. " +
260 "Note that this does not include tiny objects as defined by " +
261 "/gc/heap/tiny/allocs:objects, only tiny blocks.",
262 Kind: KindUint64,
263 Cumulative: true,
264 },
265 {
266 Name: "/gc/heap/frees-by-size:bytes",
267 Description: "Distribution of freed heap allocations by approximate size. " +
268 "Bucket counts increase monotonically. " +
269 "Note that this does not include tiny objects as defined by " +
270 "/gc/heap/tiny/allocs:objects, only tiny blocks.",
271 Kind: KindFloat64Histogram,
272 Cumulative: true,
273 },
274 {
275 Name: "/gc/heap/frees:bytes",
276 Description: "Cumulative sum of heap memory freed by the garbage collector.",
277 Kind: KindUint64,
278 Cumulative: true,
279 },
280 {
281 Name: "/gc/heap/frees:objects",
282 Description: "Cumulative count of heap allocations whose storage was freed " +
283 "by the garbage collector. " +
284 "Note that this does not include tiny objects as defined by " +
285 "/gc/heap/tiny/allocs:objects, only tiny blocks.",
286 Kind: KindUint64,
287 Cumulative: true,
288 },
289 {
290 Name: "/gc/heap/goal:bytes",
291 Description: "Heap size target for the end of the GC cycle.",
292 Kind: KindUint64,
293 },
294 {
295 Name: "/gc/heap/live:bytes",
296 Description: "Heap memory occupied by live objects that were marked by the previous GC.",
297 Kind: KindUint64,
298 },
299 {
300 Name: "/gc/heap/objects:objects",
301 Description: "Number of objects, live or unswept, occupying heap memory.",
302 Kind: KindUint64,
303 },
304 {
305 Name: "/gc/heap/tiny/allocs:objects",
306 Description: "Count of small allocations that are packed together into blocks. " +
307 "These allocations are counted separately from other allocations " +
308 "because each individual allocation is not tracked by the runtime, " +
309 "only their block. Each block is already accounted for in " +
310 "allocs-by-size and frees-by-size.",
311 Kind: KindUint64,
312 Cumulative: true,
313 },
314 {
315 Name: "/gc/limiter/last-enabled:gc-cycle",
316 Description: "GC cycle the last time the GC CPU limiter was enabled. " +
317 "This metric is useful for diagnosing the root cause of an out-of-memory " +
318 "error, because the limiter trades memory for CPU time when the GC's CPU " +
319 "time gets too high. This is most likely to occur with use of SetMemoryLimit. " +
320 "The first GC cycle is cycle 1, so a value of 0 indicates that it was never enabled.",
321 Kind: KindUint64,
322 },
323 {
324 Name: "/gc/pauses:seconds",
325 Description: "Deprecated. Prefer the identical /sched/pauses/total/gc:seconds.",
326 Kind: KindFloat64Histogram,
327 Cumulative: true,
328 },
329 {
330 Name: "/gc/scan/globals:bytes",
331 Description: "The total amount of global variable space that is scannable.",
332 Kind: KindUint64,
333 },
334 {
335 Name: "/gc/scan/heap:bytes",
336 Description: "The total amount of heap space that is scannable.",
337 Kind: KindUint64,
338 },
339 {
340 Name: "/gc/scan/stack:bytes",
341 Description: "The number of bytes of stack that were scanned last GC cycle.",
342 Kind: KindUint64,
343 },
344 {
345 Name: "/gc/scan/total:bytes",
346 Description: "The total amount space that is scannable. Sum of all metrics in /gc/scan.",
347 Kind: KindUint64,
348 },
349 {
350 Name: "/gc/stack/starting-size:bytes",
351 Description: "The stack size of new goroutines.",
352 Kind: KindUint64,
353 Cumulative: false,
354 },
355 {
356 Name: "/memory/classes/heap/free:bytes",
357 Description: "Memory that is completely free and eligible to be returned to the underlying system, " +
358 "but has not been. This metric is the runtime's estimate of free address space that is backed by " +
359 "physical memory.",
360 Kind: KindUint64,
361 },
362 {
363 Name: "/memory/classes/heap/objects:bytes",
364 Description: "Memory occupied by live objects and dead objects that have not yet been marked free by the garbage collector.",
365 Kind: KindUint64,
366 },
367 {
368 Name: "/memory/classes/heap/released:bytes",
369 Description: "Memory that is completely free and has been returned to the underlying system. This " +
370 "metric is the runtime's estimate of free address space that is still mapped into the process, " +
371 "but is not backed by physical memory.",
372 Kind: KindUint64,
373 },
374 {
375 Name: "/memory/classes/heap/stacks:bytes",
376 Description: "Memory allocated from the heap that is reserved for stack space, whether or not it is currently in-use. " +
377 "Currently, this represents all stack memory for goroutines. It also includes all OS thread stacks in non-cgo programs. " +
378 "Note that stacks may be allocated differently in the future, and this may change.",
379 Kind: KindUint64,
380 },
381 {
382 Name: "/memory/classes/heap/unused:bytes",
383 Description: "Memory that is reserved for heap objects but is not currently used to hold heap objects.",
384 Kind: KindUint64,
385 },
386 {
387 Name: "/memory/classes/metadata/mcache/free:bytes",
388 Description: "Memory that is reserved for runtime mcache structures, but not in-use.",
389 Kind: KindUint64,
390 },
391 {
392 Name: "/memory/classes/metadata/mcache/inuse:bytes",
393 Description: "Memory that is occupied by runtime mcache structures that are currently being used.",
394 Kind: KindUint64,
395 },
396 {
397 Name: "/memory/classes/metadata/mspan/free:bytes",
398 Description: "Memory that is reserved for runtime mspan structures, but not in-use.",
399 Kind: KindUint64,
400 },
401 {
402 Name: "/memory/classes/metadata/mspan/inuse:bytes",
403 Description: "Memory that is occupied by runtime mspan structures that are currently being used.",
404 Kind: KindUint64,
405 },
406 {
407 Name: "/memory/classes/metadata/other:bytes",
408 Description: "Memory that is reserved for or used to hold runtime metadata.",
409 Kind: KindUint64,
410 },
411 {
412 Name: "/memory/classes/os-stacks:bytes",
413 Description: "Stack memory allocated by the underlying operating system. " +
414 "In non-cgo programs this metric is currently zero. This may change in the future." +
415 "In cgo programs this metric includes OS thread stacks allocated directly from the OS. " +
416 "Currently, this only accounts for one stack in c-shared and c-archive build modes, " +
417 "and other sources of stacks from the OS are not measured. This too may change in the future.",
418 Kind: KindUint64,
419 },
420 {
421 Name: "/memory/classes/other:bytes",
422 Description: "Memory used by execution trace buffers, structures for debugging the runtime, finalizer and profiler specials, and more.",
423 Kind: KindUint64,
424 },
425 {
426 Name: "/memory/classes/profiling/buckets:bytes",
427 Description: "Memory that is used by the stack trace hash map used for profiling.",
428 Kind: KindUint64,
429 },
430 {
431 Name: "/memory/classes/total:bytes",
432 Description: "All memory mapped by the Go runtime into the current process as read-write. Note that this does not include memory mapped by code called via cgo or via the syscall package. Sum of all metrics in /memory/classes.",
433 Kind: KindUint64,
434 },
435 {
436 Name: "/sched/gomaxprocs:threads",
437 Description: "The current runtime.GOMAXPROCS setting, or the number of operating system threads that can execute user-level Go code simultaneously.",
438 Kind: KindUint64,
439 },
440 {
441 Name: "/sched/goroutines:goroutines",
442 Description: "Count of live goroutines.",
443 Kind: KindUint64,
444 },
445 {
446 Name: "/sched/latencies:seconds",
447 Description: "Distribution of the time goroutines have spent in the scheduler in a runnable state before actually running. Bucket counts increase monotonically.",
448 Kind: KindFloat64Histogram,
449 Cumulative: true,
450 },
451 {
452 Name: "/sched/pauses/stopping/gc:seconds",
453 Description: "Distribution of individual GC-related stop-the-world stopping latencies. This is the time it takes from deciding to stop the world until all Ps are stopped. This is a subset of the total GC-related stop-the-world time (/sched/pauses/total/gc:seconds). During this time, some threads may be executing. Bucket counts increase monotonically.",
454 Kind: KindFloat64Histogram,
455 Cumulative: true,
456 },
457 {
458 Name: "/sched/pauses/stopping/other:seconds",
459 Description: "Distribution of individual non-GC-related stop-the-world stopping latencies. This is the time it takes from deciding to stop the world until all Ps are stopped. This is a subset of the total non-GC-related stop-the-world time (/sched/pauses/total/other:seconds). During this time, some threads may be executing. Bucket counts increase monotonically.",
460 Kind: KindFloat64Histogram,
461 Cumulative: true,
462 },
463 {
464 Name: "/sched/pauses/total/gc:seconds",
465 Description: "Distribution of individual GC-related stop-the-world pause latencies. This is the time from deciding to stop the world until the world is started again. Some of this time is spent getting all threads to stop (this is measured directly in /sched/pauses/stopping/gc:seconds), during which some threads may still be running. Bucket counts increase monotonically.",
466 Kind: KindFloat64Histogram,
467 Cumulative: true,
468 },
469 {
470 Name: "/sched/pauses/total/other:seconds",
471 Description: "Distribution of individual non-GC-related stop-the-world pause latencies. This is the time from deciding to stop the world until the world is started again. Some of this time is spent getting all threads to stop (measured directly in /sched/pauses/stopping/other:seconds). Bucket counts increase monotonically.",
472 Kind: KindFloat64Histogram,
473 Cumulative: true,
474 },
475 {
476 Name: "/sync/mutex/wait/total:seconds",
477 Description: "Approximate cumulative time goroutines have spent blocked on a sync.Mutex, sync.RWMutex, or runtime-internal lock. This metric is useful for identifying global changes in lock contention. Collect a mutex or block profile using the runtime/pprof package for more detailed contention data.",
478 Kind: KindFloat64,
479 Cumulative: true,
480 },
481 }
482
483 func init() {
484
485
486 i := 0
487 for i < len(allDesc) && allDesc[i].Name < "/godebug/" {
488 i++
489 }
490 more := make([]Description, i, len(allDesc)+len(godebugs.All))
491 copy(more, allDesc)
492 for _, info := range godebugs.All {
493 if !info.Opaque {
494 more = append(more, Description{
495 Name: "/godebug/non-default-behavior/" + info.Name + ":events",
496 Description: "The number of non-default behaviors executed by the " +
497 info.Package + " package " + "due to a non-default " +
498 "GODEBUG=" + info.Name + "=... setting.",
499 Kind: KindUint64,
500 Cumulative: true,
501 })
502 }
503 }
504 allDesc = append(more, allDesc[i:]...)
505 }
506
507
508 func All() []Description {
509 return allDesc
510 }
511
View as plain text