| // Copyright 2020 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| |
| package metrics |
| |
| // Description describes a runtime metric. |
| type Description struct { |
| // Name is the full name of the metric which includes the unit. |
| // |
| // The format of the metric may be described by the following regular expression. |
| // |
| // ^(?P<name>/[^:]+):(?P<unit>[^:*\/]+(?:[*\/][^:*\/]+)*)$ |
| // |
| // The format splits the name into two components, separated by a colon: a path which always |
| // starts with a /, and a machine-parseable unit. The name may contain any valid Unicode |
| // codepoint in between / characters, but by convention will try to stick to lowercase |
| // characters and hyphens. An example of such a path might be "/memory/heap/free". |
| // |
| // The unit is by convention a series of lowercase English unit names (singular or plural) |
| // without prefixes delimited by '*' or '/'. The unit names may contain any valid Unicode |
| // codepoint that is not a delimiter. |
| // Examples of units might be "seconds", "bytes", "bytes/second", "cpu-seconds", |
| // "byte*cpu-seconds", and "bytes/second/second". |
| // |
| // A complete name might look like "/memory/heap/free:bytes". |
| Name string |
| |
| // Kind is the kind of value for this metric. |
| // |
| // The purpose of this field is to allow users to filter out metrics whose values are |
| // types which their application may not understand. |
| Kind ValueKind |
| |
| // Cumulative is whether or not the metric is cumulative. If a cumulative metric is just |
| // a single number, then it increases monotonically. If the metric is a distribution, |
| // then each bucket count increases monotonically. |
| // |
| // This flag thus indicates whether or not it's useful to compute a rate from this value. |
| Cumulative bool |
| |
| // StopTheWorld is whether or not the metric requires a stop-the-world |
| // event in order to collect it. |
| StopTheWorld bool |
| } |
| |
| var allDesc = []Description{} |
| |
| // All returns a slice of containing metric descriptions for all supported metrics. |
| func All() []Description { |
| return allDesc |
| } |