Examples

Query playground

Choose monitoring filters, see live Python and PromQL, and query editable sample data.

Build a monitoring query by choosing conditions. The Python calls and generated PromQL update together; run the query against editable local samples to see the result. Start with the counter preset, then try grouping without instance, adding a threshold, or switching to queue-depth data. Try regex filters selects instance=~"api-.*" and environment!~"staging|development". Use Arithmetic and Value filter to see Python operators such as expression * 100 and expression > 5 in action.

For the production integration pattern, see accept application inputs.

Local workspaceRust builder · browser sample data
01

Configure a query

Label filters

Use=~to match a regex or!~to exclude it. Patterns match the whole label: tryapi-.*oninstance.

Python operators build a new expression. For example,expression * 100orexpression > 5. Python**becomes PromQL^.

Filters and grouping compose immutable expressions. Your samples stay in this browser.

02

See the calls and the query

Live

MetriCraft · Python

Loading…

Generated · PromQL

Loading…

The browser uses the same Rust core as Python. In your application, persistqueryanywhere, then pass it toclient.query()orclient.query_range().

03

Explore the result

Run a query to evaluate your samples.
Chart: 0 → evaluation time, 30-second steps
Instant-vector result at the selected time
LabelsValue

Your sample data

Edit labels and values, add your own metrics, or start from a preset. Samples are[seconds, value]relative to time zero. Up to 64 series, 241 samples per series, and 0–3600 seconds. Empty label values count as absent.

Regex and Python operators

Regex patterns match the entire label value:apimatches onlyapi, whileapi.*also matchesapi-1. Missing labels are matched as empty strings. Lookarounds and backreferences are rejected. The demo usesRE2JS, withPrometheus matching semanticschecked against the pinned backend.

Operators construct new expressions; they do not compare Python objects or modify the original query. Use explicit parentheses. Pythonand,or, chained comparisons andif expressioncannot express query logic. For vector sets, use parenthesized&/|or.and_() / .or_(). SeeOperators & matchingfor every supported overload, including vector-to-vector examples.

Reverse%and**are not overloaded by the SDK, so those choices keep the scalar on the right. Division by zero and other non-finite results appear in the result table and are omitted from the chart.

What this simulation evaluates

This page evaluates the structured selections above, not arbitrary PromQL text. It supports exact and RE2 regex label matchers, finite float samples, a 5-minute instant lookback with an excluded left boundary (Prometheus 3.15), left-open/right-closed ranges, the listed rollups, counter reset handling and rate extrapolation, aggregations, grouping, scalar arithmetic, unary signs and filtering comparisons. Rate/increase model Prometheus behavior. Histograms, stale markers, vector joins, MetricsQL-specific evaluation and server storage behavior are outside this simulator. Use a real backend to validate production results. Sample values are limited to ±1e12 and timestamps to millisecond precision to bound this demo.

The Python snippet can run with an installed MetriCraft native build. The simulator belongs to these docs; it is not a new SDK query engine.

Explore the docs

Find your next step

Search guides, examples and the Python API.