The MetriCraft field guide
Queries,
thoughtfully
composed.
Build PromQL and MetricsQL with immutable expressions. Save the string. Query your backend. Keep the choices yours.
Choose filters. See the Python and PromQL. Try sample data.
from metricraft import QueryBuilder as Q
requests = (
Q.from_metric("http_requests_total")
.where_eq("job", "api")
)
query = requests.rate("5m").sum().by("job")
text = query.build("promql")sum by (job) (rate(http_requests_total{job="api"}[5m]))Derive a new expression.
The original stays yours to reuse.
From a user's choice
to a useful answer.
Queries change with your application.
Your infrastructure doesn't need to.
Build with structure.
Turn filters, functions and grouping into expressions. Values are escaped; the chosen dialect is checked.
query.build("promql")02 ↗Store it your way.
Keep ordinary query text in YAML, XML or your database. Persistence stays with your application.
str → your storage → str03 ↗Ask your backend.
Send saved text to Prometheus or VictoriaMetrics with the same synchronous or asynchronous client.
client.query(saved_text)Built to be
understood.
Start with a working example.
Follow the details as far as you need.
A query is a good place to start.
Native wheels are available on PyPI. Install MetriCraft, try an example, and help shape what comes next.