@Greptime: We just shipped promql-parser v0.9.0, a PromQL Parser in Rust. Highlights: • declarative refactor for functions • fill*…
Summary
Greptime released version 0.9.0 of promql-parser, a Rust-based PromQL parser featuring declarative function refactoring and support for limit functions.
View Cached Full Text
Cached at: 05/12/26, 08:48 AM
We just shipped promql-parser v0.9.0, a PromQL Parser in Rust. Highlights: • declarative refactor for functions • fill*() binop modifiers • mutable visitor trait for AST traversal • limitk and limit_ratio support Details: https://github.com/GreptimeTeam/promql-parser/releases/tag/v0.9.0… #PromQL #Rust
GreptimeTeam/promql-parser
Source: https://github.com/GreptimeTeam/promql-parser
PromQL Lexer and Parser
The goal of this project is to build a PromQL lexer and parser capable of parsing PromQL that conforms with Prometheus Query.
Example
To parse a simple instant vector selector expression:
use promql_parser::parser;
let promql = r#"
http_requests_total{
environment=~"staging|testing|development",
method!="GET"
} offset 5m
"#;
match parser::parse(promql) {
Ok(expr) => {
println!("Prettify:\n{}\n", expr.prettify());
println!("AST:\n{expr:?}");
}
Err(info) => println!("Err: {info:?}"),
}
or you can directly run examples under this repo:
cargo run --example parser
This outputs:
Prettify:
http_requests_total{environment=~"staging|testing|development",method!="GET"} offset 5m
AST:
VectorSelector(VectorSelector { name: Some("http_requests_total"), matchers: Matchers { matchers: [Matcher { op: Re(staging|testing|development), name: "environment", value: "staging|testing|development" }, Matcher { op: NotEqual, name: "method", value: "GET" }] }, offset: Some(Pos(300s)), at: None })
PromQL compliance
This crate declares compatible with prometheus v3.8, which is released at 2025-11-28. Any revision on PromQL after this commit is not guaranteed.
Community Extensions
There are a number of community projects that extend promql-parser or provide integrations with other systems.
Language Bindings
- py-promql-parser Python.
- lua-promql-parser Lua.
Known Uses
Here are some of the projects known to use promql-parser:
- GreptimeDB Open Source & Cloud Native Distributed Time Series Database
- OpenObserve High performance, petabyte scale Elasticsearch/Splunk/Datadog alternative for (logs, metrics, traces, RUM, Error tracking, Session replay)
If your project is using promql-parser, feel free to make a PR to add it to this list.
Contributing
Contributions are highly encouraged!
Pull requests that add support for or fix a bug in a feature in the PromQL will likely be accepted after review.
Licensing
All code in this repository is licensed under the Apache License 2.0.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.
Similar Articles
@Greptime: GreptimeDB v1.3.0-alpha.1 — PromQL native histograms, wide: selection, rate()/delta(), vector operators, aggregations, …
GreptimeDB v1.3.0-alpha.1 introduces PromQL native histograms and vector operators for enhanced observability, with added support for OTLP traces and RISC-V 64 builds.
Just One Function, 10x Faster? Reading a Rust Performance PR
A deep-dive blog post walks through a Rust performance PR in GreptimeDB that makes Prometheus read conversion 10x faster, with benchmark reproduction and code analysis.
@Greptime: GreptimeDB v1.1.0 is out PromQL rate/increase up to 97% faster, 20–40% lower query time overall Up to 4.5x faster on TS…
GreptimeDB v1.1.0 is released, offering up to 97% faster PromQL queries, 20-40% lower overall query times, and up to 4.5x improvement on TSBS scan-heavy queries, along with online repartitioning for existing tables.
@Greptime: GreptimeDB implements PromQL natively in its planner rather than translating it to SQL.
GreptimeDB has implemented PromQL natively in its query planner, allowing direct execution and analysis with tools like EXPLAIN ANALYZE without translating it to SQL.
@Greptime: GreptimeDB v1.2.0-beta.1 is out. 205 changes, 259 commits, 22 contributors. The headline items: JSON2 as a data type, P…
GreptimeDB v1.2.0-beta.1 is released with major features including JSON2 as a structured column type, Prometheus Remote Write v2 with native histograms, dictionary-encoded series keys for faster queries, and additional hardening/breaking changes.