metrics-logger
metrics-logger is a crate for logging metrics. It aids development and testing by allowing developers to view metrics without setting up a network endpoint.
This is achieved by implementing the Recorder trait from the metrics crate.
Notes
- This crate exports the
metricscrate to avoid version mismatches. The version ofmetrics-loggermatches that of themetricscrate. MetricsLoggerrequires callbacks to avoid issues with different versions of thelogortracingcrates in the user's project.
Example
use ;
// MetricsLogger implements the Recorder trait
let recorder = new;
// This tells the metrics crate to use your Recorder implementation.
set_global_recorder.unwrap;
Modules
cmd: Handles commands for updating metrics.handles: Implements metric handles (e.g., counters, gauges, histograms).state: Manages metric state and generates logs.
Dependencies
This library re-exports the metrics crate to ensure compatibility with the same version used internally.