github.com/geraldss/go/src@v0.0.0-20210511222824-ac7d0ebfc235/runtime/metrics/description.go (about) 1 // Copyright 2020 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package metrics 6 7 // Description describes a runtime metric. 8 type Description struct { 9 // Name is the full name of the metric which includes the unit. 10 // 11 // The format of the metric may be described by the following regular expression. 12 // 13 // ^(?P<name>/[^:]+):(?P<unit>[^:*/]+(?:[*/][^:*/]+)*)$ 14 // 15 // The format splits the name into two components, separated by a colon: a path which always 16 // starts with a /, and a machine-parseable unit. The name may contain any valid Unicode 17 // codepoint in between / characters, but by convention will try to stick to lowercase 18 // characters and hyphens. An example of such a path might be "/memory/heap/free". 19 // 20 // The unit is by convention a series of lowercase English unit names (singular or plural) 21 // without prefixes delimited by '*' or '/'. The unit names may contain any valid Unicode 22 // codepoint that is not a delimiter. 23 // Examples of units might be "seconds", "bytes", "bytes/second", "cpu-seconds", 24 // "byte*cpu-seconds", and "bytes/second/second". 25 // 26 // For histograms, multiple units may apply. For instance, the units of the buckets and 27 // the count. By convention, for histograms, the units of the count are always "samples" 28 // with the type of sample evident by the metric's name, while the unit in the name 29 // specifies the buckets' unit. 30 // 31 // A complete name might look like "/memory/heap/free:bytes". 32 Name string 33 34 // Description is an English language sentence describing the metric. 35 Description string 36 37 // Kind is the kind of value for this metric. 38 // 39 // The purpose of this field is to allow users to filter out metrics whose values are 40 // types which their application may not understand. 41 Kind ValueKind 42 43 // Cumulative is whether or not the metric is cumulative. If a cumulative metric is just 44 // a single number, then it increases monotonically. If the metric is a distribution, 45 // then each bucket count increases monotonically. 46 // 47 // This flag thus indicates whether or not it's useful to compute a rate from this value. 48 Cumulative bool 49 } 50 51 // The English language descriptions below must be kept in sync with the 52 // descriptions of each metric in doc.go. 53 var allDesc = []Description{ 54 { 55 Name: "/gc/cycles/automatic:gc-cycles", 56 Description: "Count of completed GC cycles generated by the Go runtime.", 57 Kind: KindUint64, 58 Cumulative: true, 59 }, 60 { 61 Name: "/gc/cycles/forced:gc-cycles", 62 Description: "Count of completed GC cycles forced by the application.", 63 Kind: KindUint64, 64 Cumulative: true, 65 }, 66 { 67 Name: "/gc/cycles/total:gc-cycles", 68 Description: "Count of all completed GC cycles.", 69 Kind: KindUint64, 70 Cumulative: true, 71 }, 72 { 73 Name: "/gc/heap/allocs-by-size:bytes", 74 Description: "Distribution of all objects allocated by approximate size.", 75 Kind: KindFloat64Histogram, 76 Cumulative: true, 77 }, 78 { 79 Name: "/gc/heap/frees-by-size:bytes", 80 Description: "Distribution of all objects freed by approximate size.", 81 Kind: KindFloat64Histogram, 82 Cumulative: true, 83 }, 84 { 85 Name: "/gc/heap/goal:bytes", 86 Description: "Heap size target for the end of the GC cycle.", 87 Kind: KindUint64, 88 }, 89 { 90 Name: "/gc/heap/objects:objects", 91 Description: "Number of objects, live or unswept, occupying heap memory.", 92 Kind: KindUint64, 93 }, 94 { 95 Name: "/gc/pauses:seconds", 96 Description: "Distribution individual GC-related stop-the-world pause latencies.", 97 Kind: KindFloat64Histogram, 98 Cumulative: true, 99 }, 100 { 101 Name: "/memory/classes/heap/free:bytes", 102 Description: "Memory that is completely free and eligible to be returned to the underlying system, " + 103 "but has not been. This metric is the runtime's estimate of free address space that is backed by " + 104 "physical memory.", 105 Kind: KindUint64, 106 }, 107 { 108 Name: "/memory/classes/heap/objects:bytes", 109 Description: "Memory occupied by live objects and dead objects that have not yet been marked free by the garbage collector.", 110 Kind: KindUint64, 111 }, 112 { 113 Name: "/memory/classes/heap/released:bytes", 114 Description: "Memory that is completely free and has been returned to the underlying system. This " + 115 "metric is the runtime's estimate of free address space that is still mapped into the process, " + 116 "but is not backed by physical memory.", 117 Kind: KindUint64, 118 }, 119 { 120 Name: "/memory/classes/heap/stacks:bytes", 121 Description: "Memory allocated from the heap that is reserved for stack space, whether or not it is currently in-use.", 122 Kind: KindUint64, 123 }, 124 { 125 Name: "/memory/classes/heap/unused:bytes", 126 Description: "Memory that is reserved for heap objects but is not currently used to hold heap objects.", 127 Kind: KindUint64, 128 }, 129 { 130 Name: "/memory/classes/metadata/mcache/free:bytes", 131 Description: "Memory that is reserved for runtime mcache structures, but not in-use.", 132 Kind: KindUint64, 133 }, 134 { 135 Name: "/memory/classes/metadata/mcache/inuse:bytes", 136 Description: "Memory that is occupied by runtime mcache structures that are currently being used.", 137 Kind: KindUint64, 138 }, 139 { 140 Name: "/memory/classes/metadata/mspan/free:bytes", 141 Description: "Memory that is reserved for runtime mspan structures, but not in-use.", 142 Kind: KindUint64, 143 }, 144 { 145 Name: "/memory/classes/metadata/mspan/inuse:bytes", 146 Description: "Memory that is occupied by runtime mspan structures that are currently being used.", 147 Kind: KindUint64, 148 }, 149 { 150 Name: "/memory/classes/metadata/other:bytes", 151 Description: "Memory that is reserved for or used to hold runtime metadata.", 152 Kind: KindUint64, 153 }, 154 { 155 Name: "/memory/classes/os-stacks:bytes", 156 Description: "Stack memory allocated by the underlying operating system.", 157 Kind: KindUint64, 158 }, 159 { 160 Name: "/memory/classes/other:bytes", 161 Description: "Memory used by execution trace buffers, structures for debugging the runtime, finalizer and profiler specials, and more.", 162 Kind: KindUint64, 163 }, 164 { 165 Name: "/memory/classes/profiling/buckets:bytes", 166 Description: "Memory that is used by the stack trace hash map used for profiling.", 167 Kind: KindUint64, 168 }, 169 { 170 Name: "/memory/classes/total:bytes", 171 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.", 172 Kind: KindUint64, 173 }, 174 { 175 Name: "/sched/goroutines:goroutines", 176 Description: "Count of live goroutines.", 177 Kind: KindUint64, 178 }, 179 } 180 181 // All returns a slice of containing metric descriptions for all supported metrics. 182 func All() []Description { 183 return allDesc 184 }