Query Workload Metrics (PromQL)
query_metricsRun a PromQL query against Control Plane metrics (Prometheus-compatible). Default is a range query over the last hour at 60s step — pass resolution: "instant" for a point-in-time query, since / from / to to adjust the window, and step to control resolution. Results are sliced to the first 50 series in prose; the full Prometheus response is included as JSON. If you already know the metric, just query it: gauges like cpu_used, mem_used, replica_count are used bare — as are the pre-rated egress and requests_per_second (never wrap these in rate()); genuine counters need rate(), e.g. sum by (workload) (rate(container_restarts[5m])); latency is a histogram: histogram_quantile(0.95, sum by (le) (request_duration_ms_bucket)). Only when you are unsure of the exact metric name or label values — or a query returns no series — call list_metrics first to see what is actually present in the org (incl. custom metrics) and a metric’s real labels. Use this to verify autoscaling signals before changing scaling settings — measure first, then change.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | End of range — RFC3339 or epoch seconds. Default: now. | |
| org | Yes | Organization slug (lowercase kebab-case). NEVER guess — if the user has not named one, ask. On org-not-found, stop and ask; do not retry variants. | |
| from | No | Start of range — RFC3339 or epoch seconds. Overrides `since` when set. | |
| step | No | Step (range queries only). Examples: "15s", "60s", "5m". Default: "60s". | |
| query | Yes | PromQL query, scoped automatically to the org in the request path (no `org=` label needed). Use REAL Control Plane metric names — call list_metrics if unsure. Examples with actual metrics: `avg by (workload) (cpu_used)` (gauge), `sum by (workload) (rate(container_restarts[5m]))` (counter), `histogram_quantile(0.95, sum by (le) (request_duration_ms_bucket))` (latency histogram). Pre-rated series — `egress`, `cross_zone_traffic`, `requests_per_second` — are queried bare, never wrapped in rate(). | |
| since | No | Relative lookback (e.g., "5m", "1h", "24h"). Used when `from` is not provided. Default: "1h". | |
| resolution | No | `instant` for /query — a single sample at `to` (defaults to now); `from`/`since`/`step` are ignored. `range` for /query_range (default). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | Whether the call succeeded. | |
| data | No | The full machine-readable result — list rows, the resource object, query results. Read THIS, not just the summary. | |
| summary | Yes | One-line summary of the result. | |
| nextSteps | No | Recommended follow-up actions for this task, in order. |