#linux #monitoring #meter

libcantal

A rust library to submit statistics to cantal monitoring server

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

#7 in #std-io-stdout

Download history 21/week @ 2023-11-02 40/week @ 2023-11-09 12/week @ 2023-11-16 20/week @ 2023-11-23 39/week @ 2023-11-30 12/week @ 2023-12-07 26/week @ 2023-12-14 25/week @ 2023-12-21 14/week @ 2023-12-28 15/week @ 2024-01-04 17/week @ 2024-01-11 17/week @ 2024-01-18 21/week @ 2024-01-25 13/week @ 2024-02-01 18/week @ 2024-02-08 64/week @ 2024-02-15

118 downloads per month
Used in 3 crates

MIT/Apache

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

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