Metriki is a rust library ported from Dropwizard Metrics.
Like Dropwizard Metrics, Metriki aggregates metrics on client-side and outputs limited amount data.
``rust
// create a timer to track the execution rate and latency of this function
// to use macros you will need to turn on
macros` feature of metriki_core
fn your_function() { // a function metered by a timer for its rate and latency }
use metrikicore::global::globalregistry; use metrikiinfluxdbreporter::InfluxDbReporterBuilder;
// by default, the timer is registered in this globalregistry() let registry = globalregistry();
// start a reporter to send data into influxdb InfluxDbReporterBuilder::default() .url("localhost:8086") .username(String::from("influxdbuser")) .password(String::from("yourpassword")) .database("db") .registry(registry.clone()) .build() .unwrap() .start();
```
MetricsRegistry
(doc)
(crate).An entrypoint and holder of all metrics.
A trait to be implemented so that dynamic metrics can be added into registry. Metrics from the set are pulled into registry everytime when reporters and exporters pulling values from the registry.
A component to report metric data periodically. Typically used for data sinks which has a push-model.
A component to expose metric data to external queriers. Typically for pull based data sinks.
MIT/Apache-2.0