Crate metrics

Source
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§

BytesLatencyStats
A helper struct to collect metrics for byte transferred and latency.
CallOnDrop
A helper struct that makes it easy to get time spent in a scope.
DetailedHistogram
A histogram that optionally holds details about each added value. These values let us compute standard deviation and median.
MetricsClientDestructor
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.
MetricsController
Runs the metrics controller.
MetricsRequestHandler
PeriodicLogger
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.
SimpleStat
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§

MetricEventType

Constants§

METRICS_UPLOAD_INTERVAL

Traits§

GetStatsForOp
Limits
NumberType
SummaryStats

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.
RequestHandler