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

Overview

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.
You might also like...
A Prometheus Aggregation Gateway for FAAS applications

Gravel Gateway Gravel Gateway is a Prometheus Push Gateway for FAAS applications. In particular it allows aggregation to be controlled by the incoming

A Prometheus exporter for WireGuard

wireguard_exporter An asynchronous Prometheus exporter for wireguard wireguard_exporter runs wg show [..] and scrapes the output to build Prometheus m

Export statistics of Mosquitto MQTT broker (topic: $SYS) to Prometheus

Preface The Mosquitto MQTT broker provides a number of statistics on the special $SYS/# topic (see mosquitto(8)). Build requirements As a Rust program

Prometheus instrumentation service for the NGINX RTMP module.

nginx-rtmp-exporter Prometheus instrumentation service for the NGINX RTMP module. Usage nginx-rtmp-exporter [OPTIONS] --scrape-url SCRAPE_URL O

A metrics collection application for Linux machines. Created for MSCS 710 Project at Marist College.

Linux-Metrics-Collector A metrics collection application for Linux machines. Created for MSCS 710 Project at Marist College. Development Environment S

🚀 10x easier, 🚀 10x cheaper, 🚀 high performance,  🚀 petabyte scale - Elasticsearch/Splunk/Datadog alternative for 🚀 (logs, metrics, traces).
🚀 10x easier, 🚀 10x cheaper, 🚀 high performance, 🚀 petabyte scale - Elasticsearch/Splunk/Datadog alternative for 🚀 (logs, metrics, traces).

🚀 10x easier, 🚀 10x cheaper, 🚀 petabyte scale - Elasticsearch/Splunk/Datadog alternative for 🚀 (logs, metrics, traces). ZincObserve ZincObserve is

Druid Exporter plays a fundamental role as a receiver of metrics events coming from Druid clusters, adopting the HTTP format as a means of communication
Druid Exporter plays a fundamental role as a receiver of metrics events coming from Druid clusters, adopting the HTTP format as a means of communication

Druid Exporter plays a fundamental role as a receiver of metrics events coming from Druid clusters, adopting the HTTP format as a means of communication. In addition to this capability, its primary function is to export these metrics to Prometheus, thus allowing the creation of meaningful graphs and visualizations.

Druid Exporter plays a fundamental role as a receiver of metrics events coming from Druid clusters, adopting the HTTP format as a means of communication.
Druid Exporter plays a fundamental role as a receiver of metrics events coming from Druid clusters, adopting the HTTP format as a means of communication.

Druid Exporter plays a fundamental role as a receiver of metrics events coming from Druid clusters, adopting the HTTP format as a means of communication. In addition to this capability, its primary function is to export these metrics to Prometheus, thus allowing the creation of meaningful graphs and visualizations.

Minimal DNS server built in Rust with rule system and logging.

MinDNS MinDNS is a minimal DNS server written in Rust. It is intended to be used as a firewall, black-hole or proxy DNS server. ⚡ Features Fully async

Comments
  • add `_total`s to counter metrics

    add `_total`s to counter metrics

    per OpenMetrics, the counter metric type MUST always include a _total metric point. We don't currently implement this, as Prometheus doesn't require it, but we ought to in order to be compliant.

    This will probably require re-thinking the Metric trait, so that its formatting function is called with all the metrics in a family (in order to calculate a total).

    enhancement 
    opened by hawkw 0
  • add `_created` timestamps to metrics

    add `_created` timestamps to metrics

    The OpenMetrics standard says that certain metric types SHOULD include _created timestamps. In tinymetrics, timestamps are optional and feature-flagged, because some embedded platforms might not have an RTC.

    Fortunately, this is a SHOULD in the spec (and not a MUST), but when timestamps are enabled, we should emit a _created timestamp for every metric family.

    Determining a _created time is maybe a little tricky for us because we allow constructing metrics in const fn, where we can't generate timestamps. It should probably be determined the first time the metric records a value.

    enhancement openmetrics-compliance 
    opened by hawkw 0
  • add summary metrics

    add summary metrics

    ~~it might be desirable to have some implementation of a Prometheus Gauge metric that's actually the current rolling average of measurements over some time window.

    this would be intended for use cases where, for example, you read data from a sensor every second, but Prometheus only scrapes the device's metrics every ten seconds. in this case, the scrape is going to see just the data from the most recent read of the sensor, which may not accurately reflect the state of the world --- data from the other 9 reads of the sensor in that time window is completely discarded.

    in this case, it might be desirable to expose a metric value that is actually an aggregate of multiple reads, so that the value seen by prometheus is less susceptible to random spikiness in the measurement?~~

    EDIT: lol, this is basically how a prometheus Summary metric is supposed to be used. we should just add support for that...

    enhancement 
    opened by hawkw 0
Owner
Eliza Weisman
systems witch
Eliza Weisman
An asynchronous dumb exporter proxy for prometheus. This aggregates all the metrics and exposes as a single scrape endpoint.

A dumb light weight asynchronous exporter proxy This is a dumb lightweight asynchronous exporter proxy that will help to expose multiple application m

Dark streams 3 Dec 4, 2022
Easily add metrics to your system -- and actually understand them using automatically customized Prometheus queries

Autometrics ?? ✨ Autometrics is a macro that makes it trivial to add useful metrics to any function in your codebase. Easily understand and debug your

Fiberplane 341 Feb 6, 2023
Easily add metrics to your system -- and actually understand them using automatically customized Prometheus queries

A Rust macro that makes it easy to understand the error rate, response time, and production usage of any function in your code. Jump from your IDE to

Autometrics 462 Mar 6, 2023
Parse, edit and merge Prometheus metrics exposition format

promerge Promerge provides minimalistic and easy to use API to parse and manipulate Prometheus metrics. A simple usecase could be collecting metrics f

Mike Taghavi 4 Aug 12, 2023
`prometheus` backend for `metrics` crate

metrics + prometheus = ❤️ API Docs | Changelog prometheus backend for metrics crate. Motivation Rust has at least two ecosystems regarding metrics col

Instrumentisto Team 2 Dec 17, 2022
🔍 Fully-featured metrics collection agent for First Tech Challenge competitions. Supports Prometheus.

Scout Scout is a fully-featured free and open source metrics collector for FTC competitions. The project is licensed under the GNU LGPLv3 license. Fea

hivemind 3 Oct 24, 2023
Allocation-free UnionFind library for bare metal environments

Allocation-free UnionFind library for bare metal environments The library provides the following algorithms that is used with UnionFind. QuickFind Qui

Budi Syahiddin 7 Dec 10, 2022
A high performance/low-overhead OpenMetrics library for Rust

* * * EXPERIMENTAL * * * discreet-metrics A high-performance/low-overhead metrics library aiming to conform with OpenMetrics and to satisfy the follow

null 2 Sep 14, 2022
An asynchronous Prometheus exporter for iptables

iptables_exporter An asynchronous Prometheus exporter for iptables iptables_exporter runs iptables-save --counter and scrapes the output to build Prom

Kevin K. 21 Dec 29, 2022
A Prometheus Aggregation Gateway for FAAS applications

Gravel Gateway Gravel Gateway is a Prometheus Push Gateway for FAAS applications. In particular it allows aggregation to be controlled by the incoming

Colin Douch 85 Nov 23, 2022