Foundational traits for interoperable metrics libraries in Rust.
Most libraries, under the hood, are all based around a core set of data types: counters, gauges, and histograms. While the API surface may differ, the underlying data is the same.
Counters represent a single value that can only ever be incremented over time, or reset to zero.
Counters are useful for tracking things like operations completed, or errors raised, where the value naturally begins at zero when a process or service is started or restarted.
Gauges represent a single value that can go up or down over time.
Gauges are useful for tracking things like the current number of connected users, or a stock price, or the temperature outside.
Histograms measure the distribution of values for a given set of measurements.
Histograms are generally used to derive statistics about a particular measurement from an operation or event that happens over and over, such as the duration of a request, or number of rows returned by a particular database query.
Histograms allow you to answer questions of these measurements, such as:
- "What were the fastest and slowest requests in this window?"
- "What is the slowest request we've seen out of 90% of the requests measured? 99%?"
Histograms are a convenient way to measure behavior not only at the median, but at the edges of normal operating behavior.
Helper macro for generating a set of labels.
A metric key.
A key/value pair used to further describe a metric.
Used to do a nanosecond conversion.
A value that can build an observer.
A value that can produce a
A value that can be converted to
A value whose metrics can be observed by an
A value that observes metrics.
An allocation-optimized string.