Documentation
¶
Overview ¶
Package units provides a common spot for OTel units.
Units should follow the Unified Code for Units of Measure (UCUM).
- Instruments for utilization metrics (that measure the fraction out of a total) are dimensionless and SHOULD use the default unit 1 (the unity).
- All non-units that use curly braces to annotate a quantity need to match the grammatical number of the quantity it represent. For example, if measuring the number of individual requests to a process the unit would be "{request}", not "{requests}".
- Instruments that measure an integer count of something SHOULD only use annotations with curly braces to give additional meaning without the leading default unit (1). For example, use "{packet}", "{error}", "{fault}", etc.
- Instrument units other than 1 and those that use annotations SHOULD be specified using the UCUM case sensitive ("c/s") variant. For example, "Cel" for the unit with full name "degree Celsius".
- Instruments SHOULD use non-prefixed units (i.e. "By" instead of "MiBy") unless there is good technical reason to not do so.
- When instruments are measuring durations, seconds (i.e. "s") SHOULD be used.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Byte = metric.WithUnit("By") Second = metric.WithUnit("s") )
Various common units.
View Source
var Buckets metric.HistogramOption
Buckets as suggested for request durations.
View Source
var LargeBuckets metric.HistogramOption
LargeBuckets is a 10x multiple of Buckets.
View Source
var VeryLargeBuckets metric.HistogramOption
VeryLargeBuckets is a 20x multiple Buckets.
Functions ¶
func BucketBoundaries ¶
BucketBoundaries returns "count" bucket boundaries in the same pattern as the semconv suggested bucket boundaries.
func Count ¶
func Count(singular string) metric.InstrumentOption
Count returns a metric.InstrumentOption for integer counts of something.
The passed string should be singular and not include braces.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.