metric2fs-rs/README.md
2021-03-24 23:30:02 +01:00

1.1 KiB

metric2fs-rs

A simple graphite metric metadata storage.

This is a POC.

Features

Handle most, but not all, graphite paths style & wildcards listed on https://graphite.readthedocs.io/en/latest/render_api.html#paths-and-wildcards

  • Asterisk globbing (eg: test*);
  • List & ranges (eg: [a-z0-9] or [abc]);
  • Value lists (eg: {abc,def}).

However, the double star globbing is not supported (eg: **).

Build & run

cargo build
RUST_LOG=debug cargo run

API

Write a metric

Send a POST request to /metric with metric(s) in the body

curl -sq -d testaroo.a.a.a http://localhost:3000/metric

Retrieve metrics

Send a GET request to /metric with q= parameter as a globbing expression

curl "http://localhost:3000/metric?q=te*ar*.\{a\}.\{b,c\}.\[bcd\]"

Testing

for metric in testaroo.{a,b,c}.{a,b,c}.{a,b,c,d,e,f}; do curl -sq -d $metric http://localhost:3000/metric ; done
curl "http://localhost:3000/metric?q=te*ar*.\{a\}.\{b,c\}.\[b-e\]"
testaroo.a.b.b
testaroo.a.b.c
testaroo.a.b.d
testaroo.a.b.e
testaroo.a.c.b
testaroo.a.c.c
testaroo.a.c.d
testaroo.a.c.e