5 releases
Uses old Rust 2015
0.3.2 | Sep 15, 2017 |
---|---|
0.3.1 | Aug 17, 2017 |
0.3.0 | Aug 1, 2017 |
0.2.1 | May 24, 2017 |
0.2.0 | May 24, 2017 |
#705 in Machine learning
Used in 3 crates
35KB
789 lines
cantal-rs
Status: | Beta |
---|---|
Documentation: | http://docs.rs/libcantal/ |
Cantal is an expermimental heartbeating, monitoring and statistics solution.
This is a rust library for sending statistics data to cantal.
License
Licensed under either of
- Apache License, Version 2.0, (./LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (./LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
lib.rs
:
A library that exposes metrics sent to cantal
See mmap protocol for more information about the protocol.
Example
use libcantal::{Counter, Integer, Value, start, print};
// Declare metrics as static variables, so you can use it in a module
// freely, i.e. increment/decrement at any time
lazy_static! {
static ref COUNTER: Counter = Counter::new();
static ref INTEGER: Integer = Integer::new();
}
// Put metrics in a collection
let metrics = [
(json!({"metric": "counter"}), &*COUNTER as &Value),
(json!({"metric": "integer"}), &*INTEGER as &Value),
];
// The collection guard. When it's alive, all the metrics are exposed
let _coll = start(&metrics[..]).expect("cantal works");
// ...
// Somewhere later use the metrics:
COUNTER.incr(1);
INTEGER.set((COUNTER.get() / 7) as i64);
// And at any time you can print the collection for debugging
print(&metrics[..], stdout()).ok();
#
Dependencies
~0.6–1MB
~23K SLoC