Skip to main content

Timeseries queries

Time-bucketed guardrail 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.
Total guardrail evaluations per hour:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "guardrailMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "aggregations": [
        {"type": "count", "column": "guardrailName"}
    ]
}
Track p99 evaluation latency per scope (input / output) bucket-by-bucket:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "guardrailMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "aggregations": [
        {"type": "p99", "column": "latencyMs"}
    ],
    "groupBy": ["appliedOnEntityScope"]
}
Track per-guardrail failure rate over time:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "guardrailMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "aggregations": [
        {"type": "count", "column": "guardrailName"}
    ],
    "groupBy": ["guardrailName"],
    "filters": [
        {"fieldName": "guardrailResult", "operator": "IN", "value": ["fail"]}
    ]
}
Fine-grained breakdown to investigate a regression:
json={
    "startTs": "2026-04-21T14:00:00.000Z",
    "endTs": "2026-04-21T16:00:00.000Z",
    "datasource": "guardrailMetrics",
    "type": "timeseries",
    "interval": "5 minute",
    "aggregations": [
        {"type": "p99", "column": "latencyMs"}
    ],
    "groupBy": ["guardrailName"]
}
Daily evaluation volume per guardrail across a 7-day window:
json={
    "startTs": "2026-04-14T00:00:00.000Z",
    "endTs": "2026-04-21T00:00:00.000Z",
    "datasource": "guardrailMetrics",
    "type": "timeseries",
    "interval": "1 day",
    "aggregations": [
        {"type": "count", "column": "guardrailName"}
    ],
    "groupBy": ["guardrailName"]
}
Focus on a few guardrails of interest:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "guardrailMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "aggregations": [
        {"type": "p99", "column": "latencyMs"}
    ],
    "groupBy": ["guardrailName"],
    "filters": [
        {"fieldName": "guardrailName", "operator": "IN", "value": ["pii-detector", "toxicity-filter"]}
    ]
}
Per-team guardrail activity over time:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "guardrailMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "aggregations": [
        {"type": "count", "column": "guardrailName"}
    ],
    "groupBy": ["team"],
    "filters": [
        {"fieldName": "team", "operator": "ARRAY_HAS_ANY", "value": ["team-alpha"]}
    ]
}