Under the hood

Compared with Grafana

Compare construction styles, client capabilities and responsibility boundaries.

This comparison uses Grafana promql-builder revision 4febee560d00c40d20b36093ff5e9d5879b4c738. This compares SDKs, not Grafana dashboards or a deployment requirement.

ConcernGrafana promql-builderMetriCraft
CompositionNested function calls plus modifier methodsFluent immutable expressions
Outputbuild() returns a model; str(query) renders textbuild(mode=...) returns text
Reusing expressionsMutable builders in the inspected revisionRust structural sharing; transformations return new values
LanguagesPromQLOne common core for PromQL and MetricsQL
ExecutionQuery constructionSeparate sync/async Prometheus/VictoriaMetrics client
Dynamic configurationApplication maps selections to callsSame; application owns persistence and policy

For example, Grafana uses sum(rate(vector(...).range("5m"))).by(["job"]); MetriCraft uses Q.from_metric(...).rate("5m").sum().by("job"). Neither style alone makes dynamic configuration possible or safe: the concrete literal handling and application mapping matter.

Grafana can be the simpler fit for an application that only needs its supported PromQL construction surface. MetriCraft aims to combine immutable construction, explicit dialect checks and an independent client. The preferred API still depends on the application: fluent or nested composition, required dialects, ownership guarantees and transport.

When combining Grafana with the MetriCraft client, pass str(grafana_query) explicitly because the libraries give .build() different meanings.

Explore the docs

Find your next step

Search guides, examples and the Python API.