Crates.io | dipstick |
lib.rs | dipstick |
version | 0.9.2 |
source | src |
created_at | 2017-08-18 18:33:48.281554 |
updated_at | 2024-06-21 01:53:01.379913 |
description | Fast, all-purpose metrics library decoupling instrumentation from reporting backends. Like logging frameworks but with counters, timers and gauges. Supports combined outputs (e.g. log + graphite), sampling, aggregation, scheduled push, etc. |
homepage | https://github.com/fralalonde/dipstick |
repository | https://github.com/fralalonde/dipstick |
max_upload_size | |
id | 28042 |
size | 244,679 |
A one-stop shop metrics library for Rust applications with lots of features,
minimal impact on applications and a choice of output to downstream systems.
Dipstick is a toolkit to help all sorts of application collect and send out metrics. As such, it needs a bit of set up to suit one's needs. Skimming through the handbook and many examples should help you get an idea of the possible configurations.
In short, dipstick-enabled apps can:
For convenience, dipstick builds on stable Rust with minimal, feature-gated dependencies. Performance, safety and ergonomy are also prime concerns.
Dipstick's focus is on metrics collection (input) and forwarding (output). Although it will happily aggregate base statistics, for the sake of simplicity and performance Dipstick will not
These are all best done by downstream timeseries visualization and monitoring tools.
Here's a basic aggregating & auto-publish counter metric:
use dipstick::*;
fn main() {
let bucket = AtomicBucket::new();
bucket.drain(Stream::write_to_stdout());
bucket.flush_every(std::time::Duration::from_secs(3));
let counter = bucket.counter("counter_a");
counter.count(8);
}
Persistent apps wanting to declare static metrics will prefer using the metrics!
macro:
use dipstick::*;
metrics! { METRICS = "my_app" => {
pub COUNTER: Counter = "my_counter";
}
}
fn main() {
METRICS.target(Graphite::send_to("localhost:2003").expect("connected").metrics());
COUNTER.count(32);
}
For sample applications see the examples. For documentation see the handbook.
To use Dipstick in your project, add the following line to your Cargo.toml
in the [dependencies]
section:
dipstick = "0.9.0"
Configuring dipstick from a text file is possible using the spirit-dipstick crate.
When building the crate prior to PR or release, just run plain old make
.
This will in turn run cargo
a few times to run tests, benchmarks, lints, etc.
Unfortunately, nightly Rust is still required to run bench
and clippy
.
Dipstick is licensed under the terms of the Apache 2.0 and MIT license.