PromQL Parser is a Rust crate that lexes and parses PromQL expressions aligned with Prometheus query syntax. It targets embedders building tooling around Prometheus metrics queries.
Overview
PromQL Parser provides a PromQL lexer and parser intended to handle instant vector selectors and other expressions that match Prometheus query language rules. The crate is meant to be imported into Rust projects that need to read or analyze PromQL without calling Prometheus itself.
You can parse expressions from Rust code or run the bundled examples. The maintainers track compatibility with a specific Prometheus release and note that PromQL changes after that point are not guaranteed.
Community projects extend the parser or connect it to other systems through language bindings and integrations listed in the documentation. Known downstream uses are documented for teams that want reference implementations.
The project is licensed under Apache 2.0 and accepts contributions that add or fix PromQL parsing behavior.
Key features
- PromQL lexer and parser
- Instant vector selector parsing
- Prometheus PromQL compliance target
- Rust crate for embedding
- Example programs in the repo
- Community extensions and bindings
- Documented known downstream uses
Use cases
- Embed PromQL parsing in Rust services
- Validate PromQL in monitoring tools
- Build query analysis or linting tools
- Experiment with PromQL syntax handling