@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.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.
@jerryjliu0: LiteParse, our open-source/Rust-based doc parser, runs so quickly that Claude Fable 5 doesn't think it's real It is the…
LiteParse is a fast, open-source document parser written in Rust that provides high-quality spatial text extraction with bounding boxes, supporting multiple languages and platforms for AI document workloads.
@Greptime: On Prometheus remote write, the bottleneck wasn't network or memtable — it was the Region Worker holding &mut while dec…
GreptimeDB v1.0 introduces Pending Rows Batcher, a three-stage pipeline that moves CPU-intensive work off the Datanode's critical section, improving Prometheus remote write throughput from 1.20M to 2.17M points/sec and reducing Datanode CPU usage by 20%.
@thomasp85: I am excited beyond description to lift the veil on what we have been working on in 2026: Please meet ggsql! A new exte…
Posit has announced the alpha release of ggsql, a new SQL language extension that brings grammar-of-graphics-style data visualization to SQL, compatible with Quarto, Jupyter notebooks, Positron, and VS Code. It allows users to create layered, structured visualizations using familiar SQL syntax inspired by ggplot2.
@Greptime: GreptimeDB's flat-format queries can now prefilter on any column — tags, fields, timestamps — not just primary keys. Wh…
GreptimeDB's flat-format queries now support prefiltering on any column (tags, fields, timestamps), not just primary keys, delivering up to 4.5x faster performance. Additionally, the mito2 storage engine removed its legacy scan path, cleaning up about 1,800 lines of code.