:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"query": {
"description": "The span aggregation query to execute.",
"properties": {
"compareFilter": {
"description": "Optional comparison-window configuration. When omitted, only the primary window is returned.",
"properties": {
"compare": {
"default": false,
"description": "When true, also fetch results for a comparison window and return them under `compare`.",
"type": "boolean"
},
"compare_to": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "Relative date offset for the comparison window (e.g. '-1h', '-1d', '-7d'). Defaults to the immediately previous period of equal length."
}
},
"type": "object"
},
"dateRange": {
"description": "Date range for the primary window. Defaults to last hour.",
"properties": {
"date_from": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "Start of the date range. Accepts ISO 8601 timestamps or relative formats: -1h, -6h, -1d, -7d, etc."
},
"date_to": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "End of the date range. Same format as date_from. Omit or null for \"now\"."
}
},
"type": "object"
},
"filterGroup": {
"default": [],
"description": "Property filters applied to spans in both windows.",
"items": {
"properties": {
"key": {
"description": "Attribute key. For type \"span\", use built-in fields (trace_id, span_id, duration, name, kind, status_code, is_root_span). For \"span_attribute\"/\"span_resource_attribute\", use the attribute key (e.g. \"http.method\").",
"type": "string"
},
"operator": {
"description": "Comparison operator.\n\n* `exact` - exact\n* `is_not` - is_not\n* `icontains` - icontains\n* `not_icontains` - not_icontains\n* `starts_with` - starts_with\n* `not_starts_with` - not_starts_with\n* `ends_with` - ends_with\n* `not_ends_with` - not_ends_with\n* `regex` - regex\n* `not_regex` - not_regex\n* `gt` - gt\n* `lt` - lt\n* `is_set` - is_set\n* `is_not_set` - is_not_set",
"enum": [
"exact",
"is_not",
"icontains",
"not_icontains",
"starts_with",
"not_starts_with",
"ends_with",
"not_ends_with",
"regex",
"not_regex",
"gt",
"lt",
"is_set",
"is_not_set"
],
"type": "string"
},
"type": {
"description": "\"span\" filters built-in span fields. \"span_attribute\" filters span-level attributes. \"span_resource_attribute\" filters resource-level attributes.\n\n* `span` - span\n* `span_attribute` - span_attribute\n* `span_resource_attribute` - span_resource_attribute",
"enum": ["span", "span_attribute", "span_resource_attribute"],
"type": "string"
},
"value": {
"description": "Value to compare against. String, number, or array of strings. Omit for is_set/is_not_set operators."
}
},
"required": ["key", "type", "operator"],
"type": "object"
},
"type": "array"
},
"groupByEndpoint": {
"default": false,
"description": "Group HTTP server spans by `METHOD route` (from `http.route`) in place of the span name, so raw paths like `/users/1` and `/users/2` fold into one row. Spans without a route keep their span name. Spans that are not HTTP server spans are left out.",
"type": "boolean"
},
"includeHealth": {
"default": false,
"description": "Also return `health_status` and `health_reason` per row, comparing each row with the same row in the comparison window, or in the previous period when `compareFilter` is off. Uses the same statuses and thresholds as the service health check. Costs a second window query.",
"type": "boolean"
},
"includeImpact": {
"default": false,
"description": "Also return the sessions and people behind each operation. Off by default because it reads the span and resource attribute maps, which the rest of the aggregation never touches.",
"type": "boolean"
},
"limit": {
"description": "Max rows to return, ordered by total_duration_nano DESC. Defaults to 100; hard max 5000. Keep this small to bound the response size — a high value on high-cardinality span names (e.g. untemplated URL paths) returns a very large payload. Prefer narrowing with `serviceNames`/`filterGroup` over raising the limit.",
"maximum": 5000,
"minimum": 1,
"type": "number"
},
"offset": {
"description": "Row offset for pagination. Combine with `limit` and the `next_offset` returned in the response to page through results beyond the first page.",
"minimum": 0,
"type": "number"
},
"serviceNames": {
"description": "Filter by service names.",
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
}
},
"required": ["query"],
"type": "object"
}