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.
See the calls and the query
LiveMetriCraft · 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().
Explore the result
Run a query to evaluate your samples.| Labels | Value |
|---|
No matching samples. Try removing a label filter or threshold, or choose a metric from the dataset.
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.