Prometheus: Query
prometheus_queryEvaluate a PromQL expression at a single instant to get current values or windowed totals/averages, so agents can answer metric questions without fetching raw series.
Instructions
Evaluate a PromQL expression at one instant — the current value of something, or a total/average over a window written into the expression (increase(x[24h]), avg_over_time(x[1h])). This is the right tool for almost every question; use prometheus_query_range only when the shape over time matters. Labels shared by every series are returned once as common_labels. Upstream order is kept, so sort_desc() and topk() rank the result; past limit the rest is cut and truncated is set.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| time | No | Evaluation time: now, now-1h, -30m, an RFC3339 timestamp (2026-01-31T12:00:00Z) or unix seconds. Defaults to now. | |
| limit | No | Maximum series to return (1-2000). Defaults to 100. To see the largest, write topk(10, ...) into the query instead of raising this. | |
| query | Yes | A PromQL expression, e.g. `sum by (namespace) (rate(http_requests_total{status=~"5.."}[5m]))`. Aggregate inside the expression (sum by, topk, count) rather than fetching raw series and reading them: Prometheus does the arithmetic exactly and the answer is a fraction of the size. | |
| precision | No | Significant digits to round fractional values to (whole numbers are never rounded). Defaults to 4; 0 returns the exact value. Raise it only when comparing values that differ past the fourth digit. |