Skip to main content

Timeseries queries

Time-bucketed MCP 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.
MCP metrics include all JSON-RPC methods by default. Pin the tool-call subset with {"fieldName": "method", "operator": "IN", "value": ["tools/call"]} when you want toolName populated.
Total MCP requests per hour:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "mcpMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "aggregations": [
        {"type": "count", "column": "mcpServerName"}
    ]
}
Hourly tool calls grouped by tool:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "mcpMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "aggregations": [
        {"type": "count", "column": "toolName"}
    ],
    "groupBy": ["toolName"],
    "filters": [
        {"fieldName": "method", "operator": "IN", "value": ["tools/call"]}
    ]
}
Track regressions per server, bucket-by-bucket:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "mcpMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "aggregations": [
        {"type": "p99", "column": "latencyMs"}
    ],
    "groupBy": ["mcpServerName"]
}
Volume per JSON-RPC method over time:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "mcpMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "aggregations": [
        {"type": "count", "column": "method"}
    ],
    "groupBy": ["method"]
}
Fine-grained tool-call traffic on one server:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-21T06:00:00.000Z",
    "datasource": "mcpMetrics",
    "type": "timeseries",
    "interval": "5 minute",
    "aggregations": [
        {"type": "count", "column": "toolName"},
        {"type": "p99", "column": "latencyMs"}
    ],
    "groupBy": ["toolName"],
    "filters": [
        {"fieldName": "method", "operator": "IN", "value": ["tools/call"]},
        {"fieldName": "mcpServerName", "operator": "IN", "value": ["github-mcp"]}
    ]
}
Daily tool-call volume across a 7-day window:
json={
    "startTs": "2026-04-14T00:00:00.000Z",
    "endTs": "2026-04-21T00:00:00.000Z",
    "datasource": "mcpMetrics",
    "type": "timeseries",
    "interval": "1 day",
    "aggregations": [
        {"type": "count", "column": "toolName"}
    ],
    "filters": [
        {"fieldName": "method", "operator": "IN", "value": ["tools/call"]}
    ]
}
Per-team tool-call usage over time:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "mcpMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "aggregations": [
        {"type": "count", "column": "toolName"}
    ],
    "groupBy": ["team"],
    "filters": [
        {"fieldName": "method", "operator": "IN", "value": ["tools/call"]},
        {"fieldName": "team", "operator": "ARRAY_HAS_ANY", "value": ["team-alpha", "team-beta"]}
    ]
}
Multiple filters and grouping together:
json={
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "mcpMetrics",
    "type": "timeseries",
    "interval": "1 hour",
    "aggregations": [
        {"type": "count", "column": "toolName"},
        {"type": "p99", "column": "latencyMs"}
    ],
    "groupBy": ["mcpServerName", "toolName"],
    "filters": [
        {"fieldName": "method", "operator": "IN", "value": ["tools/call"]},
        {"fieldName": "mcpServerName", "operator": "IN", "value": ["github-mcp", "atlassian-mcp"]},
        {"metadataKey": "environment", "operator": "IN", "value": ["production"]}
    ]
}