mirror of https://github.com/fralalonde/dipstick
37 lines
1.0 KiB
Markdown
Executable File
37 lines
1.0 KiB
Markdown
Executable File
# The dipstick handbook
|
|
|
|
This handbook's purpose is to get you started instrumenting your apps with dipstick
|
|
and give an idea of what's possible.
|
|
|
|
For more details, consult the [docs](https://docs.rs/dipstick/).
|
|
|
|
## Overview
|
|
|
|
To achieve it's flexibility, Dipstick decouples the metrics _inputs_ from the metric _outputs_.
|
|
For example, incrementing a counter in the application may not result in immediate output to a file or to the network.
|
|
Conversely, it is also possible that an app will output metrics data even though no values were recorded.
|
|
While this makes things generally simpler, it requires the programmer to decide beforehand how metrics will be handled.
|
|
|
|
|
|
## Static metrics
|
|
|
|
For speed and easier maintenance, metrics are usually defined statically:
|
|
|
|
```rust,skt-plain
|
|
#[macro_use]
|
|
extern crate dipstick;
|
|
|
|
use dipstick::*;
|
|
|
|
metrics!("my_app" => {
|
|
COUNTER_A: Counter = "counter_a";
|
|
});
|
|
|
|
fn main() {
|
|
route_aggregate_metrics(to_stdout());
|
|
COUNTER_A.count(11);
|
|
}
|
|
```
|
|
|
|
(Metric definition macros are just `lazy_static!` wrappers.)
|