Skip to main content

Timeseries queries

Time-bucketed routing 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.
Hourly applications per configType:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "configMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "groupBy": ["configType"]
}
Track loadbalance rule pressure over time:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "configMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "aggregations": [
        {"type": "avg", "column": "loadbalanceTargetAttemptCount"}
    ],
    "groupBy": ["loadbalanceRuleId"]
}
Useful to confirm a routing change took effect:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "configMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "aggregations": [
        {"type": "sum", "column": "loadbalanceTargetAttemptCount"}
    ],
    "groupBy": ["requestedModel", "targetModel"]
}
Volume per status over time:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "configMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "groupBy": ["status"]
}
Fine-grained breakdown to investigate a routing change:
json={
    "startTs": "2026-04-21T14:00:00.000Z",
    "endTs": "2026-04-21T16:00:00.000Z",
    "datasource": "configMetrics",
    "type": "timeseries",
    "interval": "5 minute",
    "aggregations": [
        {"type": "sum", "column": "loadbalanceTargetAttemptCount"}
    ],
    "groupBy": ["targetModel"],
    "filters": [
        {"fieldName": "requestedModel", "operator": "IN", "value": ["gpt-4"]}
    ]
}
Daily routing volume across a 7-day window:
json={
    "startTs": "2026-04-14T00:00:00.000Z",
    "endTs": "2026-04-21T00:00:00.000Z",
    "datasource": "configMetrics",
    "type": "timeseries",
    "interval": "1 day",
    "groupBy": ["configType"]
}
Watch a single rule’s volume over time:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "configMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "groupBy": ["status"],
    "filters": [
        {"fieldName": "ratelimitRuleId", "operator": "IN", "value": ["<rule-id>"]}
    ]
}