@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
@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.
Pyrefly v1.0 is here
Pyrefly, an open-source Python type checker and language server, reaches v1.0, marking production readiness with significant performance improvements and adoption by major codebases like PyTorch and NumPy.
@QuixiAI: The With Programming Language has hit a major milestone. PCRE2 is in. Regular expressions integrated. Implicit main, on…
The With programming language has reached a major milestone by integrating PCRE2 for regular expressions and implementing implicit main functions. The update supports one-liners and includes a self-hosted compiler with built-in LSP support.
@trq212: Jarred tried rewriting Bun in Rust and it passes 99.8% of the existing test suite we're not being ambitious enough
A developer named Jarred successfully rewrote parts of the Bun runtime in Rust, achieving a 99.8% pass rate on the existing test suite, highlighting a discussion on engineering ambition.