Substreams
Sink to Prometheus
substreams-sink-prom
is a tool that allows developers to pipe data extracted from a blockchain into a Prometheus time series store.
Gauge - [x] Set - [x] Inc - [x] Dec - [x] Add - [x] Sub - [x] SetToCurrentTime
$ cargo add substreams-sink-prometheus
Cargo.toml
toml
[dependencies]
substreams = "0.5"
substreams-sink-prometheus = "0.1"
src/lib.rs
```rust use substreamssinkprometheus::PrometheusOperations;
fn mapactiontraces(
... some stores ...
) -> Result
let mut prom_ops: PrometheusOperations = Default::default();
// process your data, push to Prometheus metrics
prom_ops.push_set(vec!["some_key"], 123.456);
prom_ops.push_inc(vec!["increment_key"]);
prom_ops.push_dec(vec!["decrement_key"]);
prom_ops.push_add(vec!["add_key"], 2.0);
prom_ops.push_sub(vec!["substract_key"], 100.0);
Ok(prom_ops)
} ```