prometheus-http-query
A rust library that provides an interface to query a Prometheus server and offers the tools to gradually build queries before actually sending them by leveraging Rust's type system. Several kinds of metadata queries are also supported (e.g. retrieving time series, rules, alerts etc.). Check docs.rs for detailed information.
Example
use ;
use ;
use rate;
use TryInto;
async
Compatibility
The table below depicts the compatibility of this library with various versions of the Prometheus server.
Features | v2.34 | v2.33 | v2.32 | v2.31 | v2.30 | v2.29 |
---|---|---|---|---|---|---|
Instant queries | yes | yes | yes | yes | yes | yes |
Range queries | yes | yes | yes | yes | yes | yes |
Time series metadata | yes | yes | yes | yes | yes | yes |
Label name metadata | yes | yes | yes | yes | yes | yes |
Label value metadata | yes | yes | yes | yes | yes | yes |
Targets | yes | yes | yes | yes | yes | yes |
Rules | yes | yes | yes | yes | yes | yes |
Alerts | yes | yes | yes | yes | yes | yes |
Alertmanagers | yes | yes | yes | yes | yes | yes |
Runtime flags | yes | yes | yes | yes | yes | yes |
Metric metadata | yes | yes | yes | yes | yes | yes |
Target metadata | yes | yes | yes | yes | yes | no |
Trigonometric functions | yes | yes | yes | yes | no | no |
Server versions below v2.29 are untested.
Tests
In order to run all tests a Prometheus server must be running at http://localhost:9090
. No special configuration is required at this point.
Run: RUSTFLAGS="--cfg unsound_local_offset" cargo test
Contributing
Please do not hesitate to file issues in order to report bugs, ask questions or make suggestions. You are also welcome to tackle open issues if there are any.
If you are looking to submit code, please make sure that the tests pass successfully.