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.

fix(marketing-analytics): replace misleading freshness badge (#126289)

Javier Bahamondes1c6e18459835
diff --git a/common/storybook/storybook-timings.json b/common/storybook/storybook-timings.json
index d5bff975362a..77b7bac4409a 100644
--- a/common/storybook/storybook-timings.json
+++ b/common/storybook/storybook-timings.json
@@ -1155,10 +1155,6 @@
"chromium": 24.371,
"webkit": 3.82
},
- "frontend/src/scenes/marketing-analytics/MarketingAnalyticsFreshness.stories.tsx": {
- "chromium": 9.726,
- "webkit": 2.652
- },
"frontend/src/scenes/max/Max.stories.tsx": {
"chromium": 101.316,
"webkit": 23.702
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 75e131dff351..04350b3079bb 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -13598,14 +13598,10 @@ snapshots:
hash: v1.k794b7964.b73cdfebd90f08032a9bae75b882177b0820ef6b6b5fca62e4a9544c8bb71a44.mFeqRlSaFAONCXvFYM3lsPacPRQ5Wkypera3O6w4hbs
scenes-app-marketing-analytics-dismissible-setup-prompts--without-setup--light:
hash: v1.k794b7964.057e79150a4b1c174a9c18d862c57f376c602ea6514dc6b61a1ed2878e480ab5.gqZ8hB3FeD2bKbPduK0mfzBhgZzX8-o1TD17iWdG_rA
- scenes-app-marketing-analytics-freshness--behind--dark:
- hash: v1.k794b7964.24e00c5991fdda65218358c71de110f4e94c84f483b6b550225da1bf405f1511.76cXtLdLAt40yxKRi1qT71n8DdikUm3oiMTL8IWwDwI
- scenes-app-marketing-analytics-freshness--behind--light:
- hash: v1.k794b7964.b2d8e1c949197fcff85a43871f4a08868e399426f5b0deed1836de54f5694a4a.iJ0Icp8ZeVBvNrPdrwS1Zbq4yUADXJxuyRWy2YKQdnY
- scenes-app-marketing-analytics-freshness--fresh--dark:
- hash: v1.k794b7964.71ad45e65a5513ff7088e026d8ffb2bf891fb1effddb0e9dbd95ba78b597c3b1.0e6bNu95d2bH_NlZmGGW7oiHJ__aHNSxqzRcxMUA4xM
- scenes-app-marketing-analytics-freshness--fresh--light:
- hash: v1.k794b7964.b8d9453c270c310350d2bcf30cdb54cae4da19b8877e8d3206160478eb2dda94.dJpt6MIMxg7mOxiHC6PoqwTGwMfiGrln7SheHTKHTcU
+ scenes-app-marketing-analytics-freshness--computed--dark:
+ hash: v1.k794b7964.90967ba2970502957dfc2ac148e5e7b5983cdead8f9ed65f6c88b633aa40b47f.fv8wRnqQIa9AJ-YrUciGVNniE6TNH90dQXtFGe4zYuA
+ scenes-app-marketing-analytics-freshness--computed--light:
+ hash: v1.k794b7964.9b48285ee94821b59c9f04f5dc8ce000d26f8347494271afc19210f456c0b266.0rTIN2xVUydlLJ_9ZgeDX30gzApEJN_sOm4OIRnsaX0
scenes-app-marketing-analytics-metric-cells--clickable-and-static--dark:
hash: v1.k794b7964.f9b440217e994a034cd41b83c7ce116d3f80c8ffe0a713e478f571d6d3a17523.nVNlflYTiAcXYQ-MYXqFWg3XELCQxOiOIbqp-I6G8pE
scenes-app-marketing-analytics-metric-cells--clickable-and-static--light:
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index c89cfaf18256..bd3f35dd3d7f 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -12691,7 +12691,7 @@
"type": "string"
},
"dataComputedAt": {
- "description": "ISO timestamp of the oldest precompute window backing this result — surfaced as \"data as of X\".",
+ "description": "ISO timestamp of the oldest precompute window backing this result.",
"type": "string"
},
"error": {
@@ -12709,6 +12709,10 @@
"format": "date-time",
"type": "string"
},
+ "latestDayComputedAt": {
+ "description": "ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp.",
+ "type": "string"
+ },
"modifiers": {
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
@@ -13474,7 +13478,7 @@
"type": "array"
},
"dataComputedAt": {
- "description": "ISO timestamp of the oldest precompute window backing this result — surfaced as \"data as of X\".",
+ "description": "ISO timestamp of the oldest precompute window backing this result.",
"type": "string"
},
"error": {
@@ -13495,6 +13499,10 @@
"format": "date-time",
"type": "string"
},
+ "latestDayComputedAt": {
+ "description": "ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp.",
+ "type": "string"
+ },
"limit": {
"$ref": "#/definitions/integer"
},
@@ -20498,7 +20506,7 @@
"type": "array"
},
"dataComputedAt": {
- "description": "ISO timestamp of the oldest precompute window backing this result — surfaced as \"data as of X\".",
+ "description": "ISO timestamp of the oldest precompute window backing this result.",
"type": "string"
},
"error": {
@@ -20512,6 +20520,10 @@
"description": "Generated HogQL query.",
"type": "string"
},
+ "latestDayComputedAt": {
+ "description": "ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp.",
+ "type": "string"
+ },
"limit": {
"$ref": "#/definitions/integer"
},
@@ -20590,7 +20602,7 @@
"additionalProperties": false,
"properties": {
"dataComputedAt": {
- "description": "ISO timestamp of the oldest precompute window backing this result — surfaced as \"data as of X\".",
+ "description": "ISO timestamp of the oldest precompute window backing this result.",
"type": "string"
},
"error": {
@@ -20601,6 +20613,10 @@
"description": "Generated HogQL query.",
"type": "string"
},
+ "latestDayComputedAt": {
+ "description": "ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp.",
+ "type": "string"
+ },
"modifiers": {
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
@@ -35474,7 +35490,7 @@
"additionalProperties": false,
"properties": {
"dataComputedAt": {
- "description": "ISO timestamp of the oldest precompute window backing this result — surfaced as \"data as of X\".",
+ "description": "ISO timestamp of the oldest precompute window backing this result.",
"type": "string"
},
"error": {
@@ -35485,6 +35501,10 @@
"description": "Generated HogQL query.",
"type": "string"
},
+ "latestDayComputedAt": {
+ "description": "ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp.",
+ "type": "string"
+ },
"modifiers": {
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
@@ -37285,7 +37305,7 @@
"type": "array"
},
"dataComputedAt": {
- "description": "ISO timestamp of the oldest precompute window backing this result — surfaced as \"data as of X\".",
+ "description": "ISO timestamp of the oldest precompute window backing this result.",
"type": "string"
},
"error": {
@@ -37299,6 +37319,10 @@
"description": "Generated HogQL query.",
"type": "string"
},
+ "latestDayComputedAt": {
+ "description": "ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp.",
+ "type": "string"
+ },
"limit": {
"$ref": "#/definitions/integer"
},
@@ -45032,7 +45056,7 @@
"type": "array"
},
"dataComputedAt": {
- "description": "ISO timestamp of the oldest precompute window backing this result — surfaced as \"data as of X\".",
+ "description": "ISO timestamp of the oldest precompute window backing this result.",
"type": "string"
},
"error": {
@@ -45046,6 +45070,10 @@
"description": "Generated HogQL query.",
"type": "string"
},
+ "latestDayComputedAt": {
+ "description": "ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp.",
+ "type": "string"
+ },
"limit": {
"$ref": "#/definitions/integer"
},
@@ -45124,7 +45152,7 @@
"additionalProperties": false,
"properties": {
"dataComputedAt": {
- "description": "ISO timestamp of the oldest precompute window backing this result — surfaced as \"data as of X\".",
+ "description": "ISO timestamp of the oldest precompute window backing this result.",
"type": "string"
},
"error": {
@@ -45135,6 +45163,10 @@
"description": "Generated HogQL query.",
"type": "string"
},
+ "latestDayComputedAt": {
+ "description": "ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp.",
+ "type": "string"
+ },
"modifiers": {
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
@@ -46751,7 +46783,7 @@
"type": "array"
},
"dataComputedAt": {
- "description": "ISO timestamp of the oldest precompute window backing this result — surfaced as \"data as of X\".",
+ "description": "ISO timestamp of the oldest precompute window backing this result.",
"type": "string"
},
"error": {
@@ -46765,6 +46797,10 @@
"description": "Generated HogQL query.",
"type": "string"
},
+ "latestDayComputedAt": {
+ "description": "ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp.",
+ "type": "string"
+ },
"limit": {
"$ref": "#/definitions/integer"
},
@@ -46843,7 +46879,7 @@
"additionalProperties": false,
"properties": {
"dataComputedAt": {
- "description": "ISO timestamp of the oldest precompute window backing this result — surfaced as \"data as of X\".",
+ "description": "ISO timestamp of the oldest precompute window backing this result.",
"type": "string"
},
"error": {
@@ -46854,6 +46890,10 @@
"description": "Generated HogQL query.",
"type": "string"
},
+ "latestDayComputedAt": {
+ "description": "ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp.",
+ "type": "string"
+ },
"modifiers": {
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index 56acb55ce56a..dc2984016e35 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -8126,8 +8126,12 @@ export interface MarketingAnalyticsTableQueryResponse extends AnalyticsQueryResp
/** True when a conversion goal's precompute has not been warmed for this window yet — the UI shows a
* "computing" state rather than empty results. Marketing analytics serves exclusively from precompute. */
precomputeNotReady?: boolean
- /** ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X". */
+ /** ISO timestamp of the oldest precompute window backing this result. */
dataComputedAt?: string
+ /** ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or
+ * later. It is the oldest stamp among the precompute windows that hold that day, across costs and
+ * conversion goals. Unset when no precompute was read or a window has no stamp. */
+ latestDayComputedAt?: string
}
export type CachedMarketingAnalyticsTableQueryResponse = CachedQueryResponse<MarketingAnalyticsTableQueryResponse>
@@ -8139,8 +8143,12 @@ export interface MarketingAnalyticsAggregatedQueryResponse extends AnalyticsQuer
/** True when a conversion goal's precompute has not been warmed for this window yet — the UI shows a
* "computing" state rather than empty results. Marketing analytics serves exclusively from precompute. */
precomputeNotReady?: boolean
- /** ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X". */
+ /** ISO timestamp of the oldest precompute window backing this result. */
dataComputedAt?: string
+ /** ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or
+ * later. It is the oldest stamp among the precompute windows that hold that day, across costs and
+ * conversion goals. Unset when no precompute was read or a window has no stamp. */
+ latestDayComputedAt?: string
}
export type CachedMarketingAnalyticsAggregatedQueryResponse =
diff --git a/frontend/src/scenes/marketing-analytics/MarketingAnalyticsFreshness.stories.tsx b/frontend/src/scenes/marketing-analytics/MarketingAnalyticsFreshness.stories.tsx
index 522680df8dbf..82e4baf2342e 100644
--- a/frontend/src/scenes/marketing-analytics/MarketingAnalyticsFreshness.stories.tsx
+++ b/frontend/src/scenes/marketing-analytics/MarketingAnalyticsFreshness.stories.tsx
@@ -11,11 +11,7 @@ const meta: Meta<typeof MarketingAnalyticsFreshness> = {
}
export default meta
-// Within the ~2h refresh window: neutral clock badge.
-export const Fresh: Story = { args: { computedAt: '2025-02-15T11:40:00Z' } }
+export const Computed: Story = { args: { latestDayComputedAt: '2025-02-15T11:40:00Z' } }
-// Older than the refresh window (warmer behind): warning badge.
-export const Behind: Story = { args: { computedAt: '2025-02-15T07:00:00Z' } }
-
-// No precompute freshness known: renders nothing, so there is nothing to snapshot.
-export const Unknown: Story = { args: { computedAt: null }, tags: ['test-skip'] }
+// No latest-day stamp known: renders nothing, so there is nothing to snapshot.
+export const Unknown: Story = { args: { latestDayComputedAt: null }, tags: ['test-skip'] }
diff --git a/frontend/src/scenes/marketing-analytics/MarketingAnalyticsFreshness.tsx b/frontend/src/scenes/marketing-analytics/MarketingAnalyticsFreshness.tsx
index 089de6c47934..8c565973580e 100644
--- a/frontend/src/scenes/marketing-analytics/MarketingAnalyticsFreshness.tsx
+++ b/frontend/src/scenes/marketing-analytics/MarketingAnalyticsFreshness.tsx
@@ -1,50 +1,32 @@
-import { IconClock, IconWarning } from '@posthog/icons'
+import { IconClock } from '@posthog/icons'
import { TZLabel } from 'lib/components/TZLabel'
-import { dayjs } from 'lib/dayjs'
-import { LemonButton } from 'lib/lemon-ui/LemonButton'
+import { LemonTag } from 'lib/lemon-ui/LemonTag'
import { Tooltip } from 'lib/lemon-ui/Tooltip'
-// Marketing analytics serves from precomputed data refreshed by the hourly warmer, so the numbers can
-// trail live by up to ~2 hours. Past that the warmer is likely behind, so the badge switches to a warning.
-const STALE_WARNING_HOURS = 2
-
-export function MarketingAnalyticsFreshness({ computedAt }: { computedAt: string | null }): JSX.Element | null {
- if (!computedAt) {
+export function MarketingAnalyticsFreshness({
+ latestDayComputedAt,
+}: {
+ latestDayComputedAt: string | null
+}): JSX.Element | null {
+ if (!latestDayComputedAt) {
return null
}
- const behindByHours = dayjs().diff(dayjs(computedAt), 'hour')
- const isBehind = behindByHours >= STALE_WARNING_HOURS
-
return (
<Tooltip
title={
<div className="flex flex-col gap-1">
- <span>
- {isBehind
- ? 'Marketing analytics refreshes about once an hour. This data is older than that, so the refresh is running behind.'
- : 'Marketing analytics refreshes about once an hour, so numbers can be up to 2 hours old.'}
- </span>
- <div className="flex items-center gap-1">
- <span>Data from</span>
- <TZLabel time={computedAt} showPopover={false} />
- </div>
+ <span>The numbers for the most recent day in this range were computed at this time or later.</span>
+ <span>Ad spend also depends on when your data warehouse source last synced.</span>
+ <TZLabel time={latestDayComputedAt} timestampStyle="absolute" showPopover={false} />
</div>
}
>
- <LemonButton
- icon={isBehind ? <IconWarning /> : <IconClock />}
- status={isBehind ? 'danger' : 'default'}
- type="secondary"
- size="small"
- // Informational only: keep it out of the tab order but labelled for screen readers.
- tabIndex={-1}
- aria-label="Marketing analytics data freshness"
- data-attr="marketing-analytics-freshness"
- >
- Updated hourly
- </LemonButton>
+ <LemonTag type="muted" icon={<IconClock />} data-attr="marketing-analytics-freshness">
+ <span>Computed&nbsp;</span>
+ <TZLabel time={latestDayComputedAt} showPopover={false} noStyles />
+ </LemonTag>
</Tooltip>
)
}
diff --git a/frontend/src/scenes/marketing-analytics/useMarketingAnalyticsPrecompute.ts b/frontend/src/scenes/marketing-analytics/useMarketingAnalyticsPrecompute.ts
index feddd84d0740..72fd5fa8a316 100644
--- a/frontend/src/scenes/marketing-analytics/useMarketingAnalyticsPrecompute.ts
+++ b/frontend/src/scenes/marketing-analytics/useMarketingAnalyticsPrecompute.ts
@@ -8,8 +8,8 @@ import { InsightLogicProps } from '~/types'
export interface MarketingAnalyticsPrecomputeStatus {
/** The window this read asked for has not been warmed yet. */
notReady: boolean
- /** ISO timestamp of the oldest precompute window behind the result, or null when nothing was read. */
- computedAt: string | null
+ /** When the numbers for the latest day in the range were computed, or null when unknown. */
+ latestDayComputedAt: string | null
}
/** The precompute-only signals a marketing analytics response carries.
@@ -29,10 +29,10 @@ export function useMarketingAnalyticsPrecompute(
dataNodeCollectionId: insightProps.dataNodeCollectionId,
})
)
- const precomputeResponse = response as { precomputeNotReady?: boolean; dataComputedAt?: string } | null
+ const precomputeResponse = response as { precomputeNotReady?: boolean; latestDayComputedAt?: string } | null
return {
notReady: !responseLoading && precomputeResponse?.precomputeNotReady === true,
- computedAt: precomputeResponse?.dataComputedAt ?? null,
+ latestDayComputedAt: precomputeResponse?.latestDayComputedAt ?? null,
}
}
diff --git a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/components/MarketingAnalyticsTable/MarketingAnalyticsTable.tsx b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/components/MarketingAnalyticsTable/MarketingAnalyticsTable.tsx
index a623b3e105c4..224a27e864d8 100644
--- a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/components/MarketingAnalyticsTable/MarketingAnalyticsTable.tsx
+++ b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/components/MarketingAnalyticsTable/MarketingAnalyticsTable.tsx
@@ -85,7 +85,7 @@ export const MarketingAnalyticsTable = ({
() => conversionRecordingsTableQuery(query, !!hasConversionRecordings && !isSharedView()),
[query, hasConversionRecordings]
)
- const { notReady: precomputeNotReady, computedAt } = useMarketingAnalyticsPrecompute(
+ const { notReady: precomputeNotReady, latestDayComputedAt } = useMarketingAnalyticsPrecompute(
tableQuery.source,
insightProps
)
@@ -230,8 +230,8 @@ export const MarketingAnalyticsTable = ({
<IconInfo className="text-xl text-secondary" />
</Tooltip>
</div>
- <div className="flex items-center gap-2">
- <MarketingAnalyticsFreshness computedAt={computedAt} />
+ <div className="flex flex-wrap items-center gap-2">
+ <MarketingAnalyticsFreshness latestDayComputedAt={latestDayComputedAt} />
<LemonButton type="secondary" icon={<IconGear />} onClick={showColumnConfigModal}>
Configure columns
</LemonButton>
diff --git a/posthog/schema.py b/posthog/schema.py
index ce2ed635e2e3..0eeb559c34ff 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -14513,7 +14513,7 @@ class CachedMarketingAnalyticsAggregatedQueryResponse(BaseModel):
)
dataComputedAt: str | None = Field(
default=None,
- description=('ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X".'),
+ description=("ISO timestamp of the oldest precompute window backing this result."),
)
error: str | None = Field(
default=None,
@@ -14524,6 +14524,15 @@ class CachedMarketingAnalyticsAggregatedQueryResponse(BaseModel):
hogql: str | None = Field(default=None, description="Generated HogQL query.")
is_cached: bool
last_refresh: AwareDatetime
+ latestDayComputedAt: str | None = Field(
+ default=None,
+ description=(
+ "ISO timestamp of when the numbers for the most recent day in the range"
+ " were computed, at this time or later. It is the oldest stamp among the"
+ " precompute windows that hold that day, across costs and conversion goals."
+ " Unset when no precompute was read or a window has no stamp."
+ ),
+ )
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
next_allowed_client_refresh: AwareDatetime
precomputeNotReady: bool | None = Field(
@@ -14970,7 +14979,7 @@ class CachedMarketingAnalyticsTableQueryResponse(BaseModel):
columns: list | None = None
dataComputedAt: str | None = Field(
default=None,
- description=('ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X".'),
+ description=("ISO timestamp of the oldest precompute window backing this result."),
)
error: str | None = Field(
default=None,
@@ -14982,6 +14991,15 @@ class CachedMarketingAnalyticsTableQueryResponse(BaseModel):
hogql: str | None = Field(default=None, description="Generated HogQL query.")
is_cached: bool
last_refresh: AwareDatetime
+ latestDayComputedAt: str | None = Field(
+ default=None,
+ description=(
+ "ISO timestamp of when the numbers for the most recent day in the range"
+ " were computed, at this time or later. It is the oldest stamp among the"
+ " precompute windows that hold that day, across costs and conversion goals."
+ " Unset when no precompute was read or a window has no stamp."
+ ),
+ )
limit: int | None = None
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
next_allowed_client_refresh: AwareDatetime
@@ -18138,7 +18156,7 @@ class Response12(BaseModel):
columns: list | None = None
dataComputedAt: str | None = Field(
default=None,
- description=('ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X".'),
+ description=("ISO timestamp of the oldest precompute window backing this result."),
)
error: str | None = Field(
default=None,
@@ -18148,6 +18166,15 @@ class Response12(BaseModel):
)
hasMore: bool | None = None
hogql: str | None = Field(default=None, description="Generated HogQL query.")
+ latestDayComputedAt: str | None = Field(
+ default=None,
+ description=(
+ "ISO timestamp of when the numbers for the most recent day in the range"
+ " were computed, at this time or later. It is the oldest stamp among the"
+ " precompute windows that hold that day, across costs and conversion goals."
+ " Unset when no precompute was read or a window has no stamp."
+ ),
+ )
limit: int | None = None
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
offset: int | None = None
@@ -18202,7 +18229,7 @@ class Response13(BaseModel):
)
dataComputedAt: str | None = Field(
default=None,
- description=('ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X".'),
+ description=("ISO timestamp of the oldest precompute window backing this result."),
)
error: str | None = Field(
default=None,
@@ -18211,6 +18238,15 @@ class Response13(BaseModel):
),
)
hogql: str | None = Field(default=None, description="Generated HogQL query.")
+ latestDayComputedAt: str | None = Field(
+ default=None,
+ description=(
+ "ISO timestamp of when the numbers for the most recent day in the range"
+ " were computed, at this time or later. It is the oldest stamp among the"
+ " precompute windows that hold that day, across costs and conversion goals."
+ " Unset when no precompute was read or a window has no stamp."
+ ),
+ )
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
precomputeNotReady: bool | None = Field(
default=None,
@@ -20826,7 +20862,7 @@ class MarketingAnalyticsAggregatedQueryResponse(BaseModel):
)
dataComputedAt: str | None = Field(
default=None,
- description=('ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X".'),
+ description=("ISO timestamp of the oldest precompute window backing this result."),
)
error: str | None = Field(
default=None,
@@ -20835,6 +20871,15 @@ class MarketingAnalyticsAggregatedQueryResponse(BaseModel):
),
)
hogql: str | None = Field(default=None, description="Generated HogQL query.")
+ latestDayComputedAt: str | None = Field(
+ default=None,
+ description=(
+ "ISO timestamp of when the numbers for the most recent day in the range"
+ " were computed, at this time or later. It is the oldest stamp among the"
+ " precompute windows that hold that day, across costs and conversion goals."
+ " Unset when no precompute was read or a window has no stamp."
+ ),
+ )
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
precomputeNotReady: bool | None = Field(
default=None,
@@ -21193,7 +21238,7 @@ class MarketingAnalyticsTableQueryResponse(BaseModel):
columns: list | None = None
dataComputedAt: str | None = Field(
default=None,
- description=('ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X".'),
+ description=("ISO timestamp of the oldest precompute window backing this result."),
)
error: str | None = Field(
default=None,
@@ -21203,6 +21248,15 @@ class MarketingAnalyticsTableQueryResponse(BaseModel):
)
hasMore: bool | None = None
hogql: str | None = Field(default=None, description="Generated HogQL query.")
+ latestDayComputedAt: str | None = Field(
+ default=None,
+ description=(
+ "ISO timestamp of when the numbers for the most recent day in the range"
+ " were computed, at this time or later. It is the oldest stamp among the"
+ " precompute windows that hold that day, across costs and conversion goals."
+ " Unset when no precompute was read or a window has no stamp."
+ ),
+ )
limit: int | None = None
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
offset: int | None = None
@@ -22886,7 +22940,7 @@ class QueryResponseAlternative33(BaseModel):
columns: list | None = None
dataComputedAt: str | None = Field(
default=None,
- description=('ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X".'),
+ description=("ISO timestamp of the oldest precompute window backing this result."),
)
error: str | None = Field(
default=None,
@@ -22896,6 +22950,15 @@ class QueryResponseAlternative33(BaseModel):
)
hasMore: bool | None = None
hogql: str | None = Field(default=None, description="Generated HogQL query.")
+ latestDayComputedAt: str | None = Field(
+ default=None,
+ description=(
+ "ISO timestamp of when the numbers for the most recent day in the range"
+ " were computed, at this time or later. It is the oldest stamp among the"
+ " precompute windows that hold that day, across costs and conversion goals."
+ " Unset when no precompute was read or a window has no stamp."
+ ),
+ )
limit: int | None = None
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
offset: int | None = None
@@ -22950,7 +23013,7 @@ class QueryResponseAlternative34(BaseModel):
)
dataComputedAt: str | None = Field(
default=None,
- description=('ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X".'),
+ description=("ISO timestamp of the oldest precompute window backing this result."),
)
error: str | None = Field(
default=None,
@@ -22959,6 +23022,15 @@ class QueryResponseAlternative34(BaseModel):
),
)
hogql: str | None = Field(default=None, description="Generated HogQL query.")
+ latestDayComputedAt: str | None = Field(
+ default=None,
+ description=(
+ "ISO timestamp of when the numbers for the most recent day in the range"
+ " were computed, at this time or later. It is the oldest stamp among the"
+ " precompute windows that hold that day, across costs and conversion goals."
+ " Unset when no precompute was read or a window has no stamp."
+ ),
+ )
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
precomputeNotReady: bool | None = Field(
default=None,
@@ -23964,7 +24036,7 @@ class QueryResponseAlternative52(BaseModel):
columns: list | None = None
dataComputedAt: str | None = Field(
default=None,
- description=('ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X".'),
+ description=("ISO timestamp of the oldest precompute window backing this result."),
)
error: str | None = Field(
default=None,
@@ -23974,6 +24046,15 @@ class QueryResponseAlternative52(BaseModel):
)
hasMore: bool | None = None
hogql: str | None = Field(default=None, description="Generated HogQL query.")
+ latestDayComputedAt: str | None = Field(
+ default=None,
+ description=(
+ "ISO timestamp of when the numbers for the most recent day in the range"
+ " were computed, at this time or later. It is the oldest stamp among the"
+ " precompute windows that hold that day, across costs and conversion goals."
+ " Unset when no precompute was read or a window has no stamp."
+ ),
+ )
limit: int | None = None
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
offset: int | None = None
@@ -24028,7 +24109,7 @@ class QueryResponseAlternative53(BaseModel):
)
dataComputedAt: str | None = Field(
default=None,
- description=('ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X".'),
+ description=("ISO timestamp of the oldest precompute window backing this result."),
)
error: str | None = Field(
default=None,
@@ -24037,6 +24118,15 @@ class QueryResponseAlternative53(BaseModel):
),
)
hogql: str | None = Field(default=None, description="Generated HogQL query.")
+ latestDayComputedAt: str | None = Field(
+ default=None,
+ description=(
+ "ISO timestamp of when the numbers for the most recent day in the range"
+ " were computed, at this time or later. It is the oldest stamp among the"
+ " precompute windows that hold that day, across costs and conversion goals."
+ " Unset when no precompute was read or a window has no stamp."
+ ),
+ )
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
precomputeNotReady: bool | None = Field(
default=None,
diff --git a/products/analytics_platform/backend/lazy_computation/lazy_computation_executor.py b/products/analytics_platform/backend/lazy_computation/lazy_computation_executor.py
index c9600d064b54..5557ba85a829 100644
--- a/products/analytics_platform/backend/lazy_computation/lazy_computation_executor.py
+++ b/products/analytics_platform/backend/lazy_computation/lazy_computation_executor.py
@@ -668,6 +668,13 @@ class LazyComputationQuery:
modifiers: HogQLQueryModifiers | None = None
+@frozen
+class ServedWindow:
+ start: datetime
+ end: datetime
+ computed_at: datetime | None
+
+
@dataclass(frozen=True)
class LazyComputationResult:
"""Result of executing lazy computation jobs."""
@@ -694,8 +701,15 @@ class LazyComputationResult:
freshly_built: bool = False
# Oldest `computed_at` across the served jobs — the moment the stalest window in the
# range was last materialized. None when nothing was served (not ready) or a served
- # job predates the column. Callers surface it as "data as of X".
+ # job predates the column.
computed_at: datetime | None = None
+ # Every served job's range and computed_at, so a caller can ask how fresh a specific part of the
+ # range is (for example the latest day) instead of only the oldest stamp.
+ served_windows: tuple[ServedWindow, ...] = ()
+
+
+def _served_windows(jobs: list[PreaggregationJob]) -> tuple[ServedWindow, ...]:
+ return tuple(ServedWindow(start=j.time_range_start, end=j.time_range_end, computed_at=j.computed_at) for j in jobs)
def _oldest_computed_at(jobs: list[PreaggregationJob]) -> datetime | None:
@@ -1327,6 +1341,7 @@ class LazyComputationExecutor:
job_ids=[j.id for j in covering],
stale=True,
computed_at=_oldest_computed_at(covering),
+ served_windows=_served_windows(covering),
)
_log_execution("stale_hit", result)
return result
@@ -1591,6 +1606,7 @@ class LazyComputationExecutor:
job_ids=[j.id for j in final_ready],
freshly_built=jobs_created > 0 or bool(waited_job_ids),
computed_at=_oldest_computed_at(final_ready),
+ served_windows=_served_windows(final_ready),
)
_log_execution("success", result)
return result
diff --git a/products/analytics_platform/backend/lazy_computation/tests/test_lazy_computation_executor.py b/products/analytics_platform/backend/lazy_computation/tests/test_lazy_computation_executor.py
index 3f9d356d0850..685aeeff83e8 100644
--- a/products/analytics_platform/backend/lazy_computation/tests/test_lazy_computation_executor.py
+++ b/products/analytics_platform/backend/lazy_computation/tests/test_lazy_computation_executor.py
@@ -43,6 +43,7 @@ from products.analytics_platform.backend.lazy_computation.lazy_computation_execu
LazyComputationQuery,
LazyComputationResult,
LazyComputationTable,
+ ServedWindow,
TtlSchedule,
_build_manual_insert_sql,
_get_insert_settings,
@@ -1978,8 +1979,12 @@ class TestComputationExecutorExecute(BaseTest):
assert result.ready is True
assert ready_job.id in result.job_ids
- # The materialized-at time of the served window is surfaced for the "data as of X" badge.
assert result.computed_at == computed_at
+ assert result.served_windows == (
+ ServedWindow(
+ start=datetime(2024, 1, 1, tzinfo=UTC), end=datetime(2024, 1, 2, tzinfo=UTC), computed_at=computed_at
+ ),
+ )
def test_inserts_missing_ranges_and_returns_all_job_ids(self):
query_info, query_hash = self._make_query_info()
@@ -2307,6 +2312,9 @@ class TestComputationExecutorExecute(BaseTest):
if served:
assert result.stale is True
assert result.job_ids == [stale_job.id]
+ assert [(w.start, w.end) for w in result.served_windows] == [
+ (datetime(2024, 1, 1, tzinfo=UTC), datetime(2024, 1, 2, tzinfo=UTC))
+ ]
assert insert_count[0] == 0, "serve-stale must not compute inline"
else:
assert result.stale is False
diff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.ts
index ebe46e78c18e..23372b354cc5 100644
--- a/products/dashboards/frontend/generated/api.schemas.ts
+++ b/products/dashboards/frontend/generated/api.schemas.ts
@@ -5511,13 +5511,15 @@ export interface MarketingAnalyticsItemApi {
export interface Response12Api {
columns?: unknown[] | null
- /** ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X". */
+ /** ISO timestamp of the oldest precompute window backing this result. */
dataComputedAt?: string | null
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null
hasMore?: boolean | null
/** Generated HogQL query. */
hogql?: string | null
+ /** ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp. */
+ latestDayComputedAt?: string | null
limit?: number | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
@@ -5544,12 +5546,14 @@ export interface Response12Api {
export type Response13ApiResults = { [key: string]: MarketingAnalyticsItemApi }
export interface Response13Api {
- /** ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X". */
+ /** ISO timestamp of the oldest precompute window backing this result. */
dataComputedAt?: string | null
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null
/** Generated HogQL query. */
hogql?: string | null
+ /** ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp. */
+ latestDayComputedAt?: string | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
/** True when a conversion goal's precompute has not been warmed for this window yet — the UI shows a "computing" state rather than empty results. Marketing analytics serves exclusively from precompute. */
@@ -8177,13 +8181,15 @@ export const MarketingAnalyticsOrderByEnumApi = {
export interface MarketingAnalyticsTableQueryResponseApi {
columns?: unknown[] | null
- /** ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X". */
+ /** ISO timestamp of the oldest precompute window backing this result. */
dataComputedAt?: string | null
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null
hasMore?: boolean | null
/** Generated HogQL query. */
hogql?: string | null
+ /** ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp. */
+ latestDayComputedAt?: string | null
limit?: number | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
@@ -8258,12 +8264,14 @@ export interface MarketingAnalyticsTableQueryApi {
export type MarketingAnalyticsAggregatedQueryResponseApiResults = { [key: string]: MarketingAnalyticsItemApi }
export interface MarketingAnalyticsAggregatedQueryResponseApi {
- /** ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X". */
+ /** ISO timestamp of the oldest precompute window backing this result. */
dataComputedAt?: string | null
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null
/** Generated HogQL query. */
hogql?: string | null
+ /** ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp. */
+ latestDayComputedAt?: string | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
/** True when a conversion goal's precompute has not been warmed for this window yet — the UI shows a "computing" state rather than empty results. Marketing analytics serves exclusively from precompute. */
diff --git a/products/desktop/packages/api-client/src/generated.ts b/products/desktop/packages/api-client/src/generated.ts
index 21573e678efe..4b9e86ee5697 100644
--- a/products/desktop/packages/api-client/src/generated.ts
+++ b/products/desktop/packages/api-client/src/generated.ts
@@ -7123,6 +7123,7 @@ export namespace Schemas {
error?: (string | null) | undefined;
hasMore?: (boolean | null) | undefined;
hogql?: (string | null) | undefined;
+ latestDayComputedAt?: (string | null) | undefined;
limit?: (number | null) | undefined;
modifiers?: (HogQLQueryModifiers | null) | undefined;
offset?: (number | null) | undefined;
@@ -7149,6 +7150,7 @@ export namespace Schemas {
dataComputedAt?: (string | null) | undefined;
error?: (string | null) | undefined;
hogql?: (string | null) | undefined;
+ latestDayComputedAt?: (string | null) | undefined;
modifiers?: (HogQLQueryModifiers | null) | undefined;
precomputeNotReady?: (boolean | null) | undefined;
query_status?: (QueryStatus | null) | undefined;
@@ -8348,6 +8350,7 @@ export namespace Schemas {
error?: (string | null) | undefined;
hasMore?: (boolean | null) | undefined;
hogql?: (string | null) | undefined;
+ latestDayComputedAt?: (string | null) | undefined;
limit?: (number | null) | undefined;
modifiers?: (HogQLQueryModifiers | null) | undefined;
offset?: (number | null) | undefined;
@@ -8417,6 +8420,7 @@ export namespace Schemas {
dataComputedAt?: (string | null) | undefined;
error?: (string | null) | undefined;
hogql?: (string | null) | undefined;
+ latestDayComputedAt?: (string | null) | undefined;
modifiers?: (HogQLQueryModifiers | null) | undefined;
precomputeNotReady?: (boolean | null) | undefined;
query_status?: (QueryStatus | null) | undefined;
diff --git a/products/marketing_analytics/backend/hogql_queries/conversion_goal_processor.py b/products/marketing_analytics/backend/hogql_queries/conversion_goal_processor.py
index 490133a63208..5795460e59f5 100644
--- a/products/marketing_analytics/backend/hogql_queries/conversion_goal_processor.py
+++ b/products/marketing_analytics/backend/hogql_queries/conversion_goal_processor.py
@@ -55,7 +55,7 @@ from .conversion_goal_conditions import (
)
from .errors import MarketingPrecomputeNotReady
from .marketing_analytics_config import MarketingAnalyticsConfig
-from .marketing_lazy_precompute import marketing_ensure_precomputed
+from .marketing_lazy_precompute import events_latest_day_computed_at, marketing_ensure_precomputed
from .metrics import CONVERSION_GOAL_PRECOMPUTE_FALLBACK_COUNTER
from .utils import build_source_normalization_expr, test_account_conditions
@@ -305,9 +305,13 @@ class ConversionGoalProcessor:
precompute_stale: bool = False
# Passed down by the runner, since a processor has no query of its own to read it from.
filter_test_accounts: bool = False
- # Oldest `computed_at` across this goal's served precomputes (touchpoints + conversions) — how old the
- # goal's data can be. The runner takes the oldest across all goals for the response's "data as of X".
+ # Oldest `computed_at` across this goal's served precomputes (touchpoints + conversions), which bounds how
+ # old the goal's data can be. The runner takes the oldest across all goals for `dataComputedAt`.
precompute_computed_at: datetime | None = None
+ # True once this goal's read is served from precompute. A served goal with an unknown latest-day stamp
+ # (None) must still reach the runner, so it cannot rely on the stamp alone.
+ precompute_served: bool = False
+ precompute_latest_day_computed_at: datetime | None = None
include_session_ids: bool = False
_UTM_LEVEL_FIELD_MAP: ClassVar[dict[MarketingAnalyticsDrillDownLevel, str]] = {
@@ -781,9 +785,14 @@ class ConversionGoalProcessor:
self.precompute_stale = True
# Oldest materialization across the two precomputes bounds how old this goal's data can be; the
- # runner takes the oldest across all goals for the response's "data as of X".
+ # runner takes the oldest across all goals for `dataComputedAt`.
stamps = [r.computed_at for r in (touchpoints_result, conversions_result) if r.computed_at is not None]
self.precompute_computed_at = min(stamps) if stamps else None
+ self.precompute_served = True
+ self.precompute_latest_day_computed_at = events_latest_day_computed_at(
+ touchpoints_result.served_windows + conversions_result.served_windows,
+ date_to.replace(hour=0, minute=0, second=0, microsecond=0),
+ )
with self.timings.measure("ma_attribution_pipeline_precomputed"):
array_collection = self._build_array_collection_from_precomputes(
diff --git a/products/marketing_analytics/backend/hogql_queries/marketing_analytics_base_query_runner.py b/products/marketing_analytics/backend/hogql_queries/marketing_analytics_base_query_runner.py
index b862121e8202..9a875dca262e 100644
--- a/products/marketing_analytics/backend/hogql_queries/marketing_analytics_base_query_runner.py
+++ b/products/marketing_analytics/backend/hogql_queries/marketing_analytics_base_query_runner.py
@@ -50,6 +50,7 @@ from products.marketing_analytics.backend.hogql_queries.constants import (
)
from products.marketing_analytics.backend.hogql_queries.marketing_lazy_precompute import (
BACKGROUND_WARMING_TRIGGERS,
+ costs_latest_day_computed_at,
handle_not_ready,
handle_stale_served,
is_on_demand_revalidation,
@@ -92,6 +93,7 @@ class PrecomputeMetadataResponse(Protocol):
precomputeNotReady: Optional[bool]
dataComputedAt: Optional[str]
+ latestDayComputedAt: Optional[str]
# Discriminator column tagging each row in the compare UNION ALL with its period.
@@ -197,9 +199,13 @@ class MarketingAnalyticsBaseQueryRunner(AnalyticsQueryRunner[ResponseType], ABC,
# Set when any read-path ensure (costs, touchpoints, conversions) was served from
# expired-within-grace rows rather than rebuilt inline. Reset on each to_query.
self._precompute_stale: bool = False
- # Oldest precompute `computed_at` across the read's conversion goals, collected while building the
- # query. Surfaced on the response as "data as of X". None when nothing precomputed was read.
+ # Oldest precompute `computed_at` across the read's datasets, collected while building the query.
+ # Returned as `dataComputedAt`. None when nothing precomputed was read.
self._precompute_computed_at: Optional[datetime] = None
+ # Oldest `computed_at` among the windows that hold the latest day of the current period, across every
+ # precomputed dataset. Unknown when any served dataset could not tell.
+ self._latest_day_computed_at: Optional[datetime] = None
+ self._latest_day_unknown: bool = False
def calculate(self) -> ResponseType:
start = time.perf_counter()
@@ -221,6 +227,11 @@ class MarketingAnalyticsBaseQueryRunner(AnalyticsQueryRunner[ResponseType], ABC,
precompute_metadata.dataComputedAt = (
self._precompute_computed_at.isoformat() if self._precompute_computed_at else None
)
+ precompute_metadata.latestDayComputedAt = (
+ self._latest_day_computed_at.isoformat()
+ if self._latest_day_computed_at and not self._latest_day_unknown
+ else None
+ )
self._capture_query_event("marketing analytics query performed", start)
return response
except Exception as e:
@@ -451,6 +462,9 @@ class MarketingAnalyticsBaseQueryRunner(AnalyticsQueryRunner[ResponseType], ABC,
continue
# This source's cost rows are on screen, so their age bounds the response's freshness too.
self.note_precompute_computed_at(result.computed_at)
+ self.note_latest_day_computed_at(
+ costs_latest_day_computed_at(result.served_windows, date_range.date_to().date())
+ )
# The ensure_precomputed call above materialized this source. We read by source, not by
# result.job_ids, because the `marketing_costs_precomputed` view already collapses each cell to its latest job.
materialized_source_ids.append(adapter.get_source_id())
@@ -1146,6 +1160,8 @@ class MarketingAnalyticsBaseQueryRunner(AnalyticsQueryRunner[ResponseType], ABC,
if processor.precompute_stale:
self._precompute_stale = True
self.note_precompute_computed_at(processor.precompute_computed_at)
+ if processor.precompute_served:
+ self.note_latest_day_computed_at(processor.precompute_latest_day_computed_at)
if unified_cte:
ctes[UNIFIED_CONVERSION_GOALS_CTE_ALIAS] = unified_cte
@@ -1211,13 +1227,19 @@ class MarketingAnalyticsBaseQueryRunner(AnalyticsQueryRunner[ResponseType], ABC,
The oldest across every dataset the response displays — costs, each conversion goal, and the
previous period when comparing — bounds how old the numbers on screen can be. Taking anything
- newer would understate staleness on the freshness badge.
+ newer would understate how old the data can be.
"""
if computed_at is None:
return
if self._precompute_computed_at is None or computed_at < self._precompute_computed_at:
self._precompute_computed_at = computed_at
+ def note_latest_day_computed_at(self, computed_at: Optional[datetime]) -> None:
+ if computed_at is None:
+ self._latest_day_unknown = True
+ elif self._latest_day_computed_at is None or computed_at < self._latest_day_computed_at:
+ self._latest_day_computed_at = computed_at
+
def to_query(self) -> ast.SelectQuery:
try:
return self._build_query()
@@ -1236,6 +1258,8 @@ class MarketingAnalyticsBaseQueryRunner(AnalyticsQueryRunner[ResponseType], ABC,
# the read schedules exactly one background revalidation once the query is built.
self._precompute_stale = False
self._precompute_computed_at = None
+ self._latest_day_computed_at = None
+ self._latest_day_unknown = False
# Apply drill-down level from query to config
self._apply_drill_down_level()
diff --git a/products/marketing_analytics/backend/hogql_queries/marketing_lazy_precompute.py b/products/marketing_analytics/backend/hogql_queries/marketing_lazy_precompute.py
index 0049e0fe6104..97ba486976a4 100644
--- a/products/marketing_analytics/backend/hogql_queries/marketing_lazy_precompute.py
+++ b/products/marketing_analytics/backend/hogql_queries/marketing_lazy_precompute.py
@@ -21,7 +21,9 @@ that on the CACHE_WARMUP feature tag (which the Dagster warmer already sets) plu
import json
import hashlib
+from collections.abc import Iterable, Sequence
from contextlib import suppress
+from datetime import UTC, date, datetime
from typing import Any
import structlog
@@ -38,6 +40,7 @@ from posthog.token_bucket import BucketDecision, Budget, consume
from products.analytics_platform.backend.lazy_computation.lazy_computation_executor import (
EXPIRY_BUFFER_SECONDS,
LazyComputationResult,
+ ServedWindow,
ensure_precomputed,
)
from products.analytics_platform.backend.lazy_computation.stale_policy import is_background_warming_request
@@ -127,6 +130,29 @@ def marketing_ensure_precomputed(*, team: Team, **kwargs: Any) -> LazyComputatio
return ensure_precomputed(team=team, **kwargs)
+def _oldest_stamp(windows: Iterable[ServedWindow]) -> datetime | None:
+ # A window without a stamp makes the age unknown, so the result must not read fresher than it is.
+ stamps = [w.computed_at for w in windows]
+ if not stamps or any(stamp is None for stamp in stamps):
+ return None
+ return min(stamp for stamp in stamps if stamp is not None)
+
+
+def events_latest_day_computed_at(windows: Sequence[ServedWindow], latest_day_start: datetime) -> datetime | None:
+ """Oldest stamp among the windows that hold events of the local day starting at `latest_day_start`."""
+ return _oldest_stamp(w for w in windows if w.end > latest_day_start)
+
+
+def costs_latest_day_computed_at(windows: Sequence[ServedWindow], latest_cost_day: date) -> datetime | None:
+ """Oldest stamp among the windows that hold `latest_cost_day`.
+
+ Cost rows carry a date, which the materialization reads as UTC midnight, so the day lives in the one
+ window that contains that instant rather than in every window the local day overlaps.
+ """
+ cost_day_start = datetime(latest_cost_day.year, latest_cost_day.month, latest_cost_day.day, tzinfo=UTC)
+ return _oldest_stamp(w for w in windows if w.start <= cost_day_start < w.end)
+
+
def _query_shape_key(query: Any) -> str:
query_json = query.model_dump(mode="json", exclude_none=True, exclude=set(FINAL_READ_ONLY_FIELDS))
if "modifiers" in query_json:
diff --git a/products/marketing_analytics/backend/hogql_queries/test_marketing_costs_precompute.py b/products/marketing_analytics/backend/hogql_queries/test_marketing_costs_precompute.py
index 112742296b26..b0ab44e41448 100644
--- a/products/marketing_analytics/backend/hogql_queries/test_marketing_costs_precompute.py
+++ b/products/marketing_analytics/backend/hogql_queries/test_marketing_costs_precompute.py
@@ -1,7 +1,9 @@
import uuid
-from datetime import UTC, date, datetime
+from contextlib import nullcontext
+from datetime import UTC, date, datetime, timedelta
from pathlib import Path
+import time_machine
from posthog.test.base import BaseTest, ClickhouseTestMixin
from unittest.mock import Mock, patch
@@ -9,7 +11,13 @@ from django.test import override_settings
from parameterized import parameterized
-from posthog.schema import DateRange, MarketingAnalyticsDrillDownLevel, MarketingAnalyticsTableQuery
+from posthog.schema import (
+ CompareFilter,
+ DateRange,
+ MarketingAnalyticsDrillDownLevel,
+ MarketingAnalyticsTableQuery,
+ MarketingAnalyticsTableQueryResponse,
+)
from posthog.hogql import ast
from posthog.hogql.parser import parse_select
@@ -18,9 +26,11 @@ from posthog.hogql.query import execute_hogql_query
from posthog.clickhouse.client.execute import sync_execute
from posthog.clickhouse.preaggregation.marketing_costs_sql import DISTRIBUTED_MARKETING_COSTS_TABLE
-from posthog.clickhouse.query_tagging import tags_context
+from posthog.clickhouse.query_tagging import Feature, tags_context
from posthog.hogql_queries.utils.query_date_range import QueryDateRange
+from products.analytics_platform.backend.lazy_computation.lazy_computation_executor import LazyComputationResult
+from products.analytics_platform.backend.models.preaggregation_job import PreaggregationJob
from products.marketing_analytics.backend.hogql_queries.adapters.base import (
GoogleAdsConfig,
MarketingSourceAdapter,
@@ -328,6 +338,47 @@ class TestMarketingCostsPrecompute(ClickhouseTestMixin, BaseTest):
f"deduped row should carry the latest {label_column} '{post_value}', not the stale '{pre_value}'"
)
+ @parameterized.expand([("plain", False, False), ("compare", True, False), ("unstamped_latest_day", False, True)])
+ def test_latest_day_stamp_comes_from_the_latest_day_window_not_the_oldest(
+ self, _name, compare, unstamped_latest_day
+ ):
+ warmed_at = datetime(2024, 3, 20, 12, tzinfo=UTC)
+ read_at = warmed_at + timedelta(days=3)
+ latest_day_window_start = datetime(2024, 3, 23, tzinfo=UTC)
+
+ def read(now: datetime, *, warmer: bool) -> MarketingAnalyticsTableQueryResponse:
+ with time_machine.travel(now, tick=False):
+ runner = MarketingAnalyticsTableQueryRunner(
+ query=MarketingAnalyticsTableQuery(
+ dateRange=DateRange(date_from="2024-03-01"),
+ compareFilter=CompareFilter(compare=compare),
+ limit=100,
+ offset=0,
+ properties=[],
+ ),
+ team=self.team,
+ )
+ runner.config.costs_precomputation_enabled = True
+ with (
+ patch.object(MarketingSourceFactory, "create_adapters", lambda _self: [self._adapter()]),
+ patch.object(MarketingSourceFactory, "get_valid_adapters", lambda _self, adapters: adapters),
+ tags_context(feature=Feature.CACHE_WARMUP) if warmer else nullcontext(),
+ ):
+ return runner.calculate()
+
+ read(warmed_at, warmer=True)
+ # Three days on, the warmer rebuilds only the windows past their TTL; older days keep their jobs.
+ read(read_at, warmer=True)
+ if unstamped_latest_day:
+ PreaggregationJob.objects.filter(team=self.team, time_range_start=latest_day_window_start).update(
+ computed_at=None
+ )
+ response = read(read_at, warmer=False)
+
+ assert response.latestDayComputedAt == (None if unstamped_latest_day else read_at.isoformat())
+ if not unstamped_latest_day:
+ assert response.dataComputedAt == warmed_at.isoformat()
+
@parameterized.expand([("user_read", None, True), ("on_demand_revalidation", REVALIDATION_TRIGGER, False)])
def test_on_demand_revalidation_never_builds_costs(self, _name, trigger, expect_costs_build):
# The Celery revalidation runs userless with warehouse access control bypassed, and a user read
@@ -378,7 +429,7 @@ class TestMarketingCostsPrecompute(ClickhouseTestMixin, BaseTest):
interval=None,
now=datetime(2023, 2, 1),
)
- ready = Mock(ready=True, job_ids=["00000000-0000-0000-0000-000000000001"])
+ ready = LazyComputationResult(ready=True, job_ids=[uuid.UUID("00000000-0000-0000-0000-000000000001")])
with (
patch.object(MarketingSourceFactory, "create_adapters", lambda self: [good, bad]),
patch.object(MarketingSourceFactory, "get_valid_adapters", lambda self, adapters: adapters),
diff --git a/products/marketing_analytics/backend/hogql_queries/test_marketing_lazy_precompute.py b/products/marketing_analytics/backend/hogql_queries/test_marketing_lazy_precompute.py
index b82748e1f520..680d69d3ca61 100644
--- a/products/marketing_analytics/backend/hogql_queries/test_marketing_lazy_precompute.py
+++ b/products/marketing_analytics/backend/hogql_queries/test_marketing_lazy_precompute.py
@@ -1,3 +1,6 @@
+from datetime import UTC, date, datetime
+from zoneinfo import ZoneInfo
+
from posthog.test.base import BaseTest
from unittest import mock
@@ -14,7 +17,10 @@ from posthog.models.event.new_events_schema import events_route_scope, new_event
from posthog.redis import TEST_clear_clients
from posthog.token_bucket import TEST_reset_scripts
-from products.analytics_platform.backend.lazy_computation.lazy_computation_executor import LazyComputationResult
+from products.analytics_platform.backend.lazy_computation.lazy_computation_executor import (
+ LazyComputationResult,
+ ServedWindow,
+)
from products.marketing_analytics.backend.hogql_queries.marketing_lazy_precompute import (
ENQUEUE_FAILURE_BACKOFF_SECONDS,
PRECOMPUTE_ONLY_MAX_STALE_SECONDS,
@@ -22,6 +28,8 @@ from products.marketing_analytics.backend.hogql_queries.marketing_lazy_precomput
TEAM_WARM_BUDGET,
_query_shape_key,
_revalidation_query,
+ costs_latest_day_computed_at,
+ events_latest_day_computed_at,
handle_not_ready,
handle_stale_served,
marketing_ensure_precomputed,
@@ -34,6 +42,39 @@ _DELAY = (
)
+_T0 = datetime(2024, 3, 1, tzinfo=UTC)
+_T1 = datetime(2024, 3, 5, 1, tzinfo=UTC)
+_T2 = datetime(2024, 3, 5, 9, tzinfo=UTC)
+
+
+def _utc_day_window(day: int, computed_at: datetime | None) -> ServedWindow:
+ return ServedWindow(
+ start=datetime(2024, 3, day, tzinfo=UTC), end=datetime(2024, 3, day + 1, tzinfo=UTC), computed_at=computed_at
+ )
+
+
+class TestLatestDayComputedAt(SimpleTestCase):
+ @parameterized.expand(
+ [
+ # Local Mar 5 starts at Mar 4 22:00 UTC, so the Mar 4 UTC window holds its first hours.
+ ("ahead_of_utc", "Asia/Jerusalem", [(3, _T0), (4, _T1), (5, _T2)], _T1),
+ # Local Mar 5 starts at Mar 5 08:00 UTC, so the Mar 4 UTC window holds none of it.
+ ("behind_utc", "America/Los_Angeles", [(4, _T0), (5, _T2), (6, _T1)], _T1),
+ ("unknown_stamp_on_latest_day", "UTC", [(4, _T0), (5, None)], None),
+ ]
+ )
+ def test_events_take_the_oldest_window_holding_the_local_latest_day(self, _name, timezone, windows, expected):
+ latest_day_start = datetime(2024, 3, 5, tzinfo=ZoneInfo(timezone))
+ served = [_utc_day_window(day, stamp) for day, stamp in windows]
+
+ assert events_latest_day_computed_at(served, latest_day_start) == expected
+
+ def test_costs_take_only_the_window_holding_the_cost_day(self):
+ served = [_utc_day_window(4, _T0), _utc_day_window(5, _T2)]
+
+ assert costs_latest_day_computed_at(served, date(2024, 3, 5)) == _T2
+
+
class TestMarketingRevalidationEventsTable(SimpleTestCase):
def setUp(self) -> None:
TEST_clear_clients()
diff --git a/products/marketing_analytics/frontend/generated/api.schemas.ts b/products/marketing_analytics/frontend/generated/api.schemas.ts
index e653ed80a7e4..21ab7c4846ce 100644
--- a/products/marketing_analytics/frontend/generated/api.schemas.ts
+++ b/products/marketing_analytics/frontend/generated/api.schemas.ts
@@ -1947,13 +1947,15 @@ export interface AccessControlFilterWarningApi {
export interface MarketingAnalyticsTableQueryResponseApi {
columns?: unknown[] | null
- /** ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X". */
+ /** ISO timestamp of the oldest precompute window backing this result. */
dataComputedAt?: string | null
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null
hasMore?: boolean | null
/** Generated HogQL query. */
hogql?: string | null
+ /** ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp. */
+ latestDayComputedAt?: string | null
limit?: number | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
diff --git a/products/product_analytics/frontend/generated/api.schemas.ts b/products/product_analytics/frontend/generated/api.schemas.ts
index 1313dc0861b6..05c765ed143e 100644
--- a/products/product_analytics/frontend/generated/api.schemas.ts
+++ b/products/product_analytics/frontend/generated/api.schemas.ts
@@ -4366,13 +4366,15 @@ export interface MarketingAnalyticsItemApi {
export interface Response12Api {
columns?: unknown[] | null
- /** ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X". */
+ /** ISO timestamp of the oldest precompute window backing this result. */
dataComputedAt?: string | null
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null
hasMore?: boolean | null
/** Generated HogQL query. */
hogql?: string | null
+ /** ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp. */
+ latestDayComputedAt?: string | null
limit?: number | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
@@ -4399,12 +4401,14 @@ export interface Response12Api {
export type Response13ApiResults = { [key: string]: MarketingAnalyticsItemApi }
export interface Response13Api {
- /** ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X". */
+ /** ISO timestamp of the oldest precompute window backing this result. */
dataComputedAt?: string | null
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null
/** Generated HogQL query. */
hogql?: string | null
+ /** ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp. */
+ latestDayComputedAt?: string | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
/** True when a conversion goal's precompute has not been warmed for this window yet — the UI shows a "computing" state rather than empty results. Marketing analytics serves exclusively from precompute. */
@@ -7032,13 +7036,15 @@ export const MarketingAnalyticsOrderByEnumApi = {
export interface MarketingAnalyticsTableQueryResponseApi {
columns?: unknown[] | null
- /** ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X". */
+ /** ISO timestamp of the oldest precompute window backing this result. */
dataComputedAt?: string | null
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null
hasMore?: boolean | null
/** Generated HogQL query. */
hogql?: string | null
+ /** ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp. */
+ latestDayComputedAt?: string | null
limit?: number | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
@@ -7113,12 +7119,14 @@ export interface MarketingAnalyticsTableQueryApi {
export type MarketingAnalyticsAggregatedQueryResponseApiResults = { [key: string]: MarketingAnalyticsItemApi }
export interface MarketingAnalyticsAggregatedQueryResponseApi {
- /** ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X". */
+ /** ISO timestamp of the oldest precompute window backing this result. */
dataComputedAt?: string | null
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null
/** Generated HogQL query. */
hogql?: string | null
+ /** ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp. */
+ latestDayComputedAt?: string | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
/** True when a conversion goal's precompute has not been warmed for this window yet — the UI shows a "computing" state rather than empty results. Marketing analytics serves exclusively from precompute. */
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 478ad28217c9..f8001052d36e 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -8725,13 +8725,15 @@ export namespace Schemas {
export interface Response12 {
columns?: unknown[] | null;
- /** ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X". */
+ /** ISO timestamp of the oldest precompute window backing this result. */
dataComputedAt?: string | null;
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
hasMore?: boolean | null;
/** Generated HogQL query. */
hogql?: string | null;
+ /** ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp. */
+ latestDayComputedAt?: string | null;
limit?: number | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
@@ -8758,12 +8760,14 @@ export namespace Schemas {
export type Response13Results = {[key: string]: MarketingAnalyticsItem};
export interface Response13 {
- /** ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X". */
+ /** ISO timestamp of the oldest precompute window backing this result. */
dataComputedAt?: string | null;
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
hogql?: string | null;
+ /** ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp. */
+ latestDayComputedAt?: string | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
/** True when a conversion goal's precompute has not been warmed for this window yet — the UI shows a "computing" state rather than empty results. Marketing analytics serves exclusively from precompute. */
@@ -10005,13 +10009,15 @@ export namespace Schemas {
export interface MarketingAnalyticsTableQueryResponse {
columns?: unknown[] | null;
- /** ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X". */
+ /** ISO timestamp of the oldest precompute window backing this result. */
dataComputedAt?: string | null;
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
hasMore?: boolean | null;
/** Generated HogQL query. */
hogql?: string | null;
+ /** ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp. */
+ latestDayComputedAt?: string | null;
limit?: number | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
@@ -10081,12 +10087,14 @@ export namespace Schemas {
export type MarketingAnalyticsAggregatedQueryResponseResults = {[key: string]: MarketingAnalyticsItem};
export interface MarketingAnalyticsAggregatedQueryResponse {
- /** ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X". */
+ /** ISO timestamp of the oldest precompute window backing this result. */
dataComputedAt?: string | null;
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
hogql?: string | null;
+ /** ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp. */
+ latestDayComputedAt?: string | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
/** True when a conversion goal's precompute has not been warmed for this window yet — the UI shows a "computing" state rather than empty results. Marketing analytics serves exclusively from precompute. */
@@ -101634,13 +101642,15 @@ export namespace Schemas {
export interface QueryResponseAlternative33 {
columns?: unknown[] | null;
- /** ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X". */
+ /** ISO timestamp of the oldest precompute window backing this result. */
dataComputedAt?: string | null;
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
hasMore?: boolean | null;
/** Generated HogQL query. */
hogql?: string | null;
+ /** ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp. */
+ latestDayComputedAt?: string | null;
limit?: number | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
@@ -101667,12 +101677,14 @@ export namespace Schemas {
export type QueryResponseAlternative34Results = {[key: string]: MarketingAnalyticsItem};
export interface QueryResponseAlternative34 {
- /** ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X". */
+ /** ISO timestamp of the oldest precompute window backing this result. */
dataComputedAt?: string | null;
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
hogql?: string | null;
+ /** ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp. */
+ latestDayComputedAt?: string | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
/** True when a conversion goal's precompute has not been warmed for this window yet — the UI shows a "computing" state rather than empty results. Marketing analytics serves exclusively from precompute. */
@@ -102218,13 +102230,15 @@ export namespace Schemas {
export interface QueryResponseAlternative52 {
columns?: unknown[] | null;
- /** ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X". */
+ /** ISO timestamp of the oldest precompute window backing this result. */
dataComputedAt?: string | null;
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
hasMore?: boolean | null;
/** Generated HogQL query. */
hogql?: string | null;
+ /** ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp. */
+ latestDayComputedAt?: string | null;
limit?: number | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
@@ -102251,12 +102265,14 @@ export namespace Schemas {
export type QueryResponseAlternative53Results = {[key: string]: MarketingAnalyticsItem};
export interface QueryResponseAlternative53 {
- /** ISO timestamp of the oldest precompute window backing this result — surfaced as "data as of X". */
+ /** ISO timestamp of the oldest precompute window backing this result. */
dataComputedAt?: string | null;
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
hogql?: string | null;
+ /** ISO timestamp of when the numbers for the most recent day in the range were computed, at this time or later. It is the oldest stamp among the precompute windows that hold that day, across costs and conversion goals. Unset when no precompute was read or a window has no stamp. */
+ latestDayComputedAt?: string | null;
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiers | null;
/** True when a conversion goal's precompute has not been warmed for this window yet — the UI shows a "computing" state rather than empty results. Marketing analytics serves exclusively from precompute. */