hawkw / tinymetrics

a minimal, allocation-free Prometheus/OpenMetrics metrics implementation for `no-std` and embedded Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tinymetrics

a minimal, allocation-free Prometheus/OpenMetrics metrics implementation for no-std and embedded projects.

crates.io Documentation MIT licensed Test Status Sponsor @hawkw on GitHub Sponsors

why should you use it?

you may want to use this crate if:

  1. you want the Prometheus/OpenMetrics text exposition format. other metrics systems are not supported. if you want a generic way to record metrics that can be emitted in a number of different formats, the i highly recommend the metrics crate and its ecosystem, which provide a generic facade implementation that can be used with multiple metrics systems. however, these libraries may be less suitable for use in embedded systems — read on for why.
  2. you can't (or don't want to) allocate memory dynamically. this crate is intended to allow all metrics storage to be declared in statics, for use in embedded systems and other no-std use-cases. in order to support completely static usage, this crate has some additional limitations over other Prometheus/OpenMetrics implementations. in particular:
  3. the cardinality of metrics labels is known ahead of time. because tinymetrics stores metrics in static, fixed-size arrays, the maximum size of the label set of each metric must be declared at compile time. this is an inherent limitation to using static storage, but it may be acceptable if you only want to expose a small number of metrics with known labels.
  4. you only need counter and gauge metrics. i haven't implemented the summary and histogram metric types yet, although it would be nice to eventually.

About

a minimal, allocation-free Prometheus/OpenMetrics metrics implementation for `no-std` and embedded Rust.

License:MIT License


Languages

Language:Rust 98.9%Language:Nix 1.1%Language:Shell 0.0%