query_metrics_instant
Run an instant PromQL-compatible query against CubeAPM metrics to evaluate latency, error rates, or service counts at a single timestamp.
Instructions
Execute an instant query against CubeAPM metrics at a single point in time. Uses PromQL-compatible syntax (VictoriaMetrics flavor).
IMPORTANT - CubeAPM Metric Naming Conventions:
Metrics use "cube_apm_" prefix (e.g., cube_apm_calls_total, cube_apm_latency_bucket)
Service label is "service" (NOT "server" or "service_name")
Common labels: env, service, span_kind (server|client|consumer|producer), status_code, http_code
HISTOGRAM QUERIES (P50, P90, P95, P99):
CubeAPM uses VictoriaMetrics-style histograms with "vmrange" label (NOT Prometheus "le" buckets)
Use histogram_quantiles() function instead of histogram_quantile()
Syntax: histogram_quantiles("phi", 0.95, sum by (vmrange) (increase(cube_apm_latency_bucket{...}[5m])))
Latency values are returned in SECONDS (0.05 = 50ms)
Example queries:
P95 latency: histogram_quantiles("phi", 0.95, sum by (vmrange, service) (increase(cube_apm_latency_bucket{service="MyService", span_kind="server"}[5m])))
Error rate: sum by (service) (increase(cube_apm_calls_total{status_code="ERROR"}[1h])) / sum by (service) (increase(cube_apm_calls_total[1h])) * 100
List services: count by (service) (cube_apm_calls_total{env="UNSET"})
Request count: sum by (service) (increase(cube_apm_calls_total{span_kind=~"server|consumer"}[1h]))
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"query": "<query>",
"time": "<time>"
},
"name": "query_metrics_instant"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| step | No | Time window in seconds for processing data | |
| time | Yes | Evaluation timestamp in RFC3339 format or Unix timestamp in seconds | |
| query | Yes | The metrics query expression (PromQL syntax) |