Skip to main content

Timeseries queries

Time-bucketed agent metrics over a window. Every timeseries query must include interval (or the deprecated intervalInSeconds). Each example below posts JSON to:
POST https://{your_control_plane_url}/api/svc/v1/llm-gateway/metrics/query
with Authorization: Bearer <your_api_key> and Content-Type: application/json. To keep the snippets short, only the JSON body is shown; the wrapper is identical to the Overview Quick Start.
Agent metrics include every Gateway request by default. Rows that didn’t go through an agent will have agentName, agentFramework, and agentServerType set to null and show up as null buckets in groupBy output. IS_NULL is not supported on these three fields; to scope to specific known agents, use agentName IN [...] or one of the STRING_* operators.
Per-agent invocation count over time:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "agentMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "groupBy": ["agentName"]
}
Watch latency regressions per agent:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "agentMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "aggregations": [
        {"type": "p99", "column": "latencyMs"}
    ],
    "groupBy": ["agentName"]
}
Track failures per agent bucket-by-bucket:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "agentMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "aggregations": [
        {"type": "count", "column": "agentName"}
    ],
    "groupBy": ["agentName"],
    "filters": [
        {"fieldName": "isFailure", "operator": "EQUAL", "value": true}
    ]
}
Per-framework volume over time:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "agentMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "groupBy": ["agentFramework"]
}
Fine-grained breakdown to investigate a regression:
json={
    "startTs": "2026-04-21T14:00:00.000Z",
    "endTs": "2026-04-21T16:00:00.000Z",
    "datasource": "agentMetrics",
    "type": "timeseries",
    "interval": "5 minute",
    "aggregations": [
        {"type": "p99", "column": "latencyMs"}
    ],
    "groupBy": ["agentName"]
}
Daily agent traffic across a 7-day window:
json={
    "startTs": "2026-04-14T00:00:00.000Z",
    "endTs": "2026-04-21T00:00:00.000Z",
    "datasource": "agentMetrics",
    "type": "timeseries",
    "interval": "1 day",
    "groupBy": ["agentName"]
}
Per-team agent usage over time:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "agentMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "groupBy": ["team"],
    "filters": [
        {"fieldName": "team", "operator": "ARRAY_HAS_ANY", "value": ["team-alpha", "team-beta"]}
    ]
}
Use agentName IN [...] to scope the timeseries to specific agents:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "agentMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "aggregations": [
        {"type": "p99", "column": "latencyMs"}
    ],
    "groupBy": ["agentName"],
    "filters": [
        {"fieldName": "agentName", "operator": "IN", "value": ["support-bot", "research-agent"]}
    ]
}