Skip to main content

Filtering

Filters narrow down the rows that go into each aggregation and group. They are AND-combined; there is no OR-group support. The server enforces a per-field operator allow-list, so the exact subset of operators you can use depends on the field.

Filter object structure

For standard datasource fields, use fieldName:
{
    "fieldName": "requestedModel",
    "operator": "IN",
    "value": ["gpt-4"]
}

Filterable fields

httpStatusCode, errorType, and latencyMs are not filterable on configMetrics. Sending them returns 400 Bad Request with Unsupported gateway config filter name: <field>. Use status in groupBy to see allowed vs blocked or failure outcomes instead.
FieldTypeAllowed operators
loadbalanceRuleIdstringIN, NOT_IN
ratelimitRuleIdstringIN, NOT_IN
budgetRuleIdstringIN, NOT_IN
requestedModelstringIN, NOT_IN
targetModelstringIN, NOT_IN
userEmailstringfull string operator set (no IS_NULL)
virtualAccountstringfull string operator set (no IS_NULL)
teamarrayARRAY_HAS_ANY, ARRAY_HAS_NONE
conversationIDstringfull string operator set (no IS_NULL)
metadataKey / metadata.<key>stringfull string operator set (no IS_NULL)

Filter operators

String field operators

OperatorDescriptionExample value
EQUALExact match"alice@example.com"
NOT_EQUALNot equal to value"bot@example.com"
INMatch any value in the list["gpt-4", "gpt-3.5-turbo"]
NOT_INExclude values in the list["deprecated-model"]
STRING_CONTAINSContains substring"prod"
STRING_NOT_CONTAINSDoes not contain substring"staging"
STRING_STARTS_WITHStarts with prefix"prod-"
STRING_NOT_STARTS_WITHDoes not start with prefix"internal-"
STRING_ENDS_WITHEnds with suffix"-v1"
STRING_NOT_ENDS_WITHDoes not end with suffix"-deprecated"

Array field operators (used by team)

OperatorDescriptionExample value
ARRAY_HAS_ANYMatch if the array contains any of the values["team-alpha", "team-beta"]
ARRAY_HAS_NONEMatch if the array contains none of the values["excluded-team"]

Custom metadata filtering and grouping

Every datasource supports filtering and grouping by custom request-metadata keys:
  • Filter: { "metadataKey": "environment", "operator": "EQUAL", "value": "prod" }
  • Group: include "metadata.environment" in the groupBy array.
Metadata fields are treated as strings; use the String field operators table.

Implicit team unnesting

When team is in groupBy (or used as the column of an aggregation), the server transparently UNNESTs the Teams array CTE before applying RBAC. Callers don’t need to do anything extra. Rows whose Teams array is NULL or empty drop out naturally.

Combining multiple filters

Filters are AND-combined:
{
    "startTs": "2026-04-21T00:00:00.000Z",
    "endTs": "2026-04-22T00:00:00.000Z",
    "datasource": "configMetrics",
    "type": "distribution",
    "filters": [
        {"fieldName": "requestedModel", "operator": "IN", "value": ["gpt-4"]},
        {"fieldName": "loadbalanceRuleId", "operator": "IN", "value": ["<rule-id>"]},
        {"fieldName": "team", "operator": "ARRAY_HAS_ANY", "value": ["team-alpha"]}
    ],
    "groupBy": ["targetModel", "status"]
}