query_metrics_range
Executes PromQL-compatible range queries against CubeAPM metrics over a specified time range and returns time series data for investigating service latency, errors, and trends.
Instructions
Execute a range query against CubeAPM metrics over a time range. Returns time series data. 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, service) (increase(cube_apm_latency_bucket{...}[5m])))
Latency values are returned in SECONDS (0.05 = 50ms)
Example range query for P95 over time: histogram_quantiles("phi", 0.95, sum by (vmrange, service) (increase(cube_apm_latency_bucket{service="MyService", span_kind="server"}[5m])))
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>",
"start": "<start>",
"end": "<end>",
"step": "<step>"
},
"name": "query_metrics_range"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | Yes | End timestamp in RFC3339 format or Unix timestamp | |
| step | Yes | Resolution step width in seconds | |
| query | Yes | The metrics query expression (PromQL syntax) | |
| start | Yes | Start timestamp in RFC3339 format or Unix timestamp |