promql-parser is a Rust crate that lexes and parses PromQL so it matches Prometheus query language behavior for use in other programs.
Overview
PromQL Lexer and Parser is a Rust library aimed at building a lexer and parser for PromQL that conforms with the Prometheus query language. Consumers embed the crate to turn query text into a parsed structure, for example when handling instant vector selector expressions.
Compatibility is targeted at a specific Prometheus release line; later PromQL changes after that point are not guaranteed. Community extensions and language bindings may build on or integrate with the parser.
The crate is licensed under Apache License 2.0. Other projects are listed as known users, and contributions that extend or fix PromQL parsing are accepted after review.
Key features
- PromQL lexing and parsing in Rust
- Prometheus query language conformance goal
- Example parsing for vector selectors
- Declared Prometheus version compatibility
- Community extensions and integrations
- Apache-2.0 licensed codebase
Use cases
- Parsing PromQL inside Rust services
- Building Prometheus-compatible query tools
- Validating PromQL in monitoring products