Go to file
Francis Lalonde a10feef248 Merge branch 'explicit-locking' of github.com:fralalonde/dipstick into explicit-locking 2019-11-23 17:16:53 -05:00
assets Skeptic fix 2018-10-18 10:22:38 -04:00
examples First v0.8.0, explicit locking 2019-11-23 17:16:08 -05:00
src First v0.8.0, explicit locking 2019-11-23 17:16:08 -05:00
tests Applied format 2019-04-09 07:55:15 -04:00
.gitignore superdocc 2018-11-12 08:41:00 -05:00
.travis.yml (cargo-release) start next development iteration -1.6.1-alpha.0 2018-01-10 09:21:04 -05:00
CHANGES.md Prepare v0.7.11, bump parking_lot to v0.9 2019-08-30 06:40:49 -04:00
CODE_OF_CONDUCT.md for great justice 2018-01-09 16:43:32 -05:00
CONTRIBUTING.md
Cargo.toml explicit-locking 2019-11-19 19:23:53 -05:00
HANDBOOK.md Merge branch 'master' of github.com:fralalonde/dipstick 2019-06-22 08:53:32 -04:00
LICENSE-APACHE Revise some doc and license 2017-08-31 01:02:12 -04:00
LICENSE-MIT Revise some doc and license 2017-08-31 01:02:12 -04:00
Makefile Use clippy stable 2019-07-11 11:55:28 -04:00
README.md Prepare v0.7.11, bump parking_lot to v0.9 2019-08-30 06:40:49 -04:00
build.rs Applied format 2019-04-09 07:55:15 -04:00

README.md

crates.io docs.rs Build Status

dipstick a dipstick picture

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.

Features

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:

  • Send metrics to console, log, statsd, graphite or prometheus (one or many)
  • Locally aggregate the count, sum, mean, min, max and rate of metric values
  • Publish aggregated metrics, on schedule or programmatically
  • Customize output statistics and formatting
  • Define global or scoped (e.g. per request) metrics
  • Statistically sample metrics (statsd)
  • Choose between sync or async operation
  • Choose between buffered or immediate output
  • Switch between metric backends at runtime

For convenience, dipstick builds on stable Rust with minimal, feature-gated dependencies. Performance, safety and ergonomy are also prime concerns.

Non-goals

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

  • plot graphs
  • send alerts
  • track histograms

These are all best done by downstream timeseries visualization and monitoring tools.

Show me the code!

Here's a basic aggregating & auto-publish counter metric:

extern crate dipstick;
use dipstick::*;

fn main() {
    let bucket = AtomicBucket::new();
    bucket.drain(Stream::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:

extern crate dipstick;
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.7.11"

External features

Configuring dipstick from a text file is possible using the spirit-dipstick crate.

Building

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.

TODO / Missing / Weak points

  • Prometheus support is still primitive (read untested). Only the push gateway approach is supported for now.
  • No backend for "pull" metrics yet. Should at least provide tiny-http listener capability.
  • No quick integration feature with common frameworks (Actix, etc.) is provided yet.
  • Thread Local buckets could be nice.
  • "Rolling" aggregators would be nice for pull metrics. Current bucket impl resets after flush.

License

Dipstick is licensed under the terms of the Apache 2.0 and MIT license.