[−][src]Module rtrtr::metrics
Maintaining and outputting metrics.
Metrics are operational data maintained by components that allow users to understand what their instance of RTRTR is doing. Because they are updated by components and printed by other components in different threads, management is a bit tricky.
Typically, all metrics of a component are kept in a single object that is
shared between that component and everything that could possibly output
metrics. We use atomic data types (such as std::sync::atomic::AtomicU32
)
the keep and allow updating the actual values and keep the value behind an
arc for easy sharing.
When a component is started, it registers its metrics object with a
metrics Collection
it receives via its
Component
.
The object needs to implement the Source
trait by appending all its
data to a Target
. To make that task easier, the Metric
type is
used to define all the properties of an individual metric. Values of this
type can be created as constants.
Structs
Collection | A collection of metrics sources. |
Metric | The properties of a metric. |
Records | Allows adding all values for an individual metric. |
Target | A target for outputting metrics. |
Enums
MetricType | The type of a metric. |
MetricUnit | A unit of measure for a metric. |
OutputFormat | The output format for metrics. |
Traits
Source | A type producing some metrics. |