rust-metrics

Linux Status Kanban

This is a work in progress. Metrics are things you can use to safely & directly store metrics with little overhead. Metrics can be attached to a registry and that registry can be collected across a system. This registry also provides reporting services. Current reporters include:

Contact us on #rust-metrics on Mozilla IRC.

```rust ... let m = StdMeter::new(); m.mark(100);

    let c = StdCounter::new();
    c.inc();

    let g = StdGauge::new();
    g.set(2);

    let mut h = Histogram::configure()
        .max_value(100)
        .precision(1)
        .build()
        .unwrap();

    h.increment_by(1, 1).unwrap();

    let mut reporter = CarbonReporter::new("test", "localhost:0".to_string(), "asd.asdf", 5);
    reporter.add("meter1", Metric::Meter(m.clone()));
    reporter.add("counter1", Metric::Counter(c.clone()));
    reporter.add("gauge1", Metric::Gauge(g.clone()));
// Add a histogram with labels even though they ignored in this reporter
    reporter.addL("histogram", Metric::Histogram(h), Some(HashMap::new()));
    while ... {    c.inc()}
    reporter.stop();

```

Usage

Add this to your Cargo.toml:

toml "metrics" = "*"

And add this to your crate root:

rust extern crate metrics

Provided scripts in bin/

Many of these will only run if prometheus support is enabled

TBD

Local Development

cargo build # to build the code cargo test # to run the tests

To use prometheus you will might need to read these directions cargo build --features "prometheus" # To build code with prometheus support

License

rust-metrics is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE, LICENSE-MIT for details.

Copyright (c) 2016 Alex Newman.