Skip to content

: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.

feat(metrics): add latency-over-time heatmap (MetricsHistogramQuery) (#99323)

Daniel Visca52f33d9ec79b
diff --git a/frontend/src/queries/Query/Query.tsx b/frontend/src/queries/Query/Query.tsx
index ffdf07174681..dfb0e10fb6d1 100644
--- a/frontend/src/queries/Query/Query.tsx
+++ b/frontend/src/queries/Query/Query.tsx
@@ -25,7 +25,7 @@ import {
import { QueryContext } from '~/queries/types'
import { EndpointsUsageOverviewNode, EndpointsUsageTrendsNode } from 'products/endpoints/frontend/nodes'
-import { MetricsQueryNode } from 'products/metrics/frontend/nodes'
+import { MetricsHistogramQueryNode, MetricsQueryNode } from 'products/metrics/frontend/nodes'
import { DataTableVisualization } from '../nodes/DataVisualization/DataVisualization'
import { SavedInsight } from '../nodes/SavedInsight/SavedInsight'
@@ -37,6 +37,7 @@ import {
isHogQuery,
isInsightVizNode,
isMarketingAnalyticsAggregatedQuery,
+ isMetricsHistogramQuery,
isMetricsQuery,
isSavedInsightNode,
isWebOverviewQuery,
@@ -190,6 +191,15 @@ export function Query<Q extends Node>(props: QueryProps<Q>): JSX.Element | null
context={queryContext}
/>
)
+ } else if (isMetricsHistogramQuery(query)) {
+ component = (
+ <MetricsHistogramQueryNode
+ attachTo={props.attachTo}
+ query={query}
+ cachedResults={props.cachedResults}
+ context={queryContext}
+ />
+ )
} else if (isEndpointsUsageOverviewQuery(query)) {
component = (
<EndpointsUsageOverviewNode
diff --git a/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts b/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts
index 3bdb6ffd4aec..123dd3eedd65 100644
--- a/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts
+++ b/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts
@@ -1509,6 +1509,7 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
| import('~/queries/schema/schema-general').HogQueryResponse
| import('~/queries/schema/schema-general').LogAttributesQueryResponse
| import('~/queries/schema/schema-general').LogValuesQueryResponse
+ | import('~/queries/schema/schema-general').MetricsHistogramQueryResponse
| import('~/queries/schema/schema-general').MetricsQueryResponse
| import('~/queries/schema/schema-general').TraceSpansAggregationQueryResponse
| import('~/queries/schema/schema-general').TraceSpansAttributeBreakdownQueryResponse
@@ -1565,6 +1566,7 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
| import('~/queries/schema/schema-general').HogQueryResponse
| import('~/queries/schema/schema-general').LogAttributesQueryResponse
| import('~/queries/schema/schema-general').LogValuesQueryResponse
+ | import('~/queries/schema/schema-general').MetricsHistogramQueryResponse
| import('~/queries/schema/schema-general').MetricsQueryResponse
| import('~/queries/schema/schema-general').TraceSpansAggregationQueryResponse
| import('~/queries/schema/schema-general').TraceSpansAttributeBreakdownQueryResponse
@@ -1716,6 +1718,7 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
| import('~/queries/schema/schema-general').HogQueryResponse
| import('~/queries/schema/schema-general').LogAttributesQueryResponse
| import('~/queries/schema/schema-general').LogValuesQueryResponse
+ | import('~/queries/schema/schema-general').MetricsHistogramQueryResponse
| import('~/queries/schema/schema-general').MetricsQueryResponse
| import('~/queries/schema/schema-general').TraceSpansAggregationQueryResponse
| import('~/queries/schema/schema-general').TraceSpansAttributeBreakdownQueryResponse
@@ -1739,6 +1742,7 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
| import('~/queries/schema/schema-general').HogQueryResponse
| import('~/queries/schema/schema-general').LogAttributesQueryResponse
| import('~/queries/schema/schema-general').LogValuesQueryResponse
+ | import('~/queries/schema/schema-general').MetricsHistogramQueryResponse
| import('~/queries/schema/schema-general').MetricsQueryResponse
| import('~/queries/schema/schema-general').TraceSpansAggregationQueryResponse
| import('~/queries/schema/schema-general').TraceSpansAttributeBreakdownQueryResponse
@@ -1783,6 +1787,7 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
| import('~/queries/schema/schema-general').HogQueryResponse
| import('~/queries/schema/schema-general').LogAttributesQueryResponse
| import('~/queries/schema/schema-general').LogValuesQueryResponse
+ | import('~/queries/schema/schema-general').MetricsHistogramQueryResponse
| import('~/queries/schema/schema-general').MetricsQueryResponse
| import('~/queries/schema/schema-general').TraceSpansAggregationQueryResponse
| import('~/queries/schema/schema-general').TraceSpansAttributeBreakdownQueryResponse
@@ -1806,6 +1811,7 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
| import('~/queries/schema/schema-general').HogQueryResponse
| import('~/queries/schema/schema-general').LogAttributesQueryResponse
| import('~/queries/schema/schema-general').LogValuesQueryResponse
+ | import('~/queries/schema/schema-general').MetricsHistogramQueryResponse
| import('~/queries/schema/schema-general').MetricsQueryResponse
| import('~/queries/schema/schema-general').TraceSpansAggregationQueryResponse
| import('~/queries/schema/schema-general').TraceSpansAttributeBreakdownQueryResponse
@@ -1856,6 +1862,7 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
| import('~/queries/schema/schema-general').HogQueryResponse
| import('~/queries/schema/schema-general').LogAttributesQueryResponse
| import('~/queries/schema/schema-general').LogValuesQueryResponse
+ | import('~/queries/schema/schema-general').MetricsHistogramQueryResponse
| import('~/queries/schema/schema-general').MetricsQueryResponse
| import('~/queries/schema/schema-general').TraceSpansAggregationQueryResponse
| import('~/queries/schema/schema-general').TraceSpansAttributeBreakdownQueryResponse
@@ -1878,6 +1885,7 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
| import('~/queries/schema/schema-general').HogQueryResponse
| import('~/queries/schema/schema-general').LogAttributesQueryResponse
| import('~/queries/schema/schema-general').LogValuesQueryResponse
+ | import('~/queries/schema/schema-general').MetricsHistogramQueryResponse
| import('~/queries/schema/schema-general').MetricsQueryResponse
| import('~/queries/schema/schema-general').TraceSpansAggregationQueryResponse
| import('~/queries/schema/schema-general').TraceSpansAttributeBreakdownQueryResponse
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index c19b5e21ab62..e0ed76be9ff0 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -1710,6 +1710,9 @@
{
"$ref": "#/definitions/MetricsQuery"
},
+ {
+ "$ref": "#/definitions/MetricsHistogramQuery"
+ },
{
"$ref": "#/definitions/TraceSpansQuery"
},
@@ -12580,6 +12583,132 @@
],
"type": "object"
},
+ "CachedMetricsHistogramQueryResponse": {
+ "additionalProperties": false,
+ "properties": {
+ "bounds": {
+ "description": "Upper bound per row (y axis), ascending.",
+ "items": {
+ "type": "number"
+ },
+ "type": "array"
+ },
+ "cache_key": {
+ "type": "string"
+ },
+ "cache_target_age": {
+ "format": "date-time",
+ "type": "string"
+ },
+ "calculation_trigger": {
+ "description": "What triggered the calculation of the query, leave empty if user/immediate",
+ "type": "string"
+ },
+ "counts": {
+ "description": "Observation count per cell: counts[row][column], row = bound, column = time.",
+ "items": {
+ "items": {
+ "type": "number"
+ },
+ "type": "array"
+ },
+ "type": "array"
+ },
+ "error": {
+ "description": "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.",
+ "type": "string"
+ },
+ "hogql": {
+ "description": "Generated HogQL query.",
+ "type": "string"
+ },
+ "is_cached": {
+ "type": "boolean"
+ },
+ "last_refresh": {
+ "format": "date-time",
+ "type": "string"
+ },
+ "modifiers": {
+ "$ref": "#/definitions/HogQLQueryModifiers",
+ "description": "Modifiers used when performing the query"
+ },
+ "next_allowed_client_refresh": {
+ "format": "date-time",
+ "type": "string"
+ },
+ "query_metadata": {
+ "type": "object"
+ },
+ "query_scan": {
+ "$ref": "#/definitions/QueryScanSummary",
+ "description": "The rows and time of the run that produced these results, with its analysis once it is stored."
+ },
+ "query_status": {
+ "$ref": "#/definitions/QueryStatus",
+ "description": "Query status indicates whether next to the provided data, a query is still running."
+ },
+ "resolved_compare_date_range": {
+ "$ref": "#/definitions/ResolvedDateRangeResponse",
+ "description": "The resolved previous/comparison period date range, when comparing against another period"
+ },
+ "resolved_date_range": {
+ "$ref": "#/definitions/ResolvedDateRangeResponse",
+ "description": "The date range used for the query"
+ },
+ "results": {},
+ "times": {
+ "description": "Bucket start per column (x axis), ISO 8601, ascending.",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "timezone": {
+ "type": "string"
+ },
+ "timings": {
+ "description": "Measured timings for different parts of the query generation process",
+ "items": {
+ "$ref": "#/definitions/QueryTiming"
+ },
+ "type": "array"
+ },
+ "used_data_warehouse_sources": {
+ "description": "Connector-synced data warehouse sources referenced by this query, if any.",
+ "items": {
+ "$ref": "#/definitions/DataWarehouseSourceUsage"
+ },
+ "type": "array"
+ },
+ "warnings": {
+ "description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access.",
+ "items": {
+ "anyOf": [
+ {
+ "$ref": "#/definitions/DataWarehouseSyncWarning"
+ },
+ {
+ "$ref": "#/definitions/AccessControlFilterWarning"
+ }
+ ]
+ },
+ "type": "array"
+ }
+ },
+ "required": [
+ "bounds",
+ "cache_key",
+ "counts",
+ "is_cached",
+ "last_refresh",
+ "next_allowed_client_refresh",
+ "results",
+ "times",
+ "timezone"
+ ],
+ "type": "object"
+ },
"CachedMetricsQueryResponse": {
"additionalProperties": false,
"properties": {
@@ -37133,6 +37262,137 @@
"enum": ["eq", "neq", "regex", "not_regex"],
"type": "string"
},
+ "MetricsHistogramQuery": {
+ "additionalProperties": false,
+ "description": "Histogram bucket counts per time bucket, for a latency-over-time heatmap. A separate node from `MetricsQuery` because the response is a grid, not series — a display type must not change what the runner reads (the cache key excludes display).",
+ "properties": {
+ "dateRange": {
+ "$ref": "#/definitions/DateRange",
+ "description": "Defaults to the last 24 hours when omitted; dashboard date filters override it"
+ },
+ "filters": {
+ "items": {
+ "$ref": "#/definitions/MetricsQueryFilter"
+ },
+ "type": "array"
+ },
+ "interval": {
+ "description": "Bucket size; auto-picked from the range when omitted",
+ "type": "string"
+ },
+ "kind": {
+ "const": "MetricsHistogramQuery",
+ "type": "string"
+ },
+ "metricName": {
+ "type": "string"
+ },
+ "modifiers": {
+ "$ref": "#/definitions/HogQLQueryModifiers",
+ "description": "Modifiers used when performing the query"
+ },
+ "response": {
+ "$ref": "#/definitions/MetricsHistogramQueryResponse"
+ },
+ "tags": {
+ "$ref": "#/definitions/QueryLogTags"
+ },
+ "unit": {
+ "description": "UCUM unit for the y-axis bounds, e.g. \"s\", \"ms\". Presentation only.",
+ "type": "string"
+ },
+ "version": {
+ "description": "version of the node, used for schema migrations",
+ "type": "number"
+ }
+ },
+ "required": ["kind", "metricName"],
+ "type": "object"
+ },
+ "MetricsHistogramQueryResponse": {
+ "additionalProperties": false,
+ "properties": {
+ "bounds": {
+ "description": "Upper bound per row (y axis), ascending.",
+ "items": {
+ "type": "number"
+ },
+ "type": "array"
+ },
+ "counts": {
+ "description": "Observation count per cell: counts[row][column], row = bound, column = time.",
+ "items": {
+ "items": {
+ "type": "number"
+ },
+ "type": "array"
+ },
+ "type": "array"
+ },
+ "error": {
+ "description": "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.",
+ "type": "string"
+ },
+ "hogql": {
+ "description": "Generated HogQL query.",
+ "type": "string"
+ },
+ "modifiers": {
+ "$ref": "#/definitions/HogQLQueryModifiers",
+ "description": "Modifiers used when performing the query"
+ },
+ "query_status": {
+ "$ref": "#/definitions/QueryStatus",
+ "description": "Query status indicates whether next to the provided data, a query is still running."
+ },
+ "resolved_compare_date_range": {
+ "$ref": "#/definitions/ResolvedDateRangeResponse",
+ "description": "The resolved previous/comparison period date range, when comparing against another period"
+ },
+ "resolved_date_range": {
+ "$ref": "#/definitions/ResolvedDateRangeResponse",
+ "description": "The date range used for the query"
+ },
+ "results": {},
+ "times": {
+ "description": "Bucket start per column (x axis), ISO 8601, ascending.",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "timings": {
+ "description": "Measured timings for different parts of the query generation process",
+ "items": {
+ "$ref": "#/definitions/QueryTiming"
+ },
+ "type": "array"
+ },
+ "used_data_warehouse_sources": {
+ "description": "Connector-synced data warehouse sources referenced by this query, if any.",
+ "items": {
+ "$ref": "#/definitions/DataWarehouseSourceUsage"
+ },
+ "type": "array"
+ },
+ "warnings": {
+ "description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access.",
+ "items": {
+ "anyOf": [
+ {
+ "$ref": "#/definitions/DataWarehouseSyncWarning"
+ },
+ {
+ "$ref": "#/definitions/AccessControlFilterWarning"
+ }
+ ]
+ },
+ "type": "array"
+ }
+ },
+ "required": ["bounds", "counts", "results", "times"],
+ "type": "object"
+ },
"MetricsNullMode": {
"description": "How a null bucket renders on a time-series chart.",
"enum": ["gap", "zero", "connect"],
@@ -37763,6 +38023,7 @@
"LogAttributesQuery",
"LogValuesQuery",
"MetricsQuery",
+ "MetricsHistogramQuery",
"TraceSpansQuery",
"TraceSpansAggregationQuery",
"TraceSpansTreeQuery",
@@ -45461,6 +45722,90 @@
"required": ["results"],
"type": "object"
},
+ {
+ "additionalProperties": false,
+ "properties": {
+ "bounds": {
+ "description": "Upper bound per row (y axis), ascending.",
+ "items": {
+ "type": "number"
+ },
+ "type": "array"
+ },
+ "counts": {
+ "description": "Observation count per cell: counts[row][column], row = bound, column = time.",
+ "items": {
+ "items": {
+ "type": "number"
+ },
+ "type": "array"
+ },
+ "type": "array"
+ },
+ "error": {
+ "description": "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.",
+ "type": "string"
+ },
+ "hogql": {
+ "description": "Generated HogQL query.",
+ "type": "string"
+ },
+ "modifiers": {
+ "$ref": "#/definitions/HogQLQueryModifiers",
+ "description": "Modifiers used when performing the query"
+ },
+ "query_status": {
+ "$ref": "#/definitions/QueryStatus",
+ "description": "Query status indicates whether next to the provided data, a query is still running."
+ },
+ "resolved_compare_date_range": {
+ "$ref": "#/definitions/ResolvedDateRangeResponse",
+ "description": "The resolved previous/comparison period date range, when comparing against another period"
+ },
+ "resolved_date_range": {
+ "$ref": "#/definitions/ResolvedDateRangeResponse",
+ "description": "The date range used for the query"
+ },
+ "results": {},
+ "times": {
+ "description": "Bucket start per column (x axis), ISO 8601, ascending.",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "timings": {
+ "description": "Measured timings for different parts of the query generation process",
+ "items": {
+ "$ref": "#/definitions/QueryTiming"
+ },
+ "type": "array"
+ },
+ "used_data_warehouse_sources": {
+ "description": "Connector-synced data warehouse sources referenced by this query, if any.",
+ "items": {
+ "$ref": "#/definitions/DataWarehouseSourceUsage"
+ },
+ "type": "array"
+ },
+ "warnings": {
+ "description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access.",
+ "items": {
+ "anyOf": [
+ {
+ "$ref": "#/definitions/DataWarehouseSyncWarning"
+ },
+ {
+ "$ref": "#/definitions/AccessControlFilterWarning"
+ }
+ ]
+ },
+ "type": "array"
+ }
+ },
+ "required": ["bounds", "counts", "results", "times"],
+ "type": "object"
+ },
{
"additionalProperties": false,
"properties": {
@@ -48324,6 +48669,9 @@
{
"$ref": "#/definitions/MetricsQuery"
},
+ {
+ "$ref": "#/definitions/MetricsHistogramQuery"
+ },
{
"$ref": "#/definitions/TraceSpansQuery"
},
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index 2719be91ecfc..44fe15289f91 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -112,6 +112,7 @@ export enum NodeKind {
LogAttributesQuery = 'LogAttributesQuery',
LogValuesQuery = 'LogValuesQuery',
MetricsQuery = 'MetricsQuery',
+ MetricsHistogramQuery = 'MetricsHistogramQuery',
TraceSpansQuery = 'TraceSpansQuery',
TraceSpansAggregationQuery = 'TraceSpansAggregationQuery',
TraceSpansTreeQuery = 'TraceSpansTreeQuery',
@@ -264,6 +265,7 @@ export type AnyDataNode =
| LogAttributesQuery
| LogValuesQuery
| MetricsQuery
+ | MetricsHistogramQuery
| TraceSpansQuery
| TraceSpansAggregationQuery
| TraceSpansTreeQuery
@@ -388,6 +390,7 @@ export type QuerySchema =
// Metrics
| MetricsQuery
+ | MetricsHistogramQuery
// Tracing
| TraceSpansQuery
@@ -4754,6 +4757,33 @@ export interface MetricsQueryResponse extends AnalyticsQueryResponseBase {
}
export type CachedMetricsQueryResponse = CachedQueryResponse<MetricsQueryResponse>
+/** Histogram bucket counts per time bucket, for a latency-over-time heatmap. A separate node
+ * from `MetricsQuery` because the response is a grid, not series — a display type must not
+ * change what the runner reads (the cache key excludes display). */
+export interface MetricsHistogramQuery extends DataNode<MetricsHistogramQueryResponse> {
+ kind: NodeKind.MetricsHistogramQuery
+ metricName: string
+ filters?: MetricsQueryFilter[]
+ /** Defaults to the last 24 hours when omitted; dashboard date filters override it */
+ dateRange?: DateRange
+ /** Bucket size; auto-picked from the range when omitted */
+ interval?: string
+ /** UCUM unit for the y-axis bounds, e.g. "s", "ms". Presentation only. */
+ unit?: string
+}
+
+export interface MetricsHistogramQueryResponse extends AnalyticsQueryResponseBase {
+ /** The grid lives in `times`/`bounds`/`counts`; the base `results` array is unused and the
+ * runner returns it as null. */
+ /** Bucket start per column (x axis), ISO 8601, ascending. */
+ times: string[]
+ /** Upper bound per row (y axis), ascending. */
+ bounds: number[]
+ /** Observation count per cell: counts[row][column], row = bound, column = time. */
+ counts: number[][]
+}
+export type CachedMetricsHistogramQueryResponse = CachedQueryResponse<MetricsHistogramQueryResponse>
+
/** How a metrics result is charted. `stat` is a single headline value plus sparkline, not a time series. */
export type MetricsDisplayType = 'line' | 'area' | 'bar' | 'stat' | 'gauge' | 'bargauge' | 'table' | 'heatmap'
diff --git a/frontend/src/queries/utils.ts b/frontend/src/queries/utils.ts
index d3f75ead7aa0..d52a23bd06d8 100644
--- a/frontend/src/queries/utils.ts
+++ b/frontend/src/queries/utils.ts
@@ -47,6 +47,7 @@ import {
MarketingAnalyticsAggregatedQuery,
MarketingAnalyticsTableQuery,
MathType,
+ MetricsHistogramQuery,
MetricsQuery,
Node,
NodeKind,
@@ -231,6 +232,10 @@ export function isMetricsQuery(node?: Record<string, any> | null): node is Metri
return node?.kind === NodeKind.MetricsQuery
}
+export function isMetricsHistogramQuery(node?: Record<string, any> | null): node is MetricsHistogramQuery {
+ return node?.kind === NodeKind.MetricsHistogramQuery
+}
+
export function isEndpointsUsageOverviewQuery(node?: Record<string, any> | null): node is EndpointsUsageOverviewQuery {
return node?.kind === NodeKind.EndpointsUsageOverviewQuery
}
diff --git a/frontend/src/scenes/saved-insights/insightTypesMetadata.tsx b/frontend/src/scenes/saved-insights/insightTypesMetadata.tsx
index ace38da0037b..829df45c1d26 100644
--- a/frontend/src/scenes/saved-insights/insightTypesMetadata.tsx
+++ b/frontend/src/scenes/saved-insights/insightTypesMetadata.tsx
@@ -508,6 +508,12 @@ export const QUERY_TYPES_METADATA: Record<NodeKind, InsightTypeMetadata> = {
icon: IconLive,
inMenu: false,
},
+ [NodeKind.MetricsHistogramQuery]: {
+ name: 'Metrics heatmap',
+ description: 'Chart a histogram metric as a latency-over-time heatmap',
+ icon: IconLive,
+ inMenu: false,
+ },
[NodeKind.TraceSpansQuery]: {
name: 'Trace Spans',
icon: IconLive,
diff --git a/posthog/api/query.py b/posthog/api/query.py
index 71ff0a51042a..d1cd731d0022 100644
--- a/posthog/api/query.py
+++ b/posthog/api/query.py
@@ -191,6 +191,7 @@ _QUERY_KIND_SCOPES: dict[str, list[str]] = {
"ErrorTrackingFingerprintProjectionQuery": ["query:read", "error_tracking:read"],
"ErrorTrackingReleasesQuery": ["query:read", "error_tracking:read"],
"MetricsQuery": ["metrics:read"],
+ "MetricsHistogramQuery": ["metrics:read"],
# Both scopes listed: this result replaces the view's default query:read
# rather than adding to it, and a token must hold every listed scope.
"MCPMissingCapabilitiesQuery": ["query:read", "mcp_analytics:read"],
diff --git a/posthog/clickhouse/query_tagging.py b/posthog/clickhouse/query_tagging.py
index 40ac7813e5dc..a83f71f60d84 100644
--- a/posthog/clickhouse/query_tagging.py
+++ b/posthog/clickhouse/query_tagging.py
@@ -232,7 +232,7 @@ def kind_fallback_tags(kind: NodeKind) -> FallbackTags | None:
return {"product": Product.ERROR_TRACKING}
case NodeKind.LOGS_QUERY | NodeKind.LOG_ATTRIBUTES_QUERY | NodeKind.LOG_VALUES_QUERY:
return {"product": Product.LOGS}
- case NodeKind.METRICS_QUERY:
+ case NodeKind.METRICS_QUERY | NodeKind.METRICS_HISTOGRAM_QUERY:
return {"product": Product.METRICS}
case NodeKind.ACCOUNTS_TABLE_QUERY:
return {"product": Product.CUSTOMER_ANALYTICS}
diff --git a/posthog/hogql_queries/query_runner.py b/posthog/hogql_queries/query_runner.py
index 81e5f2e5dd88..62dc343271f6 100644
--- a/posthog/hogql_queries/query_runner.py
+++ b/posthog/hogql_queries/query_runner.py
@@ -1587,6 +1587,18 @@ def get_query_runner(
user=user,
)
+ if kind == "MetricsHistogramQuery":
+ from products.metrics.backend.facade.queries import MetricsHistogramQueryRunner
+
+ return MetricsHistogramQueryRunner(
+ query=query,
+ team=team,
+ timings=timings,
+ modifiers=modifiers,
+ limit_context=limit_context,
+ user=user,
+ )
+
# Registered here for server-side CSV export only (ExportedAsset + Celery).
# Direct queries are blocked by LogsQueryRunner.validate_query_runner_access.
if kind == "LogsQuery":
diff --git a/posthog/schema.py b/posthog/schema.py
index 25f710bc4729..8d8a0f813da9 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -2654,7 +2654,7 @@ class QueryResponseAlternative7(BaseModel):
stdout: str | None = None
-class QueryResponseAlternative79(BaseModel):
+class QueryResponseAlternative80(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -6749,7 +6749,7 @@ class QueryResponseAlternative31(BaseModel):
status: ExternalQueryStatus
-class QueryResponseAlternative86(BaseModel):
+class QueryResponseAlternative87(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -13686,6 +13686,74 @@ class CachedMarketingAnalyticsTableQueryResponse(BaseModel):
)
+class CachedMetricsHistogramQueryResponse(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ bounds: list[float] = Field(..., description="Upper bound per row (y axis), ascending.")
+ cache_key: str
+ cache_target_age: AwareDatetime | None = None
+ calculation_trigger: str | None = Field(
+ default=None,
+ description=("What triggered the calculation of the query, leave empty if user/immediate"),
+ )
+ counts: list[list[float]] = Field(
+ ...,
+ description=("Observation count per cell: counts[row][column], row = bound, column = time."),
+ )
+ error: str | None = Field(
+ default=None,
+ description=(
+ "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise."
+ ),
+ )
+ hogql: str | None = Field(default=None, description="Generated HogQL query.")
+ is_cached: bool
+ last_refresh: AwareDatetime
+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ next_allowed_client_refresh: AwareDatetime
+ query_metadata: dict[str, Any] | None = None
+ query_scan: QueryScanSummary | None = Field(
+ default=None,
+ description=("The rows and time of the run that produced these results, with its analysis once it is stored."),
+ )
+ query_status: QueryStatus | None = Field(
+ default=None,
+ description=("Query status indicates whether next to the provided data, a query is still running."),
+ )
+ resolved_compare_date_range: ResolvedDateRangeResponse | None = Field(
+ default=None,
+ description=("The resolved previous/comparison period date range, when comparing against another period"),
+ )
+ resolved_date_range: ResolvedDateRangeResponse | None = Field(
+ default=None, description="The date range used for the query"
+ )
+ results: Any
+ times: list[str] = Field(..., description="Bucket start per column (x axis), ISO 8601, ascending.")
+ timezone: str
+ timings: list[QueryTiming] | None = Field(
+ default=None,
+ description=("Measured timings for different parts of the query generation process"),
+ )
+ used_data_warehouse_sources: list[DataWarehouseSourceUsage] | None = Field(
+ default=None,
+ description=("Connector-synced data warehouse sources referenced by this query, if any."),
+ )
+ warnings: list[DataWarehouseSyncWarning | AccessControlFilterWarning] | None = Field(
+ default=None,
+ description=(
+ "Warnings about data warehouse sources referenced by the query whose"
+ " latest sync failed, is paused, hit a billing limit, or is otherwise"
+ " stale. Results may not reflect current source data. Accumulated"
+ " across every HogQL execution that contributes to this response — so"
+ " insights backed by warehouse tables (Trends, Funnels, etc.) receive"
+ " the same warnings as raw HogQL queries. Also carries access control"
+ " warnings when a system-table query filters out objects the user can't"
+ " access."
+ ),
+ )
+
+
class CachedMetricsQueryResponse(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -19357,6 +19425,59 @@ class MaxBillingContext(BaseModel):
usage_history: list[UsageHistoryItem] | None = None
+class MetricsHistogramQueryResponse(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ bounds: list[float] = Field(..., description="Upper bound per row (y axis), ascending.")
+ counts: list[list[float]] = Field(
+ ...,
+ description=("Observation count per cell: counts[row][column], row = bound, column = time."),
+ )
+ error: str | None = Field(
+ default=None,
+ description=(
+ "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise."
+ ),
+ )
+ hogql: str | None = Field(default=None, description="Generated HogQL query.")
+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ query_status: QueryStatus | None = Field(
+ default=None,
+ description=("Query status indicates whether next to the provided data, a query is still running."),
+ )
+ resolved_compare_date_range: ResolvedDateRangeResponse | None = Field(
+ default=None,
+ description=("The resolved previous/comparison period date range, when comparing against another period"),
+ )
+ resolved_date_range: ResolvedDateRangeResponse | None = Field(
+ default=None, description="The date range used for the query"
+ )
+ results: Any
+ times: list[str] = Field(..., description="Bucket start per column (x axis), ISO 8601, ascending.")
+ timings: list[QueryTiming] | None = Field(
+ default=None,
+ description=("Measured timings for different parts of the query generation process"),
+ )
+ used_data_warehouse_sources: list[DataWarehouseSourceUsage] | None = Field(
+ default=None,
+ description=("Connector-synced data warehouse sources referenced by this query, if any."),
+ )
+ warnings: list[DataWarehouseSyncWarning | AccessControlFilterWarning] | None = Field(
+ default=None,
+ description=(
+ "Warnings about data warehouse sources referenced by the query whose"
+ " latest sync failed, is paused, hit a billing limit, or is otherwise"
+ " stale. Results may not reflect current source data. Accumulated"
+ " across every HogQL execution that contributes to this response — so"
+ " insights backed by warehouse tables (Trends, Funnels, etc.) receive"
+ " the same warnings as raw HogQL queries. Also carries access control"
+ " warnings when a system-table query filters out objects the user can't"
+ " access."
+ ),
+ )
+
+
class MetricsQueryResponse(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -22670,6 +22791,59 @@ class QueryResponseAlternative74(BaseModel):
class QueryResponseAlternative75(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ bounds: list[float] = Field(..., description="Upper bound per row (y axis), ascending.")
+ counts: list[list[float]] = Field(
+ ...,
+ description=("Observation count per cell: counts[row][column], row = bound, column = time."),
+ )
+ error: str | None = Field(
+ default=None,
+ description=(
+ "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise."
+ ),
+ )
+ hogql: str | None = Field(default=None, description="Generated HogQL query.")
+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ query_status: QueryStatus | None = Field(
+ default=None,
+ description=("Query status indicates whether next to the provided data, a query is still running."),
+ )
+ resolved_compare_date_range: ResolvedDateRangeResponse | None = Field(
+ default=None,
+ description=("The resolved previous/comparison period date range, when comparing against another period"),
+ )
+ resolved_date_range: ResolvedDateRangeResponse | None = Field(
+ default=None, description="The date range used for the query"
+ )
+ results: Any
+ times: list[str] = Field(..., description="Bucket start per column (x axis), ISO 8601, ascending.")
+ timings: list[QueryTiming] | None = Field(
+ default=None,
+ description=("Measured timings for different parts of the query generation process"),
+ )
+ used_data_warehouse_sources: list[DataWarehouseSourceUsage] | None = Field(
+ default=None,
+ description=("Connector-synced data warehouse sources referenced by this query, if any."),
+ )
+ warnings: list[DataWarehouseSyncWarning | AccessControlFilterWarning] | None = Field(
+ default=None,
+ description=(
+ "Warnings about data warehouse sources referenced by the query whose"
+ " latest sync failed, is paused, hit a billing limit, or is otherwise"
+ " stale. Results may not reflect current source data. Accumulated"
+ " across every HogQL execution that contributes to this response — so"
+ " insights backed by warehouse tables (Trends, Funnels, etc.) receive"
+ " the same warnings as raw HogQL queries. Also carries access control"
+ " warnings when a system-table query filters out objects the user can't"
+ " access."
+ ),
+ )
+
+
+class QueryResponseAlternative76(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -22720,7 +22894,7 @@ class QueryResponseAlternative75(BaseModel):
)
-class QueryResponseAlternative76(BaseModel):
+class QueryResponseAlternative77(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -22771,7 +22945,7 @@ class QueryResponseAlternative76(BaseModel):
)
-class QueryResponseAlternative77(BaseModel):
+class QueryResponseAlternative78(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -22822,7 +22996,7 @@ class QueryResponseAlternative77(BaseModel):
)
-class QueryResponseAlternative78(BaseModel):
+class QueryResponseAlternative79(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -22873,7 +23047,7 @@ class QueryResponseAlternative78(BaseModel):
)
-class QueryResponseAlternative80(BaseModel):
+class QueryResponseAlternative81(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -22923,7 +23097,7 @@ class QueryResponseAlternative80(BaseModel):
)
-class QueryResponseAlternative81(BaseModel):
+class QueryResponseAlternative82(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -22973,7 +23147,7 @@ class QueryResponseAlternative81(BaseModel):
)
-class QueryResponseAlternative82(BaseModel):
+class QueryResponseAlternative83(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23020,7 +23194,7 @@ class QueryResponseAlternative82(BaseModel):
)
-class QueryResponseAlternative83(BaseModel):
+class QueryResponseAlternative84(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23071,7 +23245,7 @@ class QueryResponseAlternative83(BaseModel):
)
-class QueryResponseAlternative87(BaseModel):
+class QueryResponseAlternative88(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23118,7 +23292,7 @@ class QueryResponseAlternative87(BaseModel):
)
-class QueryResponseAlternative88(BaseModel):
+class QueryResponseAlternative89(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23165,7 +23339,7 @@ class QueryResponseAlternative88(BaseModel):
)
-class QueryResponseAlternative89(BaseModel):
+class QueryResponseAlternative90(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23222,7 +23396,7 @@ class QueryResponseAlternative89(BaseModel):
)
-class QueryResponseAlternative90(BaseModel):
+class QueryResponseAlternative91(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23277,7 +23451,7 @@ class QueryResponseAlternative90(BaseModel):
)
-class QueryResponseAlternative91(BaseModel):
+class QueryResponseAlternative92(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23324,7 +23498,7 @@ class QueryResponseAlternative91(BaseModel):
)
-class QueryResponseAlternative92(BaseModel):
+class QueryResponseAlternative93(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23376,7 +23550,7 @@ class QueryResponseAlternative92(BaseModel):
)
-class QueryResponseAlternative93(BaseModel):
+class QueryResponseAlternative94(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23423,7 +23597,7 @@ class QueryResponseAlternative93(BaseModel):
)
-class QueryResponseAlternative94(BaseModel):
+class QueryResponseAlternative95(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23470,7 +23644,7 @@ class QueryResponseAlternative94(BaseModel):
)
-class QueryResponseAlternative95(BaseModel):
+class QueryResponseAlternative96(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23517,7 +23691,7 @@ class QueryResponseAlternative95(BaseModel):
)
-class QueryResponseAlternative96(BaseModel):
+class QueryResponseAlternative97(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23564,7 +23738,7 @@ class QueryResponseAlternative96(BaseModel):
)
-class QueryResponseAlternative97(BaseModel):
+class QueryResponseAlternative98(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23615,7 +23789,7 @@ class QueryResponseAlternative97(BaseModel):
)
-class QueryResponseAlternative98(BaseModel):
+class QueryResponseAlternative99(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23662,7 +23836,7 @@ class QueryResponseAlternative98(BaseModel):
)
-class QueryResponseAlternative99(BaseModel):
+class QueryResponseAlternative100(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23709,7 +23883,7 @@ class QueryResponseAlternative99(BaseModel):
)
-class QueryResponseAlternative100(BaseModel):
+class QueryResponseAlternative101(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23756,7 +23930,7 @@ class QueryResponseAlternative100(BaseModel):
)
-class QueryResponseAlternative101(BaseModel):
+class QueryResponseAlternative102(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23806,7 +23980,7 @@ class QueryResponseAlternative101(BaseModel):
)
-class QueryResponseAlternative102(BaseModel):
+class QueryResponseAlternative103(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23853,7 +24027,7 @@ class QueryResponseAlternative102(BaseModel):
)
-class QueryResponseAlternative103(BaseModel):
+class QueryResponseAlternative104(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23904,7 +24078,7 @@ class QueryResponseAlternative103(BaseModel):
)
-class QueryResponseAlternative104(BaseModel):
+class QueryResponseAlternative105(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23951,7 +24125,7 @@ class QueryResponseAlternative104(BaseModel):
)
-class QueryResponseAlternative105(BaseModel):
+class QueryResponseAlternative106(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -23998,7 +24172,7 @@ class QueryResponseAlternative105(BaseModel):
)
-class QueryResponseAlternative106(BaseModel):
+class QueryResponseAlternative107(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -24045,7 +24219,7 @@ class QueryResponseAlternative106(BaseModel):
)
-class QueryResponseAlternative107(BaseModel):
+class QueryResponseAlternative108(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -24092,7 +24266,7 @@ class QueryResponseAlternative107(BaseModel):
)
-class QueryResponseAlternative108(BaseModel):
+class QueryResponseAlternative109(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -24139,7 +24313,7 @@ class QueryResponseAlternative108(BaseModel):
)
-class QueryResponseAlternative109(BaseModel):
+class QueryResponseAlternative110(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -24186,7 +24360,7 @@ class QueryResponseAlternative109(BaseModel):
)
-class QueryResponseAlternative110(BaseModel):
+class QueryResponseAlternative111(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -24233,7 +24407,7 @@ class QueryResponseAlternative110(BaseModel):
)
-class QueryResponseAlternative111(BaseModel):
+class QueryResponseAlternative112(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -24281,7 +24455,7 @@ class QueryResponseAlternative111(BaseModel):
)
-class QueryResponseAlternative112(BaseModel):
+class QueryResponseAlternative113(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -27960,6 +28134,28 @@ class MaxRecordingUniversalFilters(BaseModel):
)
+class MetricsHistogramQuery(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ dateRange: DateRange | None = Field(
+ default=None,
+ description=("Defaults to the last 24 hours when omitted; dashboard date filters override it"),
+ )
+ filters: list[MetricsQueryFilter] | None = None
+ interval: str | None = Field(default=None, description="Bucket size; auto-picked from the range when omitted")
+ kind: Literal["MetricsHistogramQuery"] = "MetricsHistogramQuery"
+ metricName: str
+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ response: MetricsHistogramQueryResponse | None = None
+ tags: QueryLogTags | None = None
+ unit: str | None = Field(
+ default=None,
+ description=('UCUM unit for the y-axis bounds, e.g. "s", "ms". Presentation only.'),
+ )
+ version: float | None = Field(default=None, description="version of the node, used for schema migrations")
+
+
class MetricsQuery(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -30799,7 +30995,7 @@ class QueryResponseAlternative(
| QueryResponseAlternative81
| QueryResponseAlternative82
| QueryResponseAlternative83
- | QueryResponseAlternative86
+ | QueryResponseAlternative84
| QueryResponseAlternative87
| QueryResponseAlternative88
| QueryResponseAlternative89
@@ -30826,6 +31022,7 @@ class QueryResponseAlternative(
| QueryResponseAlternative110
| QueryResponseAlternative111
| QueryResponseAlternative112
+ | QueryResponseAlternative113
]
):
root: (
@@ -30910,7 +31107,7 @@ class QueryResponseAlternative(
| QueryResponseAlternative81
| QueryResponseAlternative82
| QueryResponseAlternative83
- | QueryResponseAlternative86
+ | QueryResponseAlternative84
| QueryResponseAlternative87
| QueryResponseAlternative88
| QueryResponseAlternative89
@@ -30937,6 +31134,7 @@ class QueryResponseAlternative(
| QueryResponseAlternative110
| QueryResponseAlternative111
| QueryResponseAlternative112
+ | QueryResponseAlternative113
)
@@ -31879,6 +32077,7 @@ class HogQLAutocomplete(BaseModel):
| LogAttributesQuery
| LogValuesQuery
| MetricsQuery
+ | MetricsHistogramQuery
| TraceSpansQuery
| TraceSpansAggregationQuery
| TraceSpansTreeQuery
@@ -32005,6 +32204,7 @@ class HogQLMetadata(BaseModel):
| LogAttributesQuery
| LogValuesQuery
| MetricsQuery
+ | MetricsHistogramQuery
| TraceSpansQuery
| TraceSpansAggregationQuery
| TraceSpansTreeQuery
@@ -32151,6 +32351,7 @@ class MaxInsightContext(BaseModel):
| LogAttributesQuery
| LogValuesQuery
| MetricsQuery
+ | MetricsHistogramQuery
| TraceSpansQuery
| TraceSpansAggregationQuery
| TraceSpansTreeQuery
@@ -32293,6 +32494,7 @@ class QueryRequest(BaseModel):
| LogAttributesQuery
| LogValuesQuery
| MetricsQuery
+ | MetricsHistogramQuery
| TraceSpansQuery
| TraceSpansAggregationQuery
| TraceSpansTreeQuery
@@ -32427,6 +32629,7 @@ class QuerySchemaRoot(
| LogAttributesQuery
| LogValuesQuery
| MetricsQuery
+ | MetricsHistogramQuery
| TraceSpansQuery
| TraceSpansAggregationQuery
| TraceSpansTreeQuery
@@ -32531,6 +32734,7 @@ class QuerySchemaRoot(
| LogAttributesQuery
| LogValuesQuery
| MetricsQuery
+ | MetricsHistogramQuery
| TraceSpansQuery
| TraceSpansAggregationQuery
| TraceSpansTreeQuery
@@ -32640,6 +32844,7 @@ class QueryUpgradeRequest(BaseModel):
| LogAttributesQuery
| LogValuesQuery
| MetricsQuery
+ | MetricsHistogramQuery
| TraceSpansQuery
| TraceSpansAggregationQuery
| TraceSpansTreeQuery
@@ -32749,6 +32954,7 @@ class QueryUpgradeResponse(BaseModel):
| LogAttributesQuery
| LogValuesQuery
| MetricsQuery
+ | MetricsHistogramQuery
| TraceSpansQuery
| TraceSpansAggregationQuery
| TraceSpansTreeQuery
@@ -32903,6 +33109,7 @@ class VisualizationArtifactContent(BaseModel):
| LogAttributesQuery
| LogValuesQuery
| MetricsQuery
+ | MetricsHistogramQuery
| TraceSpansQuery
| TraceSpansAggregationQuery
| TraceSpansTreeQuery
diff --git a/posthog/schema_enums.py b/posthog/schema_enums.py
index 95465184718f..79deb5a0949d 100644
--- a/posthog/schema_enums.py
+++ b/posthog/schema_enums.py
@@ -2111,6 +2111,7 @@ class NodeKind(StrEnum):
LOG_ATTRIBUTES_QUERY = "LogAttributesQuery"
LOG_VALUES_QUERY = "LogValuesQuery"
METRICS_QUERY = "MetricsQuery"
+ METRICS_HISTOGRAM_QUERY = "MetricsHistogramQuery"
TRACE_SPANS_QUERY = "TraceSpansQuery"
TRACE_SPANS_AGGREGATION_QUERY = "TraceSpansAggregationQuery"
TRACE_SPANS_TREE_QUERY = "TraceSpansTreeQuery"
diff --git a/products/metrics/backend/facade/queries.py b/products/metrics/backend/facade/queries.py
index de9cdc0de13f..036477a08741 100644
--- a/products/metrics/backend/facade/queries.py
+++ b/products/metrics/backend/facade/queries.py
@@ -6,6 +6,7 @@ lazily at the dispatch site — this module pulls in HogQL machinery that must
stay off the `django.setup()` path.
"""
+from products.metrics.backend.hogql_queries.metrics_histogram_query_runner import MetricsHistogramQueryRunner
from products.metrics.backend.hogql_queries.metrics_query_runner import MetricsQueryRunner
-__all__ = ["MetricsQueryRunner"]
+__all__ = ["MetricsHistogramQueryRunner", "MetricsQueryRunner"]
diff --git a/products/metrics/backend/hogql_queries/metrics_histogram_query_runner.py b/products/metrics/backend/hogql_queries/metrics_histogram_query_runner.py
new file mode 100644
index 000000000000..1c6a2456f5a8
--- /dev/null
+++ b/products/metrics/backend/hogql_queries/metrics_histogram_query_runner.py
@@ -0,0 +1,222 @@
+"""Runner for the `MetricsHistogramQuery` schema node — a latency-over-time heatmap.
+
+The heavy lifting (per-series temporality/reset handling, per-time-bucket summed bucket-count
+distributions) is `MetricQueryRunner._build_histogram_query`; this runner reuses it and assembles
+the response into the grid the heatmap panel draws: one column per time bucket, one row per bucket
+upper bound, cell = observation count.
+"""
+
+import datetime as dt
+from datetime import datetime
+from typing import TYPE_CHECKING, Optional, cast
+
+from posthog.schema import (
+ CachedMetricsHistogramQueryResponse,
+ DashboardFilter,
+ DateRange,
+ MetricsHistogramQuery,
+ MetricsHistogramQueryResponse,
+)
+
+from posthog.hogql import ast
+from posthog.hogql.errors import ExposedHogQLError
+from posthog.hogql.query import execute_hogql_query
+
+from posthog.clickhouse.client.connection import Workload
+from posthog.hogql_queries.query_runner import AnalyticsQueryRunner
+from posthog.hogql_queries.utils.query_date_range import QueryDateRange
+from posthog.permissions import posthog_feature_flag_enabled
+from posthog.shared_link_user import SharedLinkUser
+
+from products.access_control.backend.facade.user_access_control import UserAccessControl, UserAccessControlError
+from products.metrics.backend.facade.contracts import METRICS_FEATURE_FLAG, MetricFilter
+from products.metrics.backend.facade.enums import AttributeScope, FilterOp
+from products.metrics.backend.metric_query_runner import (
+ _INTERVAL_LADDER,
+ _QUERY_SETTINGS,
+ MetricQueryRunner,
+ _interval_step,
+)
+
+if TYPE_CHECKING:
+ from posthog.models import User
+
+# Metrics dashboards are usually about "what is happening now", so the node
+# defaults to a tighter window than the analytics-wide -7d. Mirrors MetricsQueryRunner.
+DEFAULT_DATE_FROM = "-24h"
+
+# The grid materializes bounds x time columns of Python objects, so its size is
+# capped up front: an authenticated user could otherwise pair a fine interval
+# over a long range with many explicit histogram bounds and exhaust a query
+# worker's memory.
+MAX_GRID_CELLS = 250_000
+
+
+def _grid_time_key(value: datetime) -> str:
+ """The grid key for one bucket start. The histogram query emits datetimes
+ for most intervals but bare dates for week-or-longer buckets, so both
+ sides of the lookup normalize through ClickHouse's naive string form."""
+ return value.strftime("%Y-%m-%d %H:%M:%S")
+
+
+class MetricsHistogramQueryRunner(AnalyticsQueryRunner[MetricsHistogramQueryResponse]):
+ query: MetricsHistogramQuery
+ cached_response: CachedMetricsHistogramQueryResponse
+
+ def validate_query_runner_access(self, user: "User") -> bool:
+ user_access_control = UserAccessControl(user=user, team=self.team)
+ user_access_control.assert_access_level_for_resource("metrics", "viewer")
+ if not posthog_feature_flag_enabled(
+ METRICS_FEATURE_FLAG,
+ str(user.distinct_id),
+ organization_id=self.team.organization_id,
+ team_id=self.team.pk,
+ ):
+ raise UserAccessControlError("metrics", "viewer")
+ return True
+
+ def _enforce_alpha_gate_for_anonymous_viewers(self) -> None:
+ user = cast("Optional[User | SharedLinkUser]", self.user)
+ if user is None or not user.is_anonymous:
+ return
+ if not posthog_feature_flag_enabled(
+ METRICS_FEATURE_FLAG,
+ str(getattr(user, "distinct_id", None) or f"shared-viewer-{self.team.pk}"),
+ organization_id=self.team.organization_id,
+ team_id=self.team.pk,
+ ):
+ raise UserAccessControlError("metrics", "viewer")
+
+ def to_query(self) -> ast.SelectQuery | ast.SelectSetQuery:
+ raise NotImplementedError(
+ "MetricsHistogramQuery reuses MetricQueryRunner's histogram query; there is no single statement"
+ )
+
+ def _query_date_range(self) -> QueryDateRange:
+ date_range = DateRange(
+ date_from=(self.query.dateRange.date_from if self.query.dateRange else None) or DEFAULT_DATE_FROM,
+ date_to=self.query.dateRange.date_to if self.query.dateRange else None,
+ explicitDate=True,
+ )
+ return QueryDateRange(date_range=date_range, team=self.team, interval=None, now=datetime.now())
+
+ def _calculate(self) -> MetricsHistogramQueryResponse:
+ self._enforce_alpha_gate_for_anonymous_viewers()
+ date_range = self._query_date_range()
+ date_from = date_range.date_from()
+ date_to = date_range.date_to()
+
+ interval = self.query.interval or _INTERVAL_LADDER[0][0]
+ # Auto-pick the finest interval that keeps the bucket count sane when not pinned.
+ if self.query.interval is None:
+ span = date_to - date_from
+ for name, step, _ in _INTERVAL_LADDER:
+ if span / step <= 100:
+ interval = name
+ break
+ else:
+ interval = _INTERVAL_LADDER[-1][0]
+
+ filters = tuple(
+ MetricFilter(
+ key=f.key,
+ op=FilterOp(f.op.value),
+ value=f.value,
+ scope=AttributeScope(f.scope.value) if f.scope is not None else AttributeScope.AUTO,
+ )
+ for f in self.query.filters or []
+ )
+
+ try:
+ runner = MetricQueryRunner(
+ team=self.team,
+ metric_name=self.query.metricName,
+ aggregation="histogram_quantile",
+ date_from=date_from,
+ date_to=date_to,
+ filters=filters,
+ interval=interval,
+ quantile=0.5, # unused by the grid query; required by the constructor
+ )
+ except ValueError as exc:
+ # The runner signals user errors (inverted range, too-wide span, unknown
+ # interval, too many buckets) with ValueError; /query only exposes typed
+ # errors, so a bare ValueError would surface as a 500 instead of a 400.
+ raise ExposedHogQLError(str(exc)) from exc
+
+ # Reuse the per-bucket distribution query directly rather than the quantile post-processing.
+ query = runner._build_histogram_query()
+ response = execute_hogql_query(
+ query_type="MetricsHistogramQuery",
+ query=query,
+ team=self.team,
+ workload=Workload.LOGS,
+ settings=_QUERY_SETTINGS,
+ )
+ try:
+ runner._raise_on_truncation(response.results)
+ except ValueError as exc:
+ raise ExposedHogQLError(str(exc)) from exc
+
+ # The runner floors date_from onto the bucket grid in the team timezone and returns
+ # tz-aware bucket starts; rebuild the same grid so response rows land on columns exactly.
+ grid_start = runner.date_from
+ step = _interval_step(interval)
+
+ # Rows: (time, bounds, bounds_variants, counts). Bounds variants must agree (same rule
+ # as the quantile runner) or the grid has no stable y axis.
+ distinct_bounds = {tuple(variant) for row in response.results for variant in row[2] if variant}
+ if len(distinct_bounds) > 1:
+ raise ExposedHogQLError(
+ "histogram bounds differ across the selected time range; "
+ "narrow the query with filters so all series share one bucket layout"
+ )
+ bounds = sorted(distinct_bounds)[0] if distinct_bounds else []
+
+ # Assemble the grid: column per time bucket, row per bound, zero-filled.
+ # `runner.date_to` is exclusive, so the last column is the bucket whose
+ # start is strictly before it — a date_to that lands exactly on a bucket
+ # boundary adds no trailing zero column. Bucket starts key the columns in
+ # ClickHouse's naive string form because weekly rows come back as dates.
+ grid_times: list[str] = []
+ cursor = grid_start
+ while cursor < runner.date_to:
+ grid_times.append(cursor.isoformat())
+ cursor = cursor + step
+ time_index = {_grid_time_key(grid_start + i * step): i for i in range(len(grid_times))}
+
+ if len(bounds) * len(grid_times) > MAX_GRID_CELLS:
+ raise ExposedHogQLError(
+ f"heatmap grid would hold {len(bounds)} rows x {len(grid_times)} columns; "
+ "use a coarser interval, a narrower range, or fewer histogram bounds"
+ )
+
+ counts = [[0 for _ in grid_times] for _ in bounds]
+ for row in response.results:
+ time_val = row[0]
+ if isinstance(time_val, datetime):
+ time_key = _grid_time_key(time_val.astimezone(grid_start.tzinfo))
+ else:
+ # Week-or-longer buckets come back as bare dates.
+ time_key = dt.datetime.combine(time_val, dt.time.min).strftime("%Y-%m-%d %H:%M:%S")
+ column = time_index.get(time_key)
+ if column is None:
+ continue
+ row_bounds = list(row[1])
+ row_counts = list(row[3])
+ for bound_idx, bound in enumerate(row_bounds):
+ if bound_idx < len(bounds) and bounds[bound_idx] == bound and bound_idx < len(row_counts):
+ counts[bound_idx][column] += int(row_counts[bound_idx])
+
+ # The base response requires `results`; the heatmap grid lives in times/bounds/counts,
+ # so `results` is returned as null.
+ return MetricsHistogramQueryResponse(
+ results=None, times=grid_times, bounds=[float(b) for b in bounds], counts=counts
+ )
+
+ def apply_dashboard_filters(self, dashboard_filter: DashboardFilter) -> None:
+ if dashboard_filter.date_from or dashboard_filter.date_to:
+ self.query.dateRange = DateRange(
+ date_from=dashboard_filter.date_from,
+ date_to=dashboard_filter.date_to,
+ )
diff --git a/products/metrics/backend/tests/test_metrics_histogram_query_runner.py b/products/metrics/backend/tests/test_metrics_histogram_query_runner.py
new file mode 100644
index 000000000000..b69355cde2b3
--- /dev/null
+++ b/products/metrics/backend/tests/test_metrics_histogram_query_runner.py
@@ -0,0 +1,173 @@
+import datetime as dt
+
+from posthog.test.base import APIBaseTest, ClickhouseTestMixin
+
+from django.utils import timezone
+
+from parameterized import parameterized
+
+from posthog.schema import MetricsHistogramQuery
+
+from posthog.hogql.errors import ExposedHogQLError
+
+from posthog.models.personal_api_key import PersonalAPIKey
+from posthog.models.utils import generate_random_token_personal, hash_key_value
+
+from products.metrics.backend.hogql_queries.metrics_histogram_query_runner import MetricsHistogramQueryRunner
+from products.metrics.backend.tests._seeder import seed_metric, truncate_metrics_tables
+
+
+class TestMetricsHistogramQueryRunner(ClickhouseTestMixin, APIBaseTest):
+ CLASS_DATA_LEVEL_SETUP = True
+
+ BOUNDS = [0.1, 0.5, 1.0]
+
+ def setUp(self):
+ super().setUp()
+ truncate_metrics_tables()
+ self.anchor = (timezone.now() - dt.timedelta(minutes=30)).replace(second=0, microsecond=0)
+
+ def _seed_histogram(self, points_with_counts, temporality="delta", bounds=None, **kwargs):
+ for timestamp, counts in points_with_counts:
+ seed_metric(
+ team_id=self.team.id,
+ metric_name="latency",
+ metric_type="histogram",
+ aggregation_temporality=temporality,
+ histogram_bounds=bounds or self.BOUNDS,
+ histogram_counts=counts,
+ points=[(timestamp, 0.0)],
+ **kwargs,
+ )
+
+ def _run(self, **query_overrides):
+ overrides = {"interval": "minute", **query_overrides}
+ query = MetricsHistogramQuery(
+ metricName="latency",
+ dateRange=overrides.pop(
+ "dateRange",
+ {
+ "date_from": (self.anchor - dt.timedelta(minutes=1)).isoformat(),
+ "date_to": (self.anchor + dt.timedelta(minutes=2)).isoformat(),
+ "explicitDate": True,
+ },
+ ),
+ **overrides,
+ )
+ return MetricsHistogramQueryRunner(query=query, team=self.team).calculate()
+
+ def test_returns_a_time_by_bound_grid(self):
+ self._seed_histogram(
+ [
+ (self.anchor + dt.timedelta(seconds=0), [10, 10, 10, 0]),
+ (self.anchor + dt.timedelta(seconds=30), [10, 10, 10, 0]),
+ (self.anchor + dt.timedelta(minutes=1), [5, 5, 5, 0]),
+ ]
+ )
+
+ response = self._run()
+
+ self.assertEqual(response.bounds, self.BOUNDS)
+ # One column per minute bucket across the 3-minute window.
+ self.assertEqual(len(response.times), 3)
+ # counts is rows (bounds) x columns (times).
+ self.assertEqual(len(response.counts), len(self.BOUNDS))
+ for row in response.counts:
+ self.assertEqual(len(row), len(response.times))
+ # First minute: nothing (the samples land in the next two buckets).
+ self.assertEqual([response.counts[b][0] for b in range(len(self.BOUNDS))], [0, 0, 0])
+ # Second minute: two delta samples summing to [20, 20, 20].
+ self.assertEqual([response.counts[b][1] for b in range(len(self.BOUNDS))], [20, 20, 20])
+ # Third minute: one sample [5, 5, 5].
+ self.assertEqual([response.counts[b][2] for b in range(len(self.BOUNDS))], [5, 5, 5])
+
+ def test_empty_range_returns_empty_bounds_not_an_error(self):
+ response = self._run()
+ self.assertEqual(response.bounds, [])
+ self.assertEqual(response.counts, [])
+
+ def test_rejects_mixed_bucket_layouts(self):
+ self._seed_histogram([(self.anchor, [10, 0, 0, 0])], bounds=[0.1, 0.5, 1.0])
+ self._seed_histogram([(self.anchor, [10, 0, 0, 0])], bounds=[0.2, 1.0, 2.0])
+
+ with self.assertRaises(Exception):
+ self._run()
+
+ def test_no_trailing_column_when_date_to_sits_on_a_bucket_boundary(self):
+ # date_to is exclusive: a range ending exactly on a bucket start has no
+ # bucket starting at that instant, so the grid must not grow a zero column.
+ self._seed_histogram([(self.anchor, [10, 10, 10, 0])])
+
+ response = self._run(
+ dateRange={
+ "date_from": self.anchor.isoformat(),
+ "date_to": (self.anchor + dt.timedelta(minutes=3)).isoformat(),
+ "explicitDate": True,
+ }
+ )
+
+ self.assertEqual(len(response.times), 3)
+
+ def test_weekly_buckets_keep_their_counts(self):
+ monday = dt.datetime(2026, 9, 7, 0, 0, 0, tzinfo=dt.UTC)
+ self._seed_histogram([(monday + dt.timedelta(hours=3), [4, 4, 4, 0])])
+
+ response = self._run(
+ dateRange={
+ "date_from": (monday + dt.timedelta(hours=1)).isoformat(),
+ "date_to": (monday + dt.timedelta(weeks=2)).isoformat(),
+ "explicitDate": True,
+ },
+ interval="week",
+ )
+
+ self.assertEqual(len(response.times), 2)
+ # The first week's counts must land on a column, not be dropped by a
+ # date-vs-datetime key mismatch.
+ self.assertEqual([response.counts[b][0] for b in range(len(self.BOUNDS))], [4, 4, 4])
+
+ def test_rejects_a_cell_count_above_the_budget(self):
+ with self.assertRaises(Exception) as ctx:
+ self._run(
+ dateRange={
+ "date_from": (self.anchor - dt.timedelta(days=30)).isoformat(),
+ "date_to": self.anchor.isoformat(),
+ "explicitDate": True,
+ },
+ interval="minute",
+ )
+ self.assertIn("interval", str(ctx.exception).lower())
+
+ def test_invalid_range_surfaces_as_client_error_not_500(self):
+ with self.assertRaises(ExposedHogQLError):
+ self._run(
+ dateRange={
+ "date_from": self.anchor.isoformat(),
+ "date_to": (self.anchor - dt.timedelta(minutes=5)).isoformat(),
+ "explicitDate": True,
+ }
+ )
+
+ @parameterized.expand(
+ [
+ (["query:read"], 403),
+ (["query:read", "metrics:read"], 200),
+ ]
+ )
+ def test_query_endpoint_scope_parity_for_api_keys(self, scopes: list[str], expected_status: int) -> None:
+ value = generate_random_token_personal()
+ PersonalAPIKey.objects.create(label="test", user=self.user, secure_value=hash_key_value(value), scopes=scopes)
+
+ response = self.client.post(
+ f"/api/projects/{self.team.pk}/query/",
+ {
+ "query": {
+ "kind": "MetricsHistogramQuery",
+ "metricName": "latency",
+ "dateRange": {"date_from": "-24h"},
+ }
+ },
+ HTTP_AUTHORIZATION=f"Bearer {value}",
+ )
+
+ assert response.status_code == expected_status, response.json()
diff --git a/products/metrics/frontend/components/metricsViewerLogic.test.ts b/products/metrics/frontend/components/metricsViewerLogic.test.ts
index a094e8dd699d..71c53770a23c 100644
--- a/products/metrics/frontend/components/metricsViewerLogic.test.ts
+++ b/products/metrics/frontend/components/metricsViewerLogic.test.ts
@@ -396,27 +396,6 @@ describe('metricsViewerLogic', () => {
expect(logic.values.displayType).toBe('bargauge')
})
- // A group-by-requiring panel must not stay selected once nothing is grouped anymore:
- // the bar gauge would otherwise render a single bar for an ungrouped result.
- it('falls back to the default display when the last group-by is removed', () => {
- logic.actions.setMetricName('queue_depth')
- logic.actions.setGroupByKeys(['container'])
- logic.actions.setDisplayType('bargauge')
- expect(logic.values.displayType).toBe('bargauge')
-
- logic.actions.setGroupByKeys([])
- expect(logic.values.displayType).toBe('line')
- })
-
- it('keeps a group-by panel when a group-by is still present', () => {
- logic.actions.setMetricName('queue_depth')
- logic.actions.setGroupByKeys(['container'])
- logic.actions.setDisplayType('bargauge')
-
- logic.actions.setGroupByKeys(['namespace'])
- expect(logic.values.displayType).toBe('bargauge')
- })
-
it('carries the configured chart settings onto the saved node', () => {
logic.actions.setMetricName('queue_depth')
logic.actions.setDisplayType('bar')
diff --git a/products/metrics/frontend/nodes/MetricsHistogramQueryNode.tsx b/products/metrics/frontend/nodes/MetricsHistogramQueryNode.tsx
new file mode 100644
index 000000000000..8ca78a2150e2
--- /dev/null
+++ b/products/metrics/frontend/nodes/MetricsHistogramQueryNode.tsx
@@ -0,0 +1,56 @@
+import { BuiltLogic, LogicWrapper, useValues } from 'kea'
+import { useState } from 'react'
+
+import { SpinnerOverlay } from '@posthog/lemon-ui'
+
+import { useAttachedLogic } from 'lib/logic/scenes/useAttachedLogic'
+import { InsightErrorState } from 'scenes/insights/EmptyStates'
+
+import { dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'
+import { AnyResponseType, MetricsHistogramQuery, MetricsHistogramQueryResponse } from '~/queries/schema/schema-general'
+import { QueryContext } from '~/queries/types'
+
+import { HeatmapPanel } from '../panels/HeatmapPanel'
+
+let uniqueNode = 0
+
+/** Renders a `MetricsHistogramQuery` (a latency-over-time heatmap) wherever the generic `Query`
+ * component is used — saved insights, dashboard tiles, notebooks. */
+export function MetricsHistogramQueryNode(props: {
+ query: MetricsHistogramQuery
+ cachedResults?: AnyResponseType
+ context: QueryContext
+ attachTo?: LogicWrapper | BuiltLogic
+}): JSX.Element | null {
+ const { onData, loadPriority, dataNodeCollectionId } = props.context.insightProps ?? {}
+ const [key] = useState(() => `MetricsHistogramQueryNode.${uniqueNode++}`)
+ const logic = dataNodeLogic({
+ query: props.query,
+ key,
+ cachedResults: props.cachedResults,
+ loadPriority,
+ onData,
+ dataNodeCollectionId: dataNodeCollectionId ?? key,
+ })
+
+ useAttachedLogic(logic, props.attachTo)
+
+ const { response, responseLoading, responseError } = useValues(logic)
+ const histogram = response as MetricsHistogramQueryResponse | undefined
+ const unit = props.query.unit
+
+ return (
+ <div className="relative flex flex-col w-full h-full min-h-[200px]">
+ {responseError ? (
+ <InsightErrorState query={props.query} excludeDetail title={responseError} />
+ ) : histogram && histogram.times?.length ? (
+ <HeatmapPanel response={histogram} unit={unit} />
+ ) : !responseLoading ? (
+ <div className="flex-1 flex items-center justify-center text-secondary text-sm">
+ No data for this metric in the selected range.
+ </div>
+ ) : null}
+ {responseLoading && <SpinnerOverlay />}
+ </div>
+ )
+}
diff --git a/products/metrics/frontend/nodes/index.ts b/products/metrics/frontend/nodes/index.ts
index 26c4c0d9ec2c..42bb0e551f3b 100644
--- a/products/metrics/frontend/nodes/index.ts
+++ b/products/metrics/frontend/nodes/index.ts
@@ -1 +1,2 @@
+export { MetricsHistogramQueryNode } from './MetricsHistogramQueryNode'
export { MetricsQueryNode } from './MetricsQueryNode'
diff --git a/products/metrics/frontend/panels/HeatmapPanel.test.tsx b/products/metrics/frontend/panels/HeatmapPanel.test.tsx
new file mode 100644
index 000000000000..13ab3c5d15b4
--- /dev/null
+++ b/products/metrics/frontend/panels/HeatmapPanel.test.tsx
@@ -0,0 +1,67 @@
+import '@testing-library/jest-dom'
+
+import { cleanup, render, screen } from '@testing-library/react'
+
+import { ensureJsdom } from '@posthog/quill-charts/testing'
+
+import type { MetricsHistogramQueryResponse } from '~/queries/schema/schema-general'
+import { initKeaTests } from '~/test/init'
+
+import { HeatmapPanel } from './HeatmapPanel'
+
+const response = (overrides?: Partial<MetricsHistogramQueryResponse>): MetricsHistogramQueryResponse =>
+ ({
+ kind: 'MetricsHistogramQueryResponse',
+ times: ['2026-08-01T10:00:00Z', '2026-08-01T11:00:00Z'],
+ bounds: [0.1, 0.5, 1],
+ counts: [
+ [5, 3],
+ [2, 8],
+ [1, 0],
+ ],
+ ...overrides,
+ }) as MetricsHistogramQueryResponse
+
+describe('HeatmapPanel', () => {
+ beforeEach(() => {
+ ensureJsdom()
+ initKeaTests()
+ })
+
+ afterEach(() => cleanup())
+
+ it('renders the y-axis bounds formatted with the unit', () => {
+ render(<HeatmapPanel response={response()} unit="s" />)
+ expect(screen.getByText('100 ms')).toBeInTheDocument()
+ expect(screen.getByText('500 ms')).toBeInTheDocument()
+ expect(screen.getByText('1 s')).toBeInTheDocument()
+ })
+
+ it('renders the time columns', () => {
+ render(<HeatmapPanel response={response()} unit="s" />)
+ expect(screen.getByText('1 Aug 10:00')).toBeInTheDocument()
+ expect(screen.getByText('1 Aug 11:00')).toBeInTheDocument()
+ })
+
+ it('shows the empty state when no cell has a count', () => {
+ render(
+ <HeatmapPanel
+ response={response({
+ counts: [
+ [0, 0],
+ [0, 0],
+ [0, 0],
+ ],
+ })}
+ unit="s"
+ />
+ )
+ expect(screen.getByText(/No data for this metric/)).toBeInTheDocument()
+ })
+
+ it('formats bounds without a unit as compact numbers', () => {
+ render(<HeatmapPanel response={response({ bounds: [10, 2000] })} />)
+ expect(screen.getByText('10')).toBeInTheDocument()
+ expect(screen.getByText('2K')).toBeInTheDocument()
+ })
+})
diff --git a/products/metrics/frontend/panels/HeatmapPanel.tsx b/products/metrics/frontend/panels/HeatmapPanel.tsx
new file mode 100644
index 000000000000..6002ef20c5e3
--- /dev/null
+++ b/products/metrics/frontend/panels/HeatmapPanel.tsx
@@ -0,0 +1,60 @@
+import { useValues } from 'kea'
+import { useMemo } from 'react'
+
+import { Heatmap } from '@posthog/quill-charts'
+
+import { useChartTheme } from 'lib/charts/hooks'
+import { dayjs } from 'lib/dayjs'
+import { teamLogic } from 'scenes/teamLogic'
+
+import type { MetricsHistogramQueryResponse } from '~/queries/schema/schema-general'
+
+import { formatMetricValue } from './metricsUnits'
+
+/** A latency-over-time heatmap: x = time bucket, y = histogram bucket upper bound, cell =
+ * observation count. `yLabels[0]` is the bottom row (smallest bucket), so the response's
+ * ascending bounds map directly. */
+export function HeatmapPanel({
+ response,
+ unit,
+}: {
+ response: MetricsHistogramQueryResponse
+ unit?: string | undefined
+}): JSX.Element {
+ const { timezone } = useValues(teamLogic)
+ const theme = useChartTheme()
+
+ const xLabels = useMemo(
+ () => (response.times ?? []).map((t) => dayjs(t).tz(timezone).format('D MMM HH:mm')),
+ [response.times, timezone]
+ )
+ const yLabels = useMemo(
+ () => (response.bounds ?? []).map((b) => formatMetricValue(b, unit)),
+ [response.bounds, unit]
+ )
+ const cells = useMemo(() => response.counts ?? [], [response.counts])
+
+ const hasData = cells.some((row) => row.some((c) => c > 0))
+ if (!hasData) {
+ return (
+ <div className="flex h-full items-center justify-center text-secondary text-sm">
+ No data for this metric in the selected range.
+ </div>
+ )
+ }
+
+ return (
+ <div className="relative flex h-full w-full min-h-0 flex-col">
+ <Heatmap
+ xLabels={xLabels}
+ yLabels={yLabels}
+ cells={cells}
+ theme={theme}
+ tooltip={(ctx) => {
+ const col = ctx.dataIndex
+ return <span>{xLabels[col]}</span>
+ }}
+ />
+ </div>
+ )
+}
diff --git a/products/metrics/frontend/panels/metricsReduce.test.ts b/products/metrics/frontend/panels/metricsReduce.test.ts
index 8ec9c49879ae..4374770b11b7 100644
--- a/products/metrics/frontend/panels/metricsReduce.test.ts
+++ b/products/metrics/frontend/panels/metricsReduce.test.ts
@@ -127,4 +127,45 @@ describe('metricsReduce', () => {
expect(capReducers(['max', 'last'])).toEqual(['max', 'last'])
})
})
+
+ describe('seriesUnit', () => {
+ const oneSeries = (unit?: string): MetricsQuerySeries => ({ labels: {}, points: points([1]), unit })
+
+ it('prefers the display override over any series unit', () => {
+ expect(seriesUnit([oneSeries('ms')], 's')).toBe('s')
+ })
+
+ it('returns the shared unit when every series agrees', () => {
+ expect(seriesUnit([oneSeries('ms'), oneSeries('ms')], undefined)).toBe('ms')
+ })
+
+ it('returns undefined when series disagree, rather than picking the first', () => {
+ expect(seriesUnit([oneSeries('ms'), oneSeries('s')], undefined)).toBeUndefined()
+ })
+
+ it('ignores series without a unit when the rest agree', () => {
+ expect(seriesUnit([oneSeries('ms'), oneSeries(undefined)], undefined)).toBe('ms')
+ })
+
+ it('returns undefined when no series carries a unit', () => {
+ expect(seriesUnit([oneSeries(undefined)], undefined)).toBeUndefined()
+ })
+ })
+
+ describe('capReducers', () => {
+ it('deduplicates and caps the reducer list', () => {
+ expect(capReducers(['last', 'last', 'mean', 'min', 'max', 'sum', 'delta', 'mean'])).toEqual([
+ 'last',
+ 'mean',
+ 'min',
+ 'max',
+ 'sum',
+ 'delta',
+ ])
+ })
+
+ it('keeps a short list untouched', () => {
+ expect(capReducers(['max', 'last'])).toEqual(['max', 'last'])
+ })
+ })
})
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 607c5f431969..2085ce4cfeec 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -47887,6 +47887,52 @@ export namespace Schemas {
version?: number | null;
}
+ export interface MetricsHistogramQueryResponse {
+ /** Upper bound per row (y axis), ascending. */
+ bounds: number[];
+ /** Observation count per cell: counts[row][column], row = bound, column = time. */
+ counts: number[][];
+ /** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
+ error?: string | null;
+ /** Generated HogQL query. */
+ hogql?: string | null;
+ /** Modifiers used when performing the query */
+ modifiers?: HogQLQueryModifiers | null;
+ /** Query status indicates whether next to the provided data, a query is still running. */
+ query_status?: QueryStatus | null;
+ /** The resolved previous/comparison period date range, when comparing against another period */
+ resolved_compare_date_range?: ResolvedDateRangeResponse | null;
+ /** The date range used for the query */
+ resolved_date_range?: ResolvedDateRangeResponse | null;
+ results: unknown;
+ /** Bucket start per column (x axis), ISO 8601, ascending. */
+ times: string[];
+ /** Measured timings for different parts of the query generation process */
+ timings?: QueryTiming[] | null;
+ /** Connector-synced data warehouse sources referenced by this query, if any. */
+ used_data_warehouse_sources?: DataWarehouseSourceUsage[] | null;
+ /** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access. */
+ warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
+ }
+
+ export interface MetricsHistogramQuery {
+ /** Defaults to the last 24 hours when omitted; dashboard date filters override it */
+ dateRange?: DateRange | null;
+ filters?: MetricsQueryFilter[] | null;
+ /** Bucket size; auto-picked from the range when omitted */
+ interval?: string | null;
+ kind?: 'MetricsHistogramQuery';
+ metricName: string;
+ /** Modifiers used when performing the query */
+ modifiers?: HogQLQueryModifiers | null;
+ response?: MetricsHistogramQueryResponse | null;
+ tags?: QueryLogTags | null;
+ /** UCUM unit for the y-axis bounds, e.g. "s", "ms". Presentation only. */
+ unit?: string | null;
+ /** version of the node, used for schema migrations */
+ version?: number | null;
+ }
+
export type TraceOrderColumn = typeof TraceOrderColumn[keyof typeof TraceOrderColumn];
@@ -49353,7 +49399,7 @@ export namespace Schemas {
query: string;
response?: HogQLMetadataResponse | null;
/** Query within which "expr" and "template" are validated. Defaults to "select * from events" */
- sourceQuery?: EventsNode | ActionsNode | PersonsNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | MarketingAnalyticsAttributionQuery | MarketingAnalyticsAttributionPathsQuery | MarketingAnalyticsRetentionQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebAgentAnalyticsQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingFingerprintProjectionQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingReleasesQuery | ErrorTrackingIssueCorrelationQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | CalendarHeatmapQuery | RecordingsQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | AccountsTableQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPModelBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolCategoryMapQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | MCPMissingCapabilitiesQuery | null;
+ sourceQuery?: EventsNode | ActionsNode | PersonsNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | MarketingAnalyticsAttributionQuery | MarketingAnalyticsAttributionPathsQuery | MarketingAnalyticsRetentionQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebAgentAnalyticsQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingFingerprintProjectionQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingReleasesQuery | ErrorTrackingIssueCorrelationQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | MetricsHistogramQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | CalendarHeatmapQuery | RecordingsQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | AccountsTableQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPModelBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolCategoryMapQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | MCPMissingCapabilitiesQuery | null;
tags?: QueryLogTags | null;
/** Variables to be subsituted into the query */
variables?: HogQLMetadataVariables;
@@ -49379,7 +49425,7 @@ export namespace Schemas {
query: string;
response?: HogQLAutocompleteResponse | null;
/** Query in whose context to validate. */
- sourceQuery?: EventsNode | ActionsNode | PersonsNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | MarketingAnalyticsAttributionQuery | MarketingAnalyticsAttributionPathsQuery | MarketingAnalyticsRetentionQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebAgentAnalyticsQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingFingerprintProjectionQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingReleasesQuery | ErrorTrackingIssueCorrelationQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | CalendarHeatmapQuery | RecordingsQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | AccountsTableQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPModelBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolCategoryMapQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | MCPMissingCapabilitiesQuery | null;
+ sourceQuery?: EventsNode | ActionsNode | PersonsNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | MarketingAnalyticsAttributionQuery | MarketingAnalyticsAttributionPathsQuery | MarketingAnalyticsRetentionQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebAgentAnalyticsQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingFingerprintProjectionQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingReleasesQuery | ErrorTrackingIssueCorrelationQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | MetricsHistogramQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | CalendarHeatmapQuery | RecordingsQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | AccountsTableQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPModelBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolCategoryMapQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | MCPMissingCapabilitiesQuery | null;
/** Start position of the editor word */
startPosition: number;
tags?: QueryLogTags | null;
@@ -77129,7 +77175,7 @@ export namespace Schemas {
* ```
*
* For more details on HogQL queries, see the [PostHog HogQL documentation](/docs/hogql#api-access). */
- query: EventsNode | ActionsNode | PersonsNode | DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingFingerprintProjectionQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingReleasesQuery | ErrorTrackingIssueCorrelationQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebAgentAnalyticsQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | MarketingAnalyticsAttributionQuery | MarketingAnalyticsAttributionPathsQuery | MarketingAnalyticsRetentionQuery | DataVisualizationNode | DataTableNode | SavedInsightNode | InsightVizNode | TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | PathsV2Query | StickinessQuery | LifecycleQuery | FunnelCorrelationQuery | DatabaseSchemaQuery | RecordingsQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | AccountsTableQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPModelBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolCategoryMapQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | MCPMissingCapabilitiesQuery | PropertyValuesQuery;
+ query: EventsNode | ActionsNode | PersonsNode | DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingFingerprintProjectionQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingReleasesQuery | ErrorTrackingIssueCorrelationQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebAgentAnalyticsQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | MarketingAnalyticsAttributionQuery | MarketingAnalyticsAttributionPathsQuery | MarketingAnalyticsRetentionQuery | DataVisualizationNode | DataTableNode | SavedInsightNode | InsightVizNode | TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | PathsV2Query | StickinessQuery | LifecycleQuery | FunnelCorrelationQuery | DatabaseSchemaQuery | RecordingsQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | MetricsHistogramQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | AccountsTableQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPModelBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolCategoryMapQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | MCPMissingCapabilitiesQuery | PropertyValuesQuery;
/** Whether results should be calculated sync or async, and how much to rely on the cache:
* - `'blocking'` - calculate synchronously (returning only when the query is done), UNLESS there are very fresh results in the cache
* - `'async'` - kick off background calculation (returning immediately with a query status), UNLESS there are very fresh results in the cache
@@ -78926,6 +78972,34 @@ export namespace Schemas {
}
export interface QueryResponseAlternative75 {
+ /** Upper bound per row (y axis), ascending. */
+ bounds: number[];
+ /** Observation count per cell: counts[row][column], row = bound, column = time. */
+ counts: number[][];
+ /** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
+ error?: string | null;
+ /** Generated HogQL query. */
+ hogql?: string | null;
+ /** Modifiers used when performing the query */
+ modifiers?: HogQLQueryModifiers | null;
+ /** Query status indicates whether next to the provided data, a query is still running. */
+ query_status?: QueryStatus | null;
+ /** The resolved previous/comparison period date range, when comparing against another period */
+ resolved_compare_date_range?: ResolvedDateRangeResponse | null;
+ /** The date range used for the query */
+ resolved_date_range?: ResolvedDateRangeResponse | null;
+ results: unknown;
+ /** Bucket start per column (x axis), ISO 8601, ascending. */
+ times: string[];
+ /** Measured timings for different parts of the query generation process */
+ timings?: QueryTiming[] | null;
+ /** Connector-synced data warehouse sources referenced by this query, if any. */
+ used_data_warehouse_sources?: DataWarehouseSourceUsage[] | null;
+ /** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access. */
+ warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
+ }
+
+ export interface QueryResponseAlternative76 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
hasMore?: boolean | null;
@@ -78952,7 +79026,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative76 {
+ export interface QueryResponseAlternative77 {
/** Result rows for the comparison period when `compareFilter.compare` is true. */
compare?: AggregatedSpanRow[] | null;
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
@@ -78976,7 +79050,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative77 {
+ export interface QueryResponseAlternative78 {
/** Result rows for the comparison period when `compareFilter.compare` is true. */
compare?: SpanTreeNode[] | null;
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
@@ -79000,7 +79074,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative78 {
+ export interface QueryResponseAlternative79 {
/** Result rows for the comparison period when `compareFilter.compare` is true. */
compare?: AttributeBreakdownRow[] | null;
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
@@ -79024,13 +79098,13 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative79 {
+ export interface QueryResponseAlternative80 {
questions: string[];
/** Data warehouse sync warnings — see AnalyticsQueryResponseBase.warnings for semantics. */
warnings?: DataWarehouseSyncWarning[] | null;
}
- export interface QueryResponseAlternative80 {
+ export interface QueryResponseAlternative81 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
hasMore?: boolean | null;
@@ -79055,7 +79129,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative81 {
+ export interface QueryResponseAlternative82 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
hasMore?: boolean | null;
@@ -79080,7 +79154,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative82 {
+ export interface QueryResponseAlternative83 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79102,7 +79176,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative83 {
+ export interface QueryResponseAlternative84 {
columns?: string[] | null;
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
@@ -79128,7 +79202,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative86 {
+ export interface QueryResponseAlternative87 {
/** Timestamp of the newer trace */
newerTimestamp?: string | null;
/** ID of the newer trace (chronologically after current) */
@@ -79143,7 +79217,7 @@ export namespace Schemas {
warnings?: DataWarehouseSyncWarning[] | null;
}
- export interface QueryResponseAlternative87 {
+ export interface QueryResponseAlternative88 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79165,7 +79239,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative88 {
+ export interface QueryResponseAlternative89 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79187,7 +79261,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative89 {
+ export interface QueryResponseAlternative90 {
columns: unknown[];
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
@@ -79217,7 +79291,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative90 {
+ export interface QueryResponseAlternative91 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
hasMore: boolean;
@@ -79245,7 +79319,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative91 {
+ export interface QueryResponseAlternative92 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79267,7 +79341,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative92 {
+ export interface QueryResponseAlternative93 {
columns?: unknown[] | null;
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
@@ -79294,9 +79368,9 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export type QueryResponseAlternative93ResultsItem = { [key: string]: unknown };
+ export type QueryResponseAlternative94ResultsItem = { [key: string]: unknown };
- export interface QueryResponseAlternative93 {
+ export interface QueryResponseAlternative94 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79309,7 +79383,7 @@ export namespace Schemas {
resolved_compare_date_range?: ResolvedDateRangeResponse | null;
/** The date range used for the query */
resolved_date_range?: ResolvedDateRangeResponse | null;
- results: QueryResponseAlternative93ResultsItem[];
+ results: QueryResponseAlternative94ResultsItem[];
/** Measured timings for different parts of the query generation process */
timings?: QueryTiming[] | null;
/** Connector-synced data warehouse sources referenced by this query, if any. */
@@ -79318,7 +79392,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative94 {
+ export interface QueryResponseAlternative95 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79340,7 +79414,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative95 {
+ export interface QueryResponseAlternative96 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79362,7 +79436,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative96 {
+ export interface QueryResponseAlternative97 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79384,7 +79458,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative97 {
+ export interface QueryResponseAlternative98 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Whether another page of individual model identifiers is available. */
@@ -79408,7 +79482,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative98 {
+ export interface QueryResponseAlternative99 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79430,7 +79504,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative99 {
+ export interface QueryResponseAlternative100 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79452,7 +79526,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative100 {
+ export interface QueryResponseAlternative101 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79474,7 +79548,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative101 {
+ export interface QueryResponseAlternative102 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79497,7 +79571,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative102 {
+ export interface QueryResponseAlternative103 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79519,7 +79593,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative103 {
+ export interface QueryResponseAlternative104 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79543,7 +79617,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative104 {
+ export interface QueryResponseAlternative105 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79565,7 +79639,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative105 {
+ export interface QueryResponseAlternative106 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79587,7 +79661,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative106 {
+ export interface QueryResponseAlternative107 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79609,7 +79683,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative107 {
+ export interface QueryResponseAlternative108 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79631,7 +79705,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative108 {
+ export interface QueryResponseAlternative109 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79653,7 +79727,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative109 {
+ export interface QueryResponseAlternative110 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79675,7 +79749,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative110 {
+ export interface QueryResponseAlternative111 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79697,7 +79771,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative111 {
+ export interface QueryResponseAlternative112 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Whether more reports exist past this page. */
@@ -79721,7 +79795,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export interface QueryResponseAlternative112 {
+ export interface QueryResponseAlternative113 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -79743,7 +79817,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export type QueryResponseAlternative = { [key: string]: unknown } | QueryResponseAlternative1 | QueryResponseAlternative2 | QueryResponseAlternative3 | QueryResponseAlternative4 | QueryResponseAlternative5 | QueryResponseAlternative6 | QueryResponseAlternative7 | QueryResponseAlternative8 | QueryResponseAlternative9 | QueryResponseAlternative10 | QueryResponseAlternative11 | QueryResponseAlternative12 | QueryResponseAlternative13 | QueryResponseAlternative14 | QueryResponseAlternative15 | QueryResponseAlternative16 | QueryResponseAlternative17 | QueryResponseAlternative18 | QueryResponseAlternative19 | QueryResponseAlternative20 | QueryResponseAlternative21 | QueryResponseAlternative22 | QueryResponseAlternative23 | QueryResponseAlternative24 | QueryResponseAlternative25 | QueryResponseAlternative26 | QueryResponseAlternative28 | QueryResponseAlternative29 | QueryResponseAlternative30 | QueryResponseAlternative31 | QueryResponseAlternative32 | QueryResponseAlternative33 | QueryResponseAlternative34 | QueryResponseAlternative35 | QueryResponseAlternative36 | QueryResponseAlternative37 | unknown | QueryResponseAlternative38 | QueryResponseAlternative39 | QueryResponseAlternative40 | QueryResponseAlternative41 | QueryResponseAlternative42 | QueryResponseAlternative43 | QueryResponseAlternative44 | QueryResponseAlternative45 | QueryResponseAlternative46 | QueryResponseAlternative47 | QueryResponseAlternative48 | QueryResponseAlternative49 | QueryResponseAlternative50 | QueryResponseAlternative51 | QueryResponseAlternative52 | QueryResponseAlternative54 | QueryResponseAlternative55 | QueryResponseAlternative56 | QueryResponseAlternative58 | QueryResponseAlternative59 | QueryResponseAlternative60 | QueryResponseAlternative61 | QueryResponseAlternative62 | QueryResponseAlternative63 | QueryResponseAlternative64 | QueryResponseAlternative65 | QueryResponseAlternative66 | QueryResponseAlternative68 | QueryResponseAlternative69 | QueryResponseAlternative70 | QueryResponseAlternative71 | QueryResponseAlternative72 | QueryResponseAlternative73 | QueryResponseAlternative74 | QueryResponseAlternative75 | QueryResponseAlternative76 | QueryResponseAlternative77 | QueryResponseAlternative78 | QueryResponseAlternative79 | QueryResponseAlternative80 | QueryResponseAlternative81 | QueryResponseAlternative82 | QueryResponseAlternative83 | QueryResponseAlternative86 | QueryResponseAlternative87 | QueryResponseAlternative88 | QueryResponseAlternative89 | QueryResponseAlternative90 | QueryResponseAlternative91 | QueryResponseAlternative92 | QueryResponseAlternative93 | QueryResponseAlternative94 | QueryResponseAlternative95 | QueryResponseAlternative96 | QueryResponseAlternative97 | QueryResponseAlternative98 | QueryResponseAlternative99 | QueryResponseAlternative100 | QueryResponseAlternative101 | QueryResponseAlternative102 | QueryResponseAlternative103 | QueryResponseAlternative104 | QueryResponseAlternative105 | QueryResponseAlternative106 | QueryResponseAlternative107 | QueryResponseAlternative108 | QueryResponseAlternative109 | QueryResponseAlternative110 | QueryResponseAlternative111 | QueryResponseAlternative112;
+ export type QueryResponseAlternative = { [key: string]: unknown } | QueryResponseAlternative1 | QueryResponseAlternative2 | QueryResponseAlternative3 | QueryResponseAlternative4 | QueryResponseAlternative5 | QueryResponseAlternative6 | QueryResponseAlternative7 | QueryResponseAlternative8 | QueryResponseAlternative9 | QueryResponseAlternative10 | QueryResponseAlternative11 | QueryResponseAlternative12 | QueryResponseAlternative13 | QueryResponseAlternative14 | QueryResponseAlternative15 | QueryResponseAlternative16 | QueryResponseAlternative17 | QueryResponseAlternative18 | QueryResponseAlternative19 | QueryResponseAlternative20 | QueryResponseAlternative21 | QueryResponseAlternative22 | QueryResponseAlternative23 | QueryResponseAlternative24 | QueryResponseAlternative25 | QueryResponseAlternative26 | QueryResponseAlternative28 | QueryResponseAlternative29 | QueryResponseAlternative30 | QueryResponseAlternative31 | QueryResponseAlternative32 | QueryResponseAlternative33 | QueryResponseAlternative34 | QueryResponseAlternative35 | QueryResponseAlternative36 | QueryResponseAlternative37 | unknown | QueryResponseAlternative38 | QueryResponseAlternative39 | QueryResponseAlternative40 | QueryResponseAlternative41 | QueryResponseAlternative42 | QueryResponseAlternative43 | QueryResponseAlternative44 | QueryResponseAlternative45 | QueryResponseAlternative46 | QueryResponseAlternative47 | QueryResponseAlternative48 | QueryResponseAlternative49 | QueryResponseAlternative50 | QueryResponseAlternative51 | QueryResponseAlternative52 | QueryResponseAlternative54 | QueryResponseAlternative55 | QueryResponseAlternative56 | QueryResponseAlternative58 | QueryResponseAlternative59 | QueryResponseAlternative60 | QueryResponseAlternative61 | QueryResponseAlternative62 | QueryResponseAlternative63 | QueryResponseAlternative64 | QueryResponseAlternative65 | QueryResponseAlternative66 | QueryResponseAlternative68 | QueryResponseAlternative69 | QueryResponseAlternative70 | QueryResponseAlternative71 | QueryResponseAlternative72 | QueryResponseAlternative73 | QueryResponseAlternative74 | QueryResponseAlternative75 | QueryResponseAlternative76 | QueryResponseAlternative77 | QueryResponseAlternative78 | QueryResponseAlternative79 | QueryResponseAlternative80 | QueryResponseAlternative81 | QueryResponseAlternative82 | QueryResponseAlternative83 | QueryResponseAlternative84 | QueryResponseAlternative87 | QueryResponseAlternative88 | QueryResponseAlternative89 | QueryResponseAlternative90 | QueryResponseAlternative91 | QueryResponseAlternative92 | QueryResponseAlternative93 | QueryResponseAlternative94 | QueryResponseAlternative95 | QueryResponseAlternative96 | QueryResponseAlternative97 | QueryResponseAlternative98 | QueryResponseAlternative99 | QueryResponseAlternative100 | QueryResponseAlternative101 | QueryResponseAlternative102 | QueryResponseAlternative103 | QueryResponseAlternative104 | QueryResponseAlternative105 | QueryResponseAlternative106 | QueryResponseAlternative107 | QueryResponseAlternative108 | QueryResponseAlternative109 | QueryResponseAlternative110 | QueryResponseAlternative111 | QueryResponseAlternative112 | QueryResponseAlternative113;
export interface QueryScanResponse {
analysis?: QueryScanAnalysis | null;
@@ -79754,11 +79828,11 @@ export namespace Schemas {
}
export interface QueryUpgradeRequest {
- query: EventsNode | ActionsNode | PersonsNode | DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingFingerprintProjectionQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingReleasesQuery | ErrorTrackingIssueCorrelationQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebAgentAnalyticsQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | MarketingAnalyticsAttributionQuery | MarketingAnalyticsAttributionPathsQuery | MarketingAnalyticsRetentionQuery | DataVisualizationNode | DataTableNode | SavedInsightNode | InsightVizNode | TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | PathsV2Query | StickinessQuery | LifecycleQuery | FunnelCorrelationQuery | DatabaseSchemaQuery | RecordingsQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | AccountsTableQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPModelBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolCategoryMapQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | MCPMissingCapabilitiesQuery | PropertyValuesQuery;
+ query: EventsNode | ActionsNode | PersonsNode | DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingFingerprintProjectionQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingReleasesQuery | ErrorTrackingIssueCorrelationQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebAgentAnalyticsQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | MarketingAnalyticsAttributionQuery | MarketingAnalyticsAttributionPathsQuery | MarketingAnalyticsRetentionQuery | DataVisualizationNode | DataTableNode | SavedInsightNode | InsightVizNode | TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | PathsV2Query | StickinessQuery | LifecycleQuery | FunnelCorrelationQuery | DatabaseSchemaQuery | RecordingsQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | MetricsHistogramQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | AccountsTableQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPModelBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolCategoryMapQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | MCPMissingCapabilitiesQuery | PropertyValuesQuery;
}
export interface QueryUpgradeResponse {
- query: EventsNode | ActionsNode | PersonsNode | DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingFingerprintProjectionQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingReleasesQuery | ErrorTrackingIssueCorrelationQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebAgentAnalyticsQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | MarketingAnalyticsAttributionQuery | MarketingAnalyticsAttributionPathsQuery | MarketingAnalyticsRetentionQuery | DataVisualizationNode | DataTableNode | SavedInsightNode | InsightVizNode | TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | PathsV2Query | StickinessQuery | LifecycleQuery | FunnelCorrelationQuery | DatabaseSchemaQuery | RecordingsQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | AccountsTableQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPModelBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolCategoryMapQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | MCPMissingCapabilitiesQuery | PropertyValuesQuery;
+ query: EventsNode | ActionsNode | PersonsNode | DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingFingerprintProjectionQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingReleasesQuery | ErrorTrackingIssueCorrelationQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebAgentAnalyticsQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | MarketingAnalyticsAttributionQuery | MarketingAnalyticsAttributionPathsQuery | MarketingAnalyticsRetentionQuery | DataVisualizationNode | DataTableNode | SavedInsightNode | InsightVizNode | TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | PathsV2Query | StickinessQuery | LifecycleQuery | FunnelCorrelationQuery | DatabaseSchemaQuery | RecordingsQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | MetricsHistogramQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | AccountsTableQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPModelBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolCategoryMapQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | MCPMissingCapabilitiesQuery | PropertyValuesQuery;
}
export interface QuotaResourceLimit {