Expand description
This crate serves to provide metrics bindings to be used throughout the codebase. For binaries that wish to use metrics, the intention is that an independent metrics process will run (main loop in the controller mod), and receive requests via a tube from another process.
At head, metrics requests are ignored. However, a branching codebase can choose to implement their own handler which processes and uploads metrics requests as it sees fit, by setting the appropriate RequestHandler.
Modules§
- controller 🔒
- Encapsulate the main runtime loop of a metrics process.
- local_
stats 🔒 - This module contains stats that useful on the system. Local stats may not a be in state to be consumed by metris reporter or it might not be efficient to report metrics in the current state to the backend.
- sys
Structs§
- Bytes
Latency Stats - A helper struct to collect metrics for byte transferred and latency.
- Call
OnDrop - A helper struct that makes it easy to get time spent in a scope.
- Detailed
Histogram - A histogram that optionally holds details about each added value. These values let us compute standard deviation and median.
- Metrics
Client Destructor - Ensures any cleanup necessary is performed on drop. Can be used to ensure cleanup is done regardless of how the caller exits. Should be idempotent.
- Metrics
Controller - Runs the metrics controller.
- Metrics
Request Handler - Periodic
Logger - A logging struct meant for use in tracking and periodically logging a single metric. The metric is aggregated over the designated time period. Intended for use with high-frequency metrics.
- Simple
Stat - Light weight stat struct that helps you get aggregate stats like min, max, average, count and sum. Median and standard deviation are intentionally excluded to keep the structure light weight.
Enums§
Constants§
Traits§
Functions§
- collect_
scoped_ byte_ latency_ stat - get_
destructor - initialize
- This interface exists to be used and re-implemented by downstream forks. Updates shouldn’t be done without ensuring they won’t cause breakages in dependent codebases.
- is_
initialized - log_
descriptor - Logs a counter with the given descriptor as aux. data. A descriptor is generally an enum value or error code.
- log_
event - Logs a counter with no aux. data.
- log_
event_ with_ details - Logs a counter with additional data.
- log_
high_ frequency_ descriptor_ event - Logs a high frequency counter with the supplied aux. data and value.
- log_
histogram_ metric - Logs a histogram metric with the supplied value. Note: step is a value to be added to the distribution.
- log_
metric - Logs a real valued metric (e.g. a data transfer rate, a latency value, etc) with the supplied value.
- log_
metric_ with_ details - Logs a real valued metric (e.g. a data transfer rate, a latency value, etc) with the supplied value & product specific extra details.
- merge_
session_ invariants - push_
descriptors - set_
auth_ token - set_
graphics_ api - set_
package_ name - timed_
scope
Type Aliases§
- Histogram
- A helper type alias for Histogram that doesn’t store details. The structure can be used in production without much memory penalty.
- Request
Handler