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(data-warehouse): add an ETL overview scene (#106910)

Tom Owersbae6ebcbe6bd
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 0181780cfe3e..e96279a0f5ad 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -8696,6 +8696,14 @@ snapshots:
hash: v1.k794b7964.71fdce87c3009faea6dd25e6ac817d5790ffed494cb15d66a7043b4ebe90cb60.rYWzblIjD-Ceyh15tkUkDm10Pu7exKRUm9n9TsB9B0Q
scenes-app-errortracking-linkedreports--several-reports-across-states--light:
hash: v1.k794b7964.fe2161a3bb0e898689ef58a342d071c353ded71ac270a62998ea566055359e7a.AnoCs1sNoTY6J1yl24yuZPh_1Jkjugz-jnYxHgY8ZyU
+ scenes-app-etl--healthy--dark:
+ hash: v1.k794b7964.6f9a746240c4bb66bf867ffdb0c0b4f2760968b7f6e6fefa3f09c87d3390b28a.cGt8qIGqmnOp8OGL0qZLsByWNj8WoodX4Swd4KYokpk
+ scenes-app-etl--healthy--light:
+ hash: v1.k794b7964.de906e2ee3c8242d49e0334bfcc090b0ca35e0d15fc20e1a97aa604a4218bae6.rNzE7RZnEnjOx2bH3oDTB4x0bD45FO6pDErTQ_4u2Gk
+ scenes-app-etl--needs-attention--dark:
+ hash: v1.k794b7964.6e2de088e9b72f27c86f7302dddff92548e44bdee770221ec8bb4f481ffbf5eb.vUqG_HSyPzcbYsHBx7m2SatCcQcx0LkZdne5fThy5uc
+ scenes-app-etl--needs-attention--light:
+ hash: v1.k794b7964.da980590bc87659d284578dcfe3778f9e9f68bbe218bedaef312f01a8847c625.sHm7R3KRP0yGxleUAjbXsqo6RxUjT5In5Gl9SVUIz_c
scenes-app-events--event-explorer--dark:
hash: v1.k794b7964.37b0783b0099a978beace09a9e97c9c24b4efd25eab561f7873494c40912f607.lhExCd9bHbFLYiVjEsoqKRUpnpYEv4pf0TAllwFc8jU
scenes-app-events--event-explorer--light:
@@ -11537,9 +11545,9 @@ snapshots:
scenes-app-settings-user--settings-user-danger-zone--light:
hash: v1.k794b7964.a18b0b851dcc99fc9c512c6809bcd9408d2d7710a1af1232600a330dfff18ac7.1Eo9vX2Xbpx00k_YhM-UEEsRXSEThzmS94cEEjcsfBs
scenes-app-settings-user--settings-user-navigation--dark:
- hash: v1.k794b7964.c678fbe79cd06ec5d805bf89a26e0ee37b05431eb516ff8559af567ae3c66ca4.brOG9fmWbDonWDlGYqqxZF7Lb7pr9vqko9rDN3vqc0o
+ hash: v1.k794b7964.3ac73e830a096f24184899a1636227c6f6bcb3146fa7e5b65a497407fb9dbcae.VcPuHv4elDb_cblau82cL54m83cghhoSW9aBVha_zz0
scenes-app-settings-user--settings-user-navigation--light:
- hash: v1.k794b7964.f472a9611f74c5cc61bde2b328bf70f507c3e7ab810f7fff84d5a7ad073add91.GUKjxOkcQwzja8QiApxYwXyyHFHtaXO6fZboZ7PvFQ0
+ hash: v1.k794b7964.ea356aca4149b794c7a166163a65f6ef0476a56a2d52eadb8e71e39afa9c3971.n2VHKvDJKxaPe7AFE7ysIYfRsXbL3gumJ6T5msdDgGI
scenes-app-settings-user--settings-user-notifications--dark:
hash: v1.k794b7964.1fc4163c567f18057b929328e07459c13277805442523070136233c17d5e633a.Tbp1Kb6RmIhrzsmp7CWml5LEnFyy9iY9-A-lTK-h76c
scenes-app-settings-user--settings-user-notifications--light:
diff --git a/frontend/src/layout/panel-layout/sidebarToolMeta.ts b/frontend/src/layout/panel-layout/sidebarToolMeta.ts
index 0c7520a900fd..666296b7cb1a 100644
--- a/frontend/src/layout/panel-layout/sidebarToolMeta.ts
+++ b/frontend/src/layout/panel-layout/sidebarToolMeta.ts
@@ -52,6 +52,7 @@ const descriptions: Record<string, string> = {
'Find problems encountered while processing your events. Inspect the warnings to identify tracking issues and improve the data you analyze.',
Annotations:
'Add context to changes in your metrics. Mark releases, campaigns, and other milestones so your team can connect a chart with what happened.',
+ ETL: 'Watch the data moving into PostHog and out to your own warehouses. See what is running, what is stale, and what has stopped.',
Sources:
'Bring data from your other tools into PostHog. Combine it with product events to answer questions that span your business.',
Destinations:
diff --git a/frontend/src/productScenes.tsx b/frontend/src/productScenes.tsx
index eebfb2afe56e..e0ae928c2a0e 100644
--- a/frontend/src/productScenes.tsx
+++ b/frontend/src/productScenes.tsx
@@ -173,6 +173,8 @@ export const productScenes: Record<string, () => Promise<any>> = {
VisualReviewSnapshotOverview: () =>
import('../../products/visual_review/frontend/scenes/VisualReviewSnapshotOverviewScene'),
VisualReviewFlakiness: () => import('../../products/visual_review/frontend/scenes/VisualReviewFlakinessScene'),
+ PipelineOverview: () =>
+ import('../../products/warehouse_sources/frontend/scenes/PipelineOverviewScene/PipelineOverviewScene'),
Heatmaps: () => import('../../products/web_analytics/frontend/heatmaps/scenes/heatmaps/HeatmapsScene'),
Heatmap: () => import('../../products/web_analytics/frontend/heatmaps/scenes/heatmap/HeatmapScene'),
HeatmapNew: () => import('../../products/web_analytics/frontend/heatmaps/scenes/heatmap/HeatmapNewScene'),
diff --git a/frontend/src/products.json b/frontend/src/products.json
index b6cc9a978e5a..8b21116e2e64 100644
--- a/frontend/src/products.json
+++ b/frontend/src/products.json
@@ -263,6 +263,13 @@
"type": null,
"intents": ["visual_review"]
},
+ {
+ "path": "ETL",
+ "category": "Tools",
+ "iconType": "data_pipeline",
+ "type": null,
+ "intents": ["data_warehouse"]
+ },
{
"path": "Web analytics",
"category": "Analytics",
diff --git a/frontend/src/products.tsx b/frontend/src/products.tsx
index 27776d48e3d2..641b28334698 100644
--- a/frontend/src/products.tsx
+++ b/frontend/src/products.tsx
@@ -282,6 +282,7 @@ export const productRoutes: Record<string, [string, string]> = {
'VisualReviewSnapshotHistory',
'visualReviewSnapshotHistory',
],
+ '/etl': ['PipelineOverview', 'pipelineOverview'],
'/web/content-autopilot': ['WebAnalytics', 'webAnalyticsContentAutopilot'],
'/heatmaps': ['Heatmaps', 'heatmaps'],
'/heatmaps/new': ['HeatmapNew', 'heatmapNew'],
@@ -1096,6 +1097,13 @@ export const productConfiguration: Record<string, any> = {
},
VisualReviewSnapshotOverview: { name: 'Snapshots', projectBased: true, iconType: 'visual_review' },
VisualReviewFlakiness: { name: 'Flakiness', projectBased: true, iconType: 'visual_review' },
+ PipelineOverview: {
+ projectBased: true,
+ name: 'ETL',
+ description: 'Every source you import from and every destination you write to, with the health of each.',
+ iconType: 'data_pipeline',
+ docsHref: 'https://posthog.com/docs/data-warehouse',
+ },
Heatmaps: {
name: 'Heatmaps',
projectBased: true,
@@ -1678,6 +1686,7 @@ export const productUrls = {
visualReviewFlakiness: (repoId: string): string => `/visual_review/repos/${repoId}/flakiness`,
visualReviewSnapshotHistory: (repoId: string, runType: string, identifier: string): string =>
`/visual_review/repos/${repoId}/${encodeURIComponent(runType)}/snapshots/${encodeURIComponent(identifier)}`,
+ etlOverview: (): string => '/etl',
webAnalytics: (): string => `/web`,
webAnalyticsWebVitals: (): string => `/web/web-vitals`,
webAnalyticsPageReports: (): string => `/web/page-reports`,
@@ -2038,6 +2047,7 @@ export type ProductTreePath =
| 'Endpoints'
| 'Engineering analytics'
| 'Error tracking'
+ | 'ETL'
| 'Evaluations'
| 'Experiments'
| 'Feature flags'
@@ -2261,6 +2271,17 @@ export const getTreeItemsProducts = (): FileSystemImport[] => [
'AIObservabilityCluster',
],
},
+ {
+ path: 'ETL',
+ intents: [ProductKey.DATA_WAREHOUSE],
+ category: ProductItemCategory.TOOLS,
+ iconType: 'data_pipeline',
+ iconColor: ['var(--color-product-data-warehouse-light)'],
+ href: urls.etlOverview(),
+ flag: FEATURE_FLAGS.WAREHOUSE_MULTI_DESTINATION,
+ sceneKey: 'PipelineOverview',
+ sceneKeys: ['PipelineOverview'],
+ },
{
path: 'Early access features',
intents: [ProductKey.EARLY_ACCESS_FEATURES],
diff --git a/frontend/src/scenes/sceneTypes.ts b/frontend/src/scenes/sceneTypes.ts
index 920f805bfff5..38e3a796c8fa 100644
--- a/frontend/src/scenes/sceneTypes.ts
+++ b/frontend/src/scenes/sceneTypes.ts
@@ -171,6 +171,7 @@ export enum Scene {
Skill = 'Skill',
Skills = 'Skills',
Coupons = 'Coupons',
+ PipelineOverview = 'PipelineOverview',
Sources = 'Sources',
StartupProgram = 'StartupProgram',
Stamphog = 'Stamphog',
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ba8056cc6e11..5c08452b8a81 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -5133,7 +5133,51 @@ importers:
specifier: 'catalog:'
version: 0.2.4([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))
- products/warehouse_sources: {}
+ products/warehouse_sources:
+ dependencies:
+ '@posthog/brand':
+ specifier: 'catalog:'
+ version: 0.12.3([email protected])
+ '@posthog/icons':
+ specifier: 'catalog:'
+ '@posthog/lemon-ui':
+ specifier: '*'
+ version: 0.0.0([email protected]([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected])))([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))([email protected]([email protected]))([email protected])
+ '@storybook/react':
+ specifier: 'catalog:'
+ '@types/react':
+ specifier: 18.3.27
+ version: 18.3.27
+ kea:
+ specifier: 'catalog:'
+ version: 4.0.0-pre.6(patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected])
+ kea-forms:
+ specifier: 'catalog:'
+ version: 3.2.0([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))
+ kea-loaders:
+ specifier: 'catalog:'
+ version: 3.1.1([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))
+ kea-router:
+ specifier: 'catalog:'
+ version: 3.4.1([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))
+ kea-test-utils:
+ specifier: 'catalog:'
+ version: 0.2.4([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))
+ posthog-js:
+ specifier: 'catalog:'
+ version: 1.434.14(@types/[email protected])([email protected])
+ react:
+ specifier: 18.3.1
+ version: 18.3.1
+ devDependencies:
+ '@testing-library/jest-dom':
+ specifier: ^5.17.0
+ version: 5.17.0
+ '@testing-library/react':
+ specifier: ^14.3.1
products/warehouse_sources_queue: {}
diff --git a/posthog/models/test/test_product_intent.py b/posthog/models/test/test_product_intent.py
index 3035114c158b..16b75783be3a 100644
--- a/posthog/models/test/test_product_intent.py
+++ b/posthog/models/test/test_product_intent.py
@@ -628,10 +628,10 @@ class TestProductIntent(BaseTest):
)
user_product_lists = UserProductList.objects.filter(user=self.user, team=self.team).order_by("product_path")
- assert user_product_lists.count() == 2
+ assert user_product_lists.count() == 3
product_paths = {upl.product_path for upl in user_product_lists}
- assert product_paths == {"Data warehouse", "SQL editor"}
+ assert product_paths == {"Data warehouse", "SQL editor", "ETL"}
enabled = [upl.enabled for upl in user_product_lists]
assert all(enabled)
diff --git a/products/data_warehouse/backend/presentation/pipeline_stats.py b/products/data_warehouse/backend/presentation/pipeline_stats.py
new file mode 100644
index 000000000000..9cb25e49a2d3
--- /dev/null
+++ b/products/data_warehouse/backend/presentation/pipeline_stats.py
@@ -0,0 +1,145 @@
+"""Response shapes for the team-wide pipeline aggregates on `DataWarehouseViewSet`.
+
+These actions returned raw dicts, so drf-spectacular inferred nothing and their generated
+clients came out as `Promise<void>` — callable, but with no types to build a UI against.
+
+Status and type fields are plain `CharField`s listing their values in `help_text` rather than
+`ChoiceField`s. The values here have no `TextChoices` class behind them, and an inline
+`choices=` list mints an OpenAPI enum named after the field, which collides with every other
+`status`/`type` enum and fails the schema build under `--fail-on-warn`.
+"""
+
+from rest_framework import serializers
+
+
+class PipelineErrorSerializer(serializers.Serializer):
+ error = serializers.CharField(help_text="What went wrong, for a reader rather than a parser.")
+
+
+class JobStatsQuerySerializer(serializers.Serializer):
+ days = serializers.ChoiceField(
+ choices=[1, 7, 30],
+ required=False,
+ default=7,
+ help_text="Window the counts should cover, in days. One of 1, 7 or 30. Defaults to 7.",
+ )
+
+
+class PipelineActivityQuerySerializer(serializers.Serializer):
+ limit = serializers.IntegerField(
+ required=False, default=20, help_text="Max rows to return. Capped at 50 server-side. Defaults to 20."
+ )
+ offset = serializers.IntegerField(
+ required=False, default=0, help_text="Rows to skip, for pagination. Defaults to 0."
+ )
+ cutoff_days = serializers.IntegerField(
+ required=False, default=30, help_text="Only include runs created within this many days of now. Defaults to 30."
+ )
+
+
+class CompletedActivityQuerySerializer(PipelineActivityQuerySerializer):
+ outcome = serializers.ChoiceField(
+ choices=["completed", "failed"],
+ required=False,
+ default="completed",
+ help_text="Which outcome to return: 'completed' or 'failed'. Defaults to 'completed'.",
+ )
+
+
+class JobCountsSerializer(serializers.Serializer):
+ total = serializers.IntegerField(help_text="Runs that finished inside the window.")
+ running = serializers.IntegerField(help_text="Runs in flight right now, regardless of the window.")
+ successful = serializers.IntegerField(help_text="Runs that completed.")
+ failed = serializers.IntegerField(help_text="Runs that errored or that billing stopped.")
+
+
+class JobStatsBucketSerializer(serializers.Serializer):
+ successful = serializers.IntegerField(help_text="Runs that completed in this bucket.")
+ failed = serializers.IntegerField(help_text="Runs that failed in this bucket.")
+
+
+class PipelineJobStatsResponseSerializer(serializers.Serializer):
+ days = serializers.IntegerField(help_text="Window the counts cover, in days. One of 1, 7 or 30.")
+ cutoff_time = serializers.DateTimeField(help_text="Start of the window, in the project's timezone.")
+ total_jobs = serializers.IntegerField(help_text="Sync runs plus materialization runs in the window.")
+ successful_jobs = serializers.IntegerField(help_text="Sync and materialization runs that completed.")
+ failed_jobs = serializers.IntegerField(help_text="Sync and materialization runs that failed.")
+ external_data_jobs = JobCountsSerializer(help_text="Counts for warehouse source syncs alone.")
+ modeling_jobs = JobCountsSerializer(help_text="Counts for materialized view runs alone.")
+ breakdown = serializers.DictField(
+ child=JobStatsBucketSerializer(),
+ help_text=(
+ "Runs per time bucket, keyed by ISO hour when days=1 and by ISO date otherwise. "
+ "Buckets with no runs are absent rather than zero."
+ ),
+ )
+
+
+class PipelineRowsStatsResponseSerializer(serializers.Serializer):
+ billing_available = serializers.BooleanField(
+ help_text="Whether billing answered. When false, only the counts derived from runs are meaningful."
+ )
+ billing_interval = serializers.CharField(
+ allow_null=True, help_text="Length of the billing period, for example 'month'."
+ )
+ billing_period_start = serializers.DateTimeField(allow_null=True, help_text="Start of the current billing period.")
+ billing_period_end = serializers.DateTimeField(allow_null=True, help_text="End of the current billing period.")
+ total_rows = serializers.IntegerField(help_text="Rows synced in the billing period, billed and not yet billed.")
+ tracked_billing_rows = serializers.IntegerField(help_text="Rows billing has already counted.")
+ pending_billing_rows = serializers.IntegerField(help_text="Rows synced since billing last counted.")
+ materialized_rows_in_billing_period = serializers.IntegerField(
+ help_text="Rows written by materialized view runs in the billing period."
+ )
+ breakdown_of_rows_by_source = serializers.DictField(
+ child=serializers.IntegerField(),
+ help_text="Rows synced in the billing period, keyed by source id.",
+ )
+
+
+class PipelineActivityRowSerializer(serializers.Serializer):
+ id = serializers.CharField(help_text="Run id.")
+ type = serializers.CharField(
+ allow_null=True,
+ help_text="The source type for a sync, or 'Materialized view' for a model run.",
+ )
+ name = serializers.CharField(allow_null=True, help_text="Table or view the run wrote.")
+ status = serializers.CharField(
+ help_text="Run status. One of: Running, Completed, Failed, BillingLimitReached, BillingLimitTooLow."
+ )
+ rows = serializers.IntegerField(help_text="Rows the run wrote. Zero while it is still going.")
+ created_at = serializers.DateTimeField(help_text="When the run was created. There is no separate start time.")
+ finished_at = serializers.DateTimeField(allow_null=True, help_text="When the run ended, or null while running.")
+ latest_error = serializers.CharField(allow_null=True, help_text="Error the run ended with, if any.")
+ workflow_run_id = serializers.CharField(allow_null=True, help_text="Temporal run id, for finding the run's logs.")
+ origin = serializers.CharField(allow_null=True, help_text="Where a materialized view came from. Null for syncs.")
+
+
+class PipelineActivityResponseSerializer(serializers.Serializer):
+ results = PipelineActivityRowSerializer(many=True, help_text="Runs, newest first.")
+ next = serializers.CharField(allow_null=True, help_text="Query string for the next page, or null on the last.")
+ previous = serializers.CharField(
+ allow_null=True, help_text="Query string for the previous page, or null on the first."
+ )
+
+
+class DataHealthIssueSerializer(serializers.Serializer):
+ id = serializers.CharField(help_text="Id of the thing that is unhealthy.")
+ name = serializers.CharField(help_text="Table, view or export the issue is about.")
+ type = serializers.CharField(
+ help_text=(
+ "What kind of thing is unhealthy. One of: materialized_view, external_data_sync, source, "
+ "destination, transformation."
+ )
+ )
+ source_type = serializers.CharField(
+ allow_null=True, required=False, help_text="Source type for a sync issue, for example 'Stripe'."
+ )
+ status = serializers.CharField(help_text="Why it is unhealthy. One of: failed, disabled, degraded, billing_limit.")
+ error = serializers.CharField(allow_null=True, help_text="The error, where one was recorded.")
+ failed_at = serializers.DateTimeField(allow_null=True, help_text="When it last failed.")
+ url = serializers.CharField(allow_null=True, help_text="Where to go to fix it.")
+
+
+class DataHealthIssuesResponseSerializer(serializers.Serializer):
+ results = DataHealthIssueSerializer(many=True, help_text="Everything currently unhealthy.")
+ count = serializers.IntegerField(help_text="How many issues are in `results`.")
diff --git a/products/data_warehouse/backend/presentation/views/data_warehouse.py b/products/data_warehouse/backend/presentation/views/data_warehouse.py
index dce786f0e00d..63cd18e5c23e 100644
--- a/products/data_warehouse/backend/presentation/views/data_warehouse.py
+++ b/products/data_warehouse/backend/presentation/views/data_warehouse.py
@@ -2,6 +2,7 @@ from datetime import datetime, timedelta
from typing import cast
from zoneinfo import ZoneInfo
+from django.core.cache import cache
from django.db import connection
from django.db.models import Count, OuterRef, Q, QuerySet, Subquery, Sum
from django.db.models.functions import TruncDate, TruncHour
@@ -54,6 +55,15 @@ from products.data_warehouse.backend.presentation.managed_warehouse_monitoring i
serialize_monitoring_series,
serialize_monitoring_snapshot,
)
+from products.data_warehouse.backend.presentation.pipeline_stats import (
+ CompletedActivityQuerySerializer,
+ DataHealthIssuesResponseSerializer,
+ JobStatsQuerySerializer,
+ PipelineActivityResponseSerializer,
+ PipelineErrorSerializer,
+ PipelineJobStatsResponseSerializer,
+ PipelineRowsStatsResponseSerializer,
+)
from products.managed_warehouse.backend.presentation import views as managed_warehouse
from products.warehouse_sources.backend.facade.hogql import get_view_or_table_by_name
from products.warehouse_sources.backend.facade.models import ExternalDataJob, ExternalDataSchema, ExternalDataSource
@@ -131,6 +141,61 @@ def _managed_warehouse_monitoring_error_response(upstream_response: Response) ->
)
+# Both aggregates are dashboard reads that fan out across a team's whole sync history, and a
+# dashboard polls. The window they report is coarse enough that a short cache costs the reader
+# nothing. `total_rows_stats` gets the longer one because it also makes a synchronous call out
+# to billing.
+JOB_STATS_CACHE_TTL_SECONDS = 60
+TOTAL_ROWS_STATS_CACHE_TTL_SECONDS = 300
+
+
+def _pipeline_stats_cache_key(name: str, team_id: int, *parts: object) -> str:
+ # team_id is in the key, not a filter applied afterwards, so one team can never be served
+ # another team's cached aggregate.
+ suffix = ":".join(str(part) for part in parts)
+ return f"data_warehouse:{name}:{team_id}" + (f":{suffix}" if suffix else "")
+
+
+# A run counts as failed when it errored or when billing stopped it. Kept in one place
+# because the three aggregates below drifted apart: each listed `BILLING_LIMIT_REACHED`
+# twice and none counted `BILLING_LIMIT_TOO_LOW`, so those runs were reported as neither
+# successful nor failed.
+FAILED_EXTERNAL_JOB_STATUSES = [
+ ExternalDataJobStatus.FAILED,
+ ExternalDataJobStatus.BILLING_LIMIT_REACHED,
+ ExternalDataJobStatus.BILLING_LIMIT_TOO_LOW,
+]
+
+
+# A schema halted by billing reports one of two statuses, and the health list used to name
+# only the first, so a sync stopped by "billing limit too low" appeared nowhere and the user
+# had no way to see why it stopped.
+# `completed_activity` answers "what finished", which a dashboard needs in two flavours: the
+# runs that worked and the runs that did not. They differ only by which statuses to match, so
+# this is one parameter rather than a second near-copy of the union query.
+ACTIVITY_OUTCOME_COMPLETED = "completed"
+ACTIVITY_OUTCOME_FAILED = "failed"
+
+ACTIVITY_OUTCOME_STATUSES: dict[str, tuple[list[str], list[str]]] = {
+ ACTIVITY_OUTCOME_COMPLETED: (
+ [ExternalDataJobStatus.COMPLETED],
+ [DataModelingJob.Status.COMPLETED],
+ ),
+ ACTIVITY_OUTCOME_FAILED: (
+ list(FAILED_EXTERNAL_JOB_STATUSES),
+ [DataModelingJob.Status.FAILED],
+ ),
+}
+
+
+BILLING_LIMITED_SCHEMA_STATUSES = [
+ ExternalDataSchemaStatus.BILLING_LIMIT_REACHED,
+ ExternalDataSchemaStatus.BILLING_LIMIT_TOO_LOW,
+]
+
+FAILING_SCHEMA_STATUSES = [ExternalDataSchemaStatus.FAILED, *BILLING_LIMITED_SCHEMA_STATUSES]
+
+
class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
"""
API endpoints for data warehouse aggregate statistics and operations.
@@ -267,12 +332,31 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
resp["Cache-Control"] = "max-age=10"
return resp
+ @extend_schema(
+ responses={
+ 200: PipelineRowsStatsResponseSerializer,
+ 500: OpenApiResponse(response=PipelineErrorSerializer, description="Billing could not be reached."),
+ }
+ )
@action(methods=["GET"], detail=False)
def total_rows_stats(self, request: Request, **kwargs) -> Response:
"""
Returns aggregated statistics for the data warehouse total rows processed within the current billing period.
Used by the frontend data warehouse scene to display usage information.
"""
+ # breakdown_of_rows_by_source depends on the caller's readable sources, so it can never be
+ # part of the cached payload: a value cached for a broadly-permissioned caller would leak
+ # source ids and row counts to a teammate whose access is narrower. Everything else in the
+ # payload is team-wide and permission-independent, so only that part is cached.
+ cache_key = _pipeline_stats_cache_key("total_rows_stats", self.team_id)
+ cached = cache.get(cache_key)
+ if cached is not None:
+ payload = dict(cached)
+ payload["breakdown_of_rows_by_source"] = self._breakdown_of_rows_by_source(
+ cached["billing_period_start"], cached["billing_period_end"]
+ )
+ return Response(status=status.HTTP_200_OK, data=payload)
+
billing_interval = ""
billing_period_start = None
billing_period_end = None
@@ -281,8 +365,7 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
pending_billing_rows = 0
rows_synced = 0
billing_available = False
- breakdown_of_rows_by_source = {}
- sources = self._readable_sources().filter(deleted=False)
+ breakdown_of_rows_by_source: dict[str, int] = {}
try:
billing_manager = BillingManager(get_cached_instance_license())
@@ -317,17 +400,9 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
)
materialized_rows = data_modeling_jobs.aggregate(total=Sum("rows_materialized"))["total"] or 0
- for source in sources:
- total_rows = (
- ExternalDataJob.objects.filter(
- pipeline=source,
- created_at__gte=billing_period_start,
- created_at__lt=billing_period_end,
- ).aggregate(total=Sum("rows_synced"))["total"]
- or 0
- )
-
- breakdown_of_rows_by_source[str(source.id)] = total_rows
+ breakdown_of_rows_by_source = self._breakdown_of_rows_by_source(
+ billing_period_start, billing_period_end
+ )
else:
logger.info("No billing period information available, using defaults")
@@ -339,21 +414,50 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
data={"error": "An error occurred retrieving billing information"},
)
- return Response(
- status=status.HTTP_200_OK,
- data={
- "billing_available": billing_available,
- "billing_interval": billing_interval,
- "billing_period_end": billing_period_end,
- "billing_period_start": billing_period_start,
- "breakdown_of_rows_by_source": breakdown_of_rows_by_source,
- "materialized_rows_in_billing_period": materialized_rows,
- "total_rows": rows_synced,
- "tracked_billing_rows": billing_tracked_rows,
- "pending_billing_rows": pending_billing_rows,
- },
- )
+ payload = {
+ "billing_available": billing_available,
+ "billing_interval": billing_interval,
+ "billing_period_end": billing_period_end,
+ "billing_period_start": billing_period_start,
+ "breakdown_of_rows_by_source": breakdown_of_rows_by_source,
+ "materialized_rows_in_billing_period": materialized_rows,
+ "total_rows": rows_synced,
+ "tracked_billing_rows": billing_tracked_rows,
+ "pending_billing_rows": pending_billing_rows,
+ }
+
+ # Only a complete answer is worth reusing: caching a response assembled while billing was
+ # unreachable would keep serving zeroes long after billing recovered. The cached copy omits
+ # the per-source breakdown; see the comment at the top of this method for why.
+ if billing_available:
+ cacheable_payload = {k: v for k, v in payload.items() if k != "breakdown_of_rows_by_source"}
+ cache.set(cache_key, cacheable_payload, TOTAL_ROWS_STATS_CACHE_TTL_SECONDS)
+ return Response(status=status.HTTP_200_OK, data=payload)
+
+ def _breakdown_of_rows_by_source(
+ self, billing_period_start: datetime, billing_period_end: datetime
+ ) -> dict[str, int]:
+ # Computed fresh on every request (never cached) because it is scoped to the caller's own
+ # readable sources, which differ from one caller to the next on the same team.
+ breakdown: dict[str, int] = {}
+ for source in self._readable_sources().filter(deleted=False):
+ total_rows = (
+ ExternalDataJob.objects.filter(
+ pipeline=source,
+ created_at__gte=billing_period_start,
+ created_at__lt=billing_period_end,
+ ).aggregate(total=Sum("rows_synced"))["total"]
+ or 0
+ )
+ breakdown[str(source.id)] = total_rows
+ return breakdown
+ @extend_schema(
+ responses={
+ 200: PipelineActivityResponseSerializer,
+ 500: OpenApiResponse(response=PipelineErrorSerializer, description="The activity query failed."),
+ }
+ )
@action(methods=["GET"], detail=False)
def running_activity(self, request: Request, **kwargs) -> Response:
"""
@@ -451,6 +555,13 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
}
)
+ @extend_schema(
+ parameters=[CompletedActivityQuerySerializer],
+ responses={
+ 200: PipelineActivityResponseSerializer,
+ 500: OpenApiResponse(response=PipelineErrorSerializer, description="The activity query failed."),
+ },
+ )
@action(methods=["GET"], detail=False)
def completed_activity(self, request: Request, **kwargs) -> Response:
"""
@@ -470,6 +581,15 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
{"error": "Invalid limit, offset, or cutoff_days parameter"}, status=status.HTTP_400_BAD_REQUEST
)
+ outcome = request.GET.get("outcome", ACTIVITY_OUTCOME_COMPLETED)
+ if outcome not in ACTIVITY_OUTCOME_STATUSES:
+ supported = ", ".join(sorted(ACTIVITY_OUTCOME_STATUSES))
+ return Response(
+ {"error": f"Invalid outcome parameter. Must be one of: {supported}."},
+ status=status.HTTP_400_BAD_REQUEST,
+ )
+ external_statuses, modeling_statuses = ACTIVITY_OUTCOME_STATUSES[outcome]
+
source_ids = list(self._readable_sources().values_list("id", flat=True))
schema_ids = self._readable_team_schema_ids()
saved_query_ids = list(
@@ -490,7 +610,7 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
FROM posthog_externaldatajob edj
LEFT JOIN posthog_externaldataschema eds ON edj.schema_id = eds.id
LEFT JOIN posthog_externaldatasource edsrc ON eds.source_id = edsrc.id
- WHERE edj.team_id = %s AND edj.status = 'Completed' AND edj.created_at >= %s
+ WHERE edj.team_id = %s AND edj.status = ANY(%s) AND edj.created_at >= %s
AND edj.pipeline_id = ANY(%s::uuid[])
AND (edj.schema_id IS NULL OR edj.schema_id = ANY(%s::uuid[]))
),
@@ -501,7 +621,7 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
dwsq.origin
FROM posthog_datamodelingjob dmj
LEFT JOIN posthog_datawarehousesavedquery dwsq ON dmj.saved_query_id = dwsq.id
- WHERE dmj.team_id = %s AND dmj.status = 'Completed' AND dmj.created_at >= %s
+ WHERE dmj.team_id = %s AND dmj.status = ANY(%s) AND dmj.created_at >= %s
AND (dwsq.id IS NULL OR dwsq.id = ANY(%s::uuid[]))
)
SELECT * FROM external_jobs
@@ -512,10 +632,12 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
""",
[
self.team_id,
+ external_statuses,
cutoff_time,
source_ids,
schema_ids,
self.team_id,
+ modeling_statuses,
cutoff_time,
saved_query_ids,
limit + 1,
@@ -536,9 +658,9 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
next_url = None
prev_url = None
if has_more:
- next_url = f"?limit={limit}&offset={offset + limit}&cutoff_days={cutoff_days}"
+ next_url = f"?limit={limit}&offset={offset + limit}&cutoff_days={cutoff_days}&outcome={outcome}"
if offset > 0:
- prev_url = f"?limit={limit}&offset={max(0, offset - limit)}&cutoff_days={cutoff_days}"
+ prev_url = f"?limit={limit}&offset={max(0, offset - limit)}&cutoff_days={cutoff_days}&outcome={outcome}"
return Response(
{
@@ -548,6 +670,14 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
}
)
+ @extend_schema(
+ parameters=[JobStatsQuerySerializer],
+ responses={
+ 200: PipelineJobStatsResponseSerializer,
+ 400: OpenApiResponse(response=PipelineErrorSerializer, description="`days` was not 1, 7 or 30."),
+ 500: OpenApiResponse(response=PipelineErrorSerializer, description="The statistics query failed."),
+ },
+ )
@action(methods=["GET"], detail=False)
def job_stats(self, request: Request, **kwargs) -> Response:
"""
@@ -555,7 +685,6 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
Query parameter 'days' can be 1, 7, or 30 (default: 7).
"""
- # TODO: Will want to cache this data to not spam PG
try:
days = int(request.GET.get("days", 7))
if days not in [1, 7, 30]:
@@ -566,6 +695,11 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
except (ValueError, TypeError):
return Response({"error": "Invalid days parameter"}, status=status.HTTP_400_BAD_REQUEST)
+ cache_key = _pipeline_stats_cache_key("job_stats", self.team_id, days)
+ cached = cache.get(cache_key)
+ if cached is not None:
+ return Response(cached)
+
try:
project_tz = ZoneInfo(self.team.timezone) if self.team.timezone else ZoneInfo("UTC")
except Exception:
@@ -583,13 +717,7 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
successful=Count("id", filter=Q(status=ExternalDataJobStatus.COMPLETED)),
failed=Count(
"id",
- filter=Q(
- status__in=[
- ExternalDataJobStatus.FAILED,
- ExternalDataJobStatus.BILLING_LIMIT_REACHED,
- ExternalDataJobStatus.BILLING_LIMIT_REACHED,
- ]
- ),
+ filter=Q(status__in=FAILED_EXTERNAL_JOB_STATUSES),
),
)
@@ -614,13 +742,7 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
successful=Count("id", filter=Q(status=ExternalDataJobStatus.COMPLETED)),
failed=Count(
"id",
- filter=Q(
- status__in=[
- ExternalDataJobStatus.FAILED,
- ExternalDataJobStatus.BILLING_LIMIT_REACHED,
- ExternalDataJobStatus.BILLING_LIMIT_REACHED,
- ]
- ),
+ filter=Q(status__in=FAILED_EXTERNAL_JOB_STATUSES),
),
)
)
@@ -654,13 +776,7 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
successful=Count("id", filter=Q(status=ExternalDataJobStatus.COMPLETED)),
failed=Count(
"id",
- filter=Q(
- status__in=[
- ExternalDataJobStatus.FAILED,
- ExternalDataJobStatus.BILLING_LIMIT_REACHED,
- ExternalDataJobStatus.BILLING_LIMIT_REACHED,
- ]
- ),
+ filter=Q(status__in=FAILED_EXTERNAL_JOB_STATUSES),
),
)
)
@@ -694,28 +810,29 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
team_id=self.team_id, status=DataModelingJob.Status.RUNNING, created_at__gte=cutoff_time
).count()
- return Response(
- {
- "days": days,
- "cutoff_time": cutoff_time,
- "total_jobs": total_jobs,
- "successful_jobs": total_successful,
- "failed_jobs": total_failed,
- "external_data_jobs": {
- "total": external_stats["total"],
- "running": running_external_data_jobs,
- "successful": external_stats["successful"],
- "failed": external_stats["failed"],
- },
- "modeling_jobs": {
- "total": modeling_stats["total"],
- "running": running_modeling_jobs,
- "successful": modeling_stats["successful"],
- "failed": modeling_stats["failed"],
- },
- "breakdown": breakdown,
- }
- )
+ payload = {
+ "days": days,
+ "cutoff_time": cutoff_time,
+ "total_jobs": total_jobs,
+ "successful_jobs": total_successful,
+ "failed_jobs": total_failed,
+ "external_data_jobs": {
+ "total": external_stats["total"],
+ "running": running_external_data_jobs,
+ "successful": external_stats["successful"],
+ "failed": external_stats["failed"],
+ },
+ "modeling_jobs": {
+ "total": modeling_stats["total"],
+ "running": running_modeling_jobs,
+ "successful": modeling_stats["successful"],
+ "failed": modeling_stats["failed"],
+ },
+ "breakdown": breakdown,
+ }
+
+ cache.set(cache_key, payload, JOB_STATS_CACHE_TTL_SECONDS)
+ return Response(payload)
except Exception as e:
logger.exception("Error retrieving job statistics", exc_info=e)
@@ -724,7 +841,17 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
status=status.HTTP_500_INTERNAL_SERVER_ERROR,
)
- @action(methods=["GET"], detail=False, required_scopes=["warehouse_view:read", "external_data_source:read"])
+ @extend_schema(
+ responses={
+ 200: DataHealthIssuesResponseSerializer,
+ 500: OpenApiResponse(response=PipelineErrorSerializer, description="The health query failed."),
+ }
+ )
+ @action(
+ methods=["GET"],
+ detail=False,
+ required_scopes=["warehouse_view:read", "external_data_source:read", "batch_export:read", "hog_function:read"],
+ )
def data_health_issues(self, request: Request, **kwargs) -> Response:
"""
Returns failed/disabled data pipeline items for the Pipeline status side panel.
@@ -765,11 +892,7 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
# Only show syncs that are actively enabled but failing
readable_sources = self._readable_sources()
problem_syncs = list(
- self._team_schemas()
- .filter(should_sync=True)
- .filter(
- Q(status=ExternalDataSchemaStatus.FAILED) | Q(status=ExternalDataSchemaStatus.BILLING_LIMIT_REACHED)
- )
+ self._team_schemas().filter(should_sync=True).filter(status__in=FAILING_SCHEMA_STATUSES)
)
visible_schema_ids = self._readable_schema_ids(problem_syncs)
@@ -777,7 +900,7 @@ class DataWarehouseViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
if schema.id not in visible_schema_ids:
continue
sync_status = "failed"
- if schema.status == ExternalDataSchemaStatus.BILLING_LIMIT_REACHED:
+ if schema.status in BILLING_LIMITED_SCHEMA_STATUSES:
sync_status = "billing_limit"
results.append(
diff --git a/products/data_warehouse/backend/tests/api/test_data_warehouse.py b/products/data_warehouse/backend/tests/api/test_data_warehouse.py
index f30be998f371..adc8855c7024 100644
--- a/products/data_warehouse/backend/tests/api/test_data_warehouse.py
+++ b/products/data_warehouse/backend/tests/api/test_data_warehouse.py
@@ -14,6 +14,7 @@ from products.dashboards.backend.models.dashboard import Dashboard
from products.dashboards.backend.models.dashboard_tile import DashboardTile
from products.data_modeling.backend.facade.models import DataModelingJob, DataModelingJobEngine, DataWarehouseSavedQuery
from products.data_warehouse.backend.models.team_data_warehouse_config import TeamDataWarehouseConfig
+from products.data_warehouse.backend.presentation.views.data_warehouse import _pipeline_stats_cache_key
from products.warehouse_sources.backend.facade.models import (
DataWarehouseTable,
ExternalDataJob,
@@ -175,6 +176,159 @@ class TestDataWarehouseAPI(APIBaseTest):
self.assertIn("breakdown", data)
self.assertIn("cutoff_time", data)
+ @parameterized.expand(
+ [
+ ("billing_limit_reached", ExternalDataJob.Status.BILLING_LIMIT_REACHED),
+ ("billing_limit_too_low", ExternalDataJob.Status.BILLING_LIMIT_TOO_LOW),
+ ]
+ )
+ def test_job_stats_counts_a_billing_stopped_run_as_failed(self, _name: str, job_status: str) -> None:
+ # A run billing stopped is not successful, so leaving it out of the failed count reports it
+ # as neither and the totals stop adding up.
+ endpoint = f"/api/projects/{self.team.id}/data_warehouse/job_stats"
+ source = ExternalDataSource.objects.create(
+ source_id="billing-id",
+ connection_id="conn-id",
+ destination_id="dest-id",
+ team=self.team,
+ source_type="Stripe",
+ )
+ schema = ExternalDataSchema.objects.create(name="charges", team=self.team, source=source)
+
+ ExternalDataJob.objects.create(
+ pipeline_id=source.pk,
+ schema=schema,
+ team=self.team,
+ status=job_status,
+ rows_synced=0,
+ finished_at=timezone.now(),
+ )
+
+ data = self.client.get(endpoint).json()
+
+ self.assertEqual(data["external_data_jobs"]["total"], 1)
+ self.assertEqual(data["external_data_jobs"]["failed"], 1)
+ self.assertEqual(data["external_data_jobs"]["successful"], 0)
+ self.assertEqual(data["failed_jobs"], 1)
+
+ @parameterized.expand(
+ [
+ ("failed", ExternalDataSchema.Status.FAILED, "failed"),
+ ("billing_limit_reached", ExternalDataSchema.Status.BILLING_LIMIT_REACHED, "billing_limit"),
+ ("billing_limit_too_low", ExternalDataSchema.Status.BILLING_LIMIT_TOO_LOW, "billing_limit"),
+ ]
+ )
+ def test_data_health_issues_reports_a_stopped_sync(
+ self, _name: str, schema_status: str, expected_status: str
+ ) -> None:
+ # A sync billing stopped used to be absent from the health list entirely, so the one place
+ # that says why a pipeline stopped said nothing at all.
+ endpoint = f"/api/projects/{self.team.id}/data_warehouse/data_health_issues"
+ source = ExternalDataSource.objects.create(
+ source_id="health-id",
+ connection_id="conn-id",
+ destination_id="dest-id",
+ team=self.team,
+ source_type="Stripe",
+ )
+ ExternalDataSchema.objects.create(
+ name="charges",
+ team=self.team,
+ source=source,
+ should_sync=True,
+ status=schema_status,
+ latest_error="it broke",
+ )
+
+ results = self.client.get(endpoint).json()["results"]
+
+ syncs = [issue for issue in results if issue["type"] == "external_data_sync"]
+ self.assertEqual(len(syncs), 1)
+ self.assertEqual(syncs[0]["status"], expected_status)
+ self.assertEqual(syncs[0]["name"], "charges")
+ self.assertEqual(syncs[0]["error"], "it broke")
+
+ def test_data_health_issues_ignores_a_sync_that_is_switched_off(self) -> None:
+ # A table the user turned off is not a problem to report, however it last ended.
+ endpoint = f"/api/projects/{self.team.id}/data_warehouse/data_health_issues"
+ source = ExternalDataSource.objects.create(
+ source_id="off-id",
+ connection_id="conn-id",
+ destination_id="dest-id",
+ team=self.team,
+ source_type="Stripe",
+ )
+ ExternalDataSchema.objects.create(
+ name="charges",
+ team=self.team,
+ source=source,
+ should_sync=False,
+ status=ExternalDataSchema.Status.FAILED,
+ )
+
+ results = self.client.get(endpoint).json()["results"]
+
+ self.assertEqual([issue for issue in results if issue["type"] == "external_data_sync"], [])
+
+ @parameterized.expand(
+ [
+ ("failed", ExternalDataJob.Status.FAILED),
+ ("billing_limit_reached", ExternalDataJob.Status.BILLING_LIMIT_REACHED),
+ ("billing_limit_too_low", ExternalDataJob.Status.BILLING_LIMIT_TOO_LOW),
+ ]
+ )
+ def test_completed_activity_can_return_failed_runs(self, _name: str, job_status: str) -> None:
+ # Before this parameter, no endpoint listed failed runs across sources: running_activity
+ # is Running-only and this one was Completed-only, so a failure was visible only by
+ # opening each source in turn.
+ endpoint = f"/api/projects/{self.team.id}/data_warehouse/completed_activity"
+ source = ExternalDataSource.objects.create(
+ source_id="activity-id",
+ connection_id="conn-id",
+ destination_id="dest-id",
+ team=self.team,
+ source_type="Stripe",
+ )
+ schema = ExternalDataSchema.objects.create(name="charges", team=self.team, source=source)
+ ExternalDataJob.objects.create(
+ pipeline_id=source.pk,
+ schema=schema,
+ team=self.team,
+ status=job_status,
+ rows_synced=0,
+ finished_at=timezone.now(),
+ )
+ ExternalDataJob.objects.create(
+ pipeline_id=source.pk,
+ schema=schema,
+ team=self.team,
+ status=ExternalDataJob.Status.COMPLETED,
+ rows_synced=5,
+ finished_at=timezone.now(),
+ )
+
+ failed = self.client.get(f"{endpoint}?outcome=failed").json()["results"]
+ completed = self.client.get(endpoint).json()["results"]
+
+ self.assertEqual([run["status"] for run in failed], [job_status])
+ # The default is unchanged, so existing callers keep seeing only successful runs.
+ self.assertEqual([run["status"] for run in completed], [ExternalDataJob.Status.COMPLETED])
+
+ def test_completed_activity_rejects_an_unknown_outcome(self) -> None:
+ endpoint = f"/api/projects/{self.team.id}/data_warehouse/completed_activity"
+
+ response = self.client.get(f"{endpoint}?outcome=sideways")
+
+ self.assertEqual(response.status_code, 400)
+
+ def test_the_cache_key_separates_teams_windows_and_aggregates(self) -> None:
+ # The team is part of the key rather than a filter applied to a cached answer. A key that
+ # dropped it would serve one team another team's totals for the whole TTL.
+ self.assertNotEqual(_pipeline_stats_cache_key("job_stats", 1, 7), _pipeline_stats_cache_key("job_stats", 2, 7))
+ # Without the window, asking for 30 days right after 1 day returns the one-day answer.
+ self.assertNotEqual(_pipeline_stats_cache_key("job_stats", 1, 1), _pipeline_stats_cache_key("job_stats", 1, 30))
+ self.assertNotEqual(_pipeline_stats_cache_key("job_stats", 1), _pipeline_stats_cache_key("total_rows_stats", 1))
+
def test_job_stats_1_day_hourly_breakdown(self):
"""Test job_stats endpoint with 1-day period returns hourly breakdown"""
endpoint = f"/api/projects/{self.team.id}/data_warehouse/job_stats"
@@ -696,11 +850,14 @@ class TestDataHealthIssuesPersonalAPIKey(APIBaseTest):
The custom action is not one of the default read actions, so without an explicit
`required_scopes` it returned None and rejected all personal API key access with a 403.
The action now declares `warehouse_view:read` + `external_data_source:read`, matching the
- MCP tool definition.
+ MCP tool definition, plus `batch_export:read` and `hog_function:read` since the response
+ also includes batch export and HogFunction names, ids, statuses, and error messages.
"""
CONFIG_AUTO_LOGIN = False
+ ALL_REQUIRED_SCOPES = ["warehouse_view:read", "external_data_source:read", "batch_export:read", "hog_function:read"]
+
def _get(self, value: str):
return self.client.get(
f"/api/projects/{self.team.id}/data_warehouse/data_health_issues/",
@@ -709,7 +866,7 @@ class TestDataHealthIssuesPersonalAPIKey(APIBaseTest):
@parameterized.expand(
[
- ("both_read_scopes", ["warehouse_view:read", "external_data_source:read"]),
+ ("all_read_scopes", ALL_REQUIRED_SCOPES),
("wildcard", ["*"]),
]
)
@@ -721,9 +878,13 @@ class TestDataHealthIssuesPersonalAPIKey(APIBaseTest):
@parameterized.expand(
[
- # Both scopes are required; only one is insufficient.
+ # All four scopes are required; missing any one is insufficient.
("only_warehouse_view", ["warehouse_view:read"]),
("only_external_data_source", ["external_data_source:read"]),
+ ("only_batch_export", ["batch_export:read"]),
+ ("only_hog_function", ["hog_function:read"]),
+ ("missing_batch_export", ["warehouse_view:read", "external_data_source:read", "hog_function:read"]),
+ ("missing_hog_function", ["warehouse_view:read", "external_data_source:read", "batch_export:read"]),
("unrelated_scope", ["insight:read"]),
]
)
diff --git a/products/data_warehouse/frontend/generated/api.schemas.ts b/products/data_warehouse/frontend/generated/api.schemas.ts
index ec1c180e9101..0b13e117d6ce 100644
--- a/products/data_warehouse/frontend/generated/api.schemas.ts
+++ b/products/data_warehouse/frontend/generated/api.schemas.ts
@@ -91,6 +91,105 @@ export interface CheckSchemaNameResponseApi {
available: boolean
}
+export interface PipelineActivityRowApi {
+ /** Run id. */
+ id: string
+ /**
+ * The source type for a sync, or 'Materialized view' for a model run.
+ * @nullable
+ */
+ type: string | null
+ /**
+ * Table or view the run wrote.
+ * @nullable
+ */
+ name: string | null
+ /** Run status. One of: Running, Completed, Failed, BillingLimitReached, BillingLimitTooLow. */
+ status: string
+ /** Rows the run wrote. Zero while it is still going. */
+ rows: number
+ /** When the run was created. There is no separate start time. */
+ created_at: string
+ /**
+ * When the run ended, or null while running.
+ * @nullable
+ */
+ finished_at: string | null
+ /**
+ * Error the run ended with, if any.
+ * @nullable
+ */
+ latest_error: string | null
+ /**
+ * Temporal run id, for finding the run's logs.
+ * @nullable
+ */
+ workflow_run_id: string | null
+ /**
+ * Where a materialized view came from. Null for syncs.
+ * @nullable
+ */
+ origin: string | null
+}
+
+export interface PipelineActivityResponseApi {
+ /** Runs, newest first. */
+ results: PipelineActivityRowApi[]
+ /**
+ * Query string for the next page, or null on the last.
+ * @nullable
+ */
+ next: string | null
+ /**
+ * Query string for the previous page, or null on the first.
+ * @nullable
+ */
+ previous: string | null
+}
+
+export interface PipelineErrorApi {
+ /** What went wrong, for a reader rather than a parser. */
+ error: string
+}
+
+export interface DataHealthIssueApi {
+ /** Id of the thing that is unhealthy. */
+ id: string
+ /** Table, view or export the issue is about. */
+ name: string
+ /** What kind of thing is unhealthy. One of: materialized_view, external_data_sync, source, destination, transformation. */
+ type: string
+ /**
+ * Source type for a sync issue, for example 'Stripe'.
+ * @nullable
+ */
+ source_type?: string | null
+ /** Why it is unhealthy. One of: failed, disabled, degraded, billing_limit. */
+ status: string
+ /**
+ * The error, where one was recorded.
+ * @nullable
+ */
+ error: string | null
+ /**
+ * When it last failed.
+ * @nullable
+ */
+ failed_at: string | null
+ /**
+ * Where to go to fix it.
+ * @nullable
+ */
+ url: string | null
+}
+
+export interface DataHealthIssuesResponseApi {
+ /** Everything currently unhealthy. */
+ results: DataHealthIssueApi[]
+ /** How many issues are in `results`. */
+ count: number
+}
+
/**
* The team-level materialization gate. Checks always run and warn; this only toggles blocking.
*/
@@ -121,6 +220,48 @@ export interface DeprovisionWarehouseResponseApi {
org: string
}
+export interface JobStatsBucketApi {
+ /** Runs that completed in this bucket. */
+ successful: number
+ /** Runs that failed in this bucket. */
+ failed: number
+}
+
+/**
+ * Runs per time bucket, keyed by ISO hour when days=1 and by ISO date otherwise. Buckets with no runs are absent rather than zero.
+ */
+export type PipelineJobStatsResponseApiBreakdown = { [key: string]: JobStatsBucketApi }
+
+export interface JobCountsApi {
+ /** Runs that finished inside the window. */
+ total: number
+ /** Runs in flight right now, regardless of the window. */
+ running: number
+ /** Runs that completed. */
+ successful: number
+ /** Runs that errored or that billing stopped. */
+ failed: number
+}
+
+export interface PipelineJobStatsResponseApi {
+ /** Window the counts cover, in days. One of 1, 7 or 30. */
+ days: number
+ /** Start of the window, in the project's timezone. */
+ cutoff_time: string
+ /** Sync runs plus materialization runs in the window. */
+ total_jobs: number
+ /** Sync and materialization runs that completed. */
+ successful_jobs: number
+ /** Sync and materialization runs that failed. */
+ failed_jobs: number
+ /** Counts for warehouse source syncs alone. */
+ external_data_jobs: JobCountsApi
+ /** Counts for materialized view runs alone. */
+ modeling_jobs: JobCountsApi
+ /** Runs per time bucket, keyed by ISO hour when days=1 and by ISO date otherwise. Buckets with no runs are absent rather than zero. */
+ breakdown: PipelineJobStatsResponseApiBreakdown
+}
+
/**
* * `not_configured` - not_configured
* * `waiting` - waiting
@@ -596,6 +737,41 @@ export interface ResetPasswordResponseApi {
password: string
}
+/**
+ * Rows synced in the billing period, keyed by source id.
+ */
+export type PipelineRowsStatsResponseApiBreakdownOfRowsBySource = { [key: string]: number }
+
+export interface PipelineRowsStatsResponseApi {
+ /** Whether billing answered. When false, only the counts derived from runs are meaningful. */
+ billing_available: boolean
+ /**
+ * Length of the billing period, for example 'month'.
+ * @nullable
+ */
+ billing_interval: string | null
+ /**
+ * Start of the current billing period.
+ * @nullable
+ */
+ billing_period_start: string | null
+ /**
+ * End of the current billing period.
+ * @nullable
+ */
+ billing_period_end: string | null
+ /** Rows synced in the billing period, billed and not yet billed. */
+ total_rows: number
+ /** Rows billing has already counted. */
+ tracked_billing_rows: number
+ /** Rows synced since billing last counted. */
+ pending_billing_rows: number
+ /** Rows written by materialized view runs in the billing period. */
+ materialized_rows_in_billing_period: number
+ /** Rows synced in the billing period, keyed by source id. */
+ breakdown_of_rows_by_source: PipelineRowsStatsResponseApiBreakdownOfRowsBySource
+}
+
/**
* * `pending` - pending
* * `provisioning` - provisioning
@@ -5083,6 +5259,57 @@ export type DataWarehouseCheckSchemaNameRetrieveParams = {
name: string
}
+export type DataWarehouseCompletedActivityRetrieveParams = {
+ /**
+ * Only include runs created within this many days of now. Defaults to 30.
+ */
+ cutoff_days?: number
+ /**
+ * Max rows to return. Capped at 50 server-side. Defaults to 20.
+ */
+ limit?: number
+ /**
+ * Rows to skip, for pagination. Defaults to 0.
+ */
+ offset?: number
+ /**
+ * Which outcome to return: 'completed' or 'failed'. Defaults to 'completed'.
+ *
+ * * `completed` - completed
+ * * `failed` - failed
+ * @minLength 1
+ */
+ outcome?: DataWarehouseCompletedActivityRetrieveOutcome
+}
+
+export type DataWarehouseCompletedActivityRetrieveOutcome =
+ (typeof DataWarehouseCompletedActivityRetrieveOutcome)[keyof typeof DataWarehouseCompletedActivityRetrieveOutcome]
+
+export const DataWarehouseCompletedActivityRetrieveOutcome = {
+ Completed: 'completed',
+ Failed: 'failed',
+} as const
+
+export type DataWarehouseJobStatsRetrieveParams = {
+ /**
+ * Window the counts should cover, in days. One of 1, 7 or 30. Defaults to 7.
+ *
+ * * `1` - 1
+ * * `7` - 7
+ * * `30` - 30
+ */
+ days?: DataWarehouseJobStatsRetrieveDays
+}
+
+export type DataWarehouseJobStatsRetrieveDays =
+ (typeof DataWarehouseJobStatsRetrieveDays)[keyof typeof DataWarehouseJobStatsRetrieveDays]
+
+export const DataWarehouseJobStatsRetrieveDays = {
+ Number1: 1,
+ Number7: 7,
+ Number30: 30,
+} as const
+
export type DataWarehouseManagedWarehouseMonitoringTimeseriesRetrieveParams = {
/**
* Allow-listed managed warehouse metric to retrieve.
diff --git a/products/data_warehouse/frontend/generated/api.ts b/products/data_warehouse/frontend/generated/api.ts
index 47829934bbd7..5bc72816e4ac 100644
--- a/products/data_warehouse/frontend/generated/api.ts
+++ b/products/data_warehouse/frontend/generated/api.ts
@@ -13,12 +13,15 @@ import type {
CheckIncrementalApi,
CheckSchemaNameResponseApi,
CreateTableFromUploadApi,
+ DataHealthIssuesResponseApi,
DataModelingJobApi,
DataModelingJobsListParams,
DataQualityGateConfigApi,
DataWarehouseCheckDatabaseNameRetrieveParams,
DataWarehouseCheckSchemaNameRetrieveParams,
+ DataWarehouseCompletedActivityRetrieveParams,
DataWarehouseExpressionApi,
+ DataWarehouseJobStatsRetrieveParams,
DataWarehouseManagedViewSetApi,
DataWarehouseManagedViewSetResponseApi,
DataWarehouseManagedViewSetUpdateResponseApi,
@@ -62,6 +65,9 @@ import type {
PatchedTableApi,
PatchedViewLinkApi,
PatchedWarehouseColumnAnnotationApi,
+ PipelineActivityResponseApi,
+ PipelineJobStatsResponseApi,
+ PipelineRowsStatsResponseApi,
ProvisionWarehouseRequestApi,
ProvisionWarehouseResponseApi,
QueryTabStateApi,
@@ -258,8 +264,23 @@ export const dataWarehouseCheckSchemaNameRetrieve = async (
})
}
-export const getDataWarehouseCompletedActivityRetrieveUrl = (projectId: string) => {
- return `/api/projects/${projectId}/data_warehouse/completed_activity/`
+export const getDataWarehouseCompletedActivityRetrieveUrl = (
+ projectId: string,
+ params?: DataWarehouseCompletedActivityRetrieveParams
+) => {
+ const normalizedParams = new URLSearchParams()
+
+ Object.entries(params || {}).forEach(([key, value]) => {
+ if (value !== undefined) {
+ normalizedParams.append(key, value === null ? 'null' : String(value))
+ }
+ })
+
+ const stringifiedParams = normalizedParams.toString()
+
+ return stringifiedParams.length > 0
+ ? `/api/projects/${projectId}/data_warehouse/completed_activity/?${stringifiedParams}`
+ : `/api/projects/${projectId}/data_warehouse/completed_activity/`
}
/**
@@ -268,9 +289,10 @@ export const getDataWarehouseCompletedActivityRetrieveUrl = (projectId: string)
*/
export const dataWarehouseCompletedActivityRetrieve = async (
projectId: string,
+ params?: DataWarehouseCompletedActivityRetrieveParams,
options?: RequestInit
-): Promise<void> => {
- return apiMutator<void>(getDataWarehouseCompletedActivityRetrieveUrl(projectId), {
+): Promise<PipelineActivityResponseApi> => {
+ return apiMutator<PipelineActivityResponseApi>(getDataWarehouseCompletedActivityRetrieveUrl(projectId, params), {
...options,
method: 'GET',
})
@@ -287,8 +309,8 @@ export const getDataWarehouseDataHealthIssuesRetrieveUrl = (projectId: string) =
export const dataWarehouseDataHealthIssuesRetrieve = async (
projectId: string,
options?: RequestInit
-): Promise<void> => {
- return apiMutator<void>(getDataWarehouseDataHealthIssuesRetrieveUrl(projectId), {
+): Promise<DataHealthIssuesResponseApi> => {
+ return apiMutator<DataHealthIssuesResponseApi>(getDataWarehouseDataHealthIssuesRetrieveUrl(projectId), {
...options,
method: 'GET',
})
@@ -386,16 +408,35 @@ export const dataWarehouseDeprovisionCreate = async (
})
}
-export const getDataWarehouseJobStatsRetrieveUrl = (projectId: string) => {
- return `/api/projects/${projectId}/data_warehouse/job_stats/`
+export const getDataWarehouseJobStatsRetrieveUrl = (
+ projectId: string,
+ params?: DataWarehouseJobStatsRetrieveParams
+) => {
+ const normalizedParams = new URLSearchParams()
+
+ Object.entries(params || {}).forEach(([key, value]) => {
+ if (value !== undefined) {
+ normalizedParams.append(key, value === null ? 'null' : String(value))
+ }
+ })
+
+ const stringifiedParams = normalizedParams.toString()
+
+ return stringifiedParams.length > 0
+ ? `/api/projects/${projectId}/data_warehouse/job_stats/?${stringifiedParams}`
+ : `/api/projects/${projectId}/data_warehouse/job_stats/`
}
/**
* Returns success and failed job statistics for the last 1, 7, or 30 days.
* Query parameter 'days' can be 1, 7, or 30 (default: 7).
*/
-export const dataWarehouseJobStatsRetrieve = async (projectId: string, options?: RequestInit): Promise<void> => {
- return apiMutator<void>(getDataWarehouseJobStatsRetrieveUrl(projectId), {
+export const dataWarehouseJobStatsRetrieve = async (
+ projectId: string,
+ params?: DataWarehouseJobStatsRetrieveParams,
+ options?: RequestInit
+): Promise<PipelineJobStatsResponseApi> => {
+ return apiMutator<PipelineJobStatsResponseApi>(getDataWarehouseJobStatsRetrieveUrl(projectId, params), {
...options,
method: 'GET',
})
@@ -598,8 +639,11 @@ export const getDataWarehouseRunningActivityRetrieveUrl = (projectId: string) =>
* Returns currently running activities (jobs with status 'Running').
* Supports pagination and cutoff time filtering.
*/
-export const dataWarehouseRunningActivityRetrieve = async (projectId: string, options?: RequestInit): Promise<void> => {
- return apiMutator<void>(getDataWarehouseRunningActivityRetrieveUrl(projectId), {
+export const dataWarehouseRunningActivityRetrieve = async (
+ projectId: string,
+ options?: RequestInit
+): Promise<PipelineActivityResponseApi> => {
+ return apiMutator<PipelineActivityResponseApi>(getDataWarehouseRunningActivityRetrieveUrl(projectId), {
...options,
method: 'GET',
})
@@ -613,8 +657,11 @@ export const getDataWarehouseTotalRowsStatsRetrieveUrl = (projectId: string) =>
* Returns aggregated statistics for the data warehouse total rows processed within the current billing period.
* Used by the frontend data warehouse scene to display usage information.
*/
-export const dataWarehouseTotalRowsStatsRetrieve = async (projectId: string, options?: RequestInit): Promise<void> => {
- return apiMutator<void>(getDataWarehouseTotalRowsStatsRetrieveUrl(projectId), {
+export const dataWarehouseTotalRowsStatsRetrieve = async (
+ projectId: string,
+ options?: RequestInit
+): Promise<PipelineRowsStatsResponseApi> => {
+ return apiMutator<PipelineRowsStatsResponseApi>(getDataWarehouseTotalRowsStatsRetrieveUrl(projectId), {
...options,
method: 'GET',
})
diff --git a/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/PipelineHealth.tsx b/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/PipelineHealth.tsx
new file mode 100644
index 000000000000..1eaa18139e1d
--- /dev/null
+++ b/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/PipelineHealth.tsx
@@ -0,0 +1,107 @@
+import { useValues } from 'kea'
+
+import { LemonSkeleton, LemonTable, LemonTag, Link } from '@posthog/lemon-ui'
+import type { LemonTagType } from '@posthog/lemon-ui'
+
+import { TZLabel } from 'lib/components/TZLabel'
+
+import type { DataHealthIssueApi } from 'products/data_warehouse/frontend/generated/api.schemas'
+
+import { pipelineOverviewSceneLogic } from './pipelineOverviewSceneLogic'
+
+const STATUS_LABELS: Record<string, string> = {
+ failed: 'Failed',
+ billing_limit: 'Billing limit',
+ degraded: 'Degraded',
+ disabled: 'Disabled',
+}
+
+const STATUS_TAG_TYPES: Record<string, LemonTagType> = {
+ failed: 'danger',
+ billing_limit: 'warning',
+ degraded: 'warning',
+ disabled: 'muted',
+}
+
+const TYPE_LABELS: Record<string, string> = {
+ external_data_sync: 'Sync',
+ materialized_view: 'Materialized view',
+ source: 'Source',
+ destination: 'Destination',
+ transformation: 'Transformation',
+}
+
+export function PipelineHealth(): JSX.Element {
+ const { issuesBySeverity, healthIssues, healthIssuesLoading } = useValues(pipelineOverviewSceneLogic)
+
+ if (healthIssuesLoading && healthIssues === null) {
+ return <LemonSkeleton className="h-32 w-full" />
+ }
+
+ if (healthIssues !== null && issuesBySeverity.length === 0) {
+ return (
+ <div className="rounded border border-primary bg-surface-primary px-4 py-6 text-center text-muted">
+ Every pipeline is healthy.
+ </div>
+ )
+ }
+
+ return (
+ <LemonTable<DataHealthIssueApi>
+ id="etl-health"
+ dataSource={issuesBySeverity}
+ rowKey="id"
+ size="small"
+ loading={healthIssuesLoading && healthIssues !== null}
+ nouns={['issue', 'issues']}
+ columns={[
+ {
+ title: 'What',
+ key: 'name',
+ render: (_, issue) => (
+ <div className="flex min-w-0 flex-col">
+ {issue.url ? (
+ <Link to={issue.url} className="truncate font-medium">
+ {issue.name}
+ </Link>
+ ) : (
+ <span className="truncate font-medium">{issue.name}</span>
+ )}
+ <span className="text-xs text-muted">
+ {TYPE_LABELS[issue.type] ?? issue.type}
+ {issue.source_type ? ` · ${issue.source_type}` : ''}
+ </span>
+ </div>
+ ),
+ },
+ {
+ title: 'Status',
+ key: 'status',
+ width: 140,
+ render: (_, issue) => (
+ <LemonTag type={STATUS_TAG_TYPES[issue.status] ?? 'default'}>
+ {STATUS_LABELS[issue.status] ?? issue.status}
+ </LemonTag>
+ ),
+ },
+ {
+ title: 'Error',
+ key: 'error',
+ render: (_, issue) =>
+ issue.error ? (
+ <span className="line-clamp-2 font-mono text-xs text-secondary">{issue.error}</span>
+ ) : (
+ <span className="text-muted">—</span>
+ ),
+ },
+ {
+ title: 'Since',
+ key: 'failed_at',
+ width: 140,
+ render: (_, issue) =>
+ issue.failed_at ? <TZLabel time={issue.failed_at} /> : <span className="text-muted">—</span>,
+ },
+ ]}
+ />
+ )
+}
diff --git a/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/PipelineOverviewScene.stories.tsx b/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/PipelineOverviewScene.stories.tsx
new file mode 100644
index 000000000000..c9d867294e1c
--- /dev/null
+++ b/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/PipelineOverviewScene.stories.tsx
@@ -0,0 +1,129 @@
+import { Meta, StoryFn } from '@storybook/react'
+
+import { FEATURE_FLAGS } from 'lib/constants'
+
+import { mswDecorator } from '~/mocks/browser'
+
+import { PipelineOverviewScene } from './PipelineOverviewScene'
+
+const HEALTHY = { results: [], count: 0 }
+
+const UNHEALTHY = {
+ count: 3,
+ results: [
+ {
+ id: '1',
+ name: 'charges',
+ type: 'external_data_sync',
+ source_type: 'Stripe',
+ status: 'failed',
+ error: 'Authentication error: expired API key',
+ failed_at: '2026-09-21T04:15:00Z',
+ url: '/data-management/sources/1',
+ },
+ {
+ id: '2',
+ name: 'public.invoices',
+ type: 'external_data_sync',
+ source_type: 'Postgres',
+ status: 'billing_limit',
+ error: 'Billing limit reached for this period',
+ failed_at: '2026-09-24T02:00:00Z',
+ url: '/data-management/sources/2',
+ },
+ {
+ id: '3',
+ name: 'account_activity',
+ type: 'materialized_view',
+ status: 'degraded',
+ error: null,
+ failed_at: '2026-09-25T09:00:00Z',
+ url: '/data-warehouse/view/3',
+ },
+ ],
+}
+
+const JOB_STATS = {
+ days: 7,
+ cutoff_time: '2026-09-18T00:00:00Z',
+ total_jobs: 412,
+ successful_jobs: 401,
+ failed_jobs: 11,
+ external_data_jobs: { total: 380, running: 3, successful: 371, failed: 9 },
+ modeling_jobs: { total: 32, running: 1, successful: 30, failed: 2 },
+ breakdown: {},
+}
+
+const ROWS_STATS = {
+ billing_available: true,
+ billing_interval: 'month',
+ billing_period_start: '2026-09-01T00:00:00Z',
+ billing_period_end: '2026-10-01T00:00:00Z',
+ total_rows: 48200000,
+ tracked_billing_rows: 46000000,
+ pending_billing_rows: 2200000,
+ materialized_rows_in_billing_period: 1200000,
+ breakdown_of_rows_by_source: {},
+}
+
+const FAILED_RUNS = {
+ next: null,
+ previous: null,
+ results: [
+ {
+ id: 'run-1',
+ type: 'Stripe',
+ name: 'charges',
+ status: 'Failed',
+ rows: 0,
+ created_at: '2026-09-25T08:00:00Z',
+ finished_at: '2026-09-25T08:01:00Z',
+ latest_error: 'Authentication error: expired API key',
+ workflow_run_id: 'wf-1',
+ origin: null,
+ },
+ {
+ id: 'run-2',
+ type: 'Salesforce',
+ name: 'opportunity',
+ status: 'Failed',
+ rows: 0,
+ created_at: '2026-09-25T05:40:00Z',
+ finished_at: '2026-09-25T05:41:00Z',
+ latest_error: 'Schema drift: column "forecast_category" changed type text to numeric',
+ workflow_run_id: 'wf-2',
+ origin: null,
+ },
+ ],
+}
+
+function mocks(health: Record<string, unknown>, runs: Record<string, unknown>): ReturnType<typeof mswDecorator> {
+ return mswDecorator({
+ get: {
+ '/api/projects/:team_id/data_warehouse/job_stats': JOB_STATS,
+ '/api/projects/:team_id/data_warehouse/total_rows_stats': ROWS_STATS,
+ '/api/projects/:team_id/data_warehouse/data_health_issues': health,
+ '/api/projects/:team_id/data_warehouse/completed_activity': runs,
+ },
+ })
+}
+
+const meta: Meta<typeof PipelineOverviewScene> = {
+ title: 'Scenes-App/ETL',
+ component: PipelineOverviewScene,
+ parameters: {
+ layout: 'fullscreen',
+ viewMode: 'story',
+ // The scene refuses to render without this, so every story has to carry it.
+ featureFlags: [FEATURE_FLAGS.WAREHOUSE_MULTI_DESTINATION],
+ },
+}
+export default meta
+
+const Template: StoryFn = () => <PipelineOverviewScene />
+
+export const NeedsAttention = Template.bind({})
+NeedsAttention.decorators = [mocks(UNHEALTHY, FAILED_RUNS)]
+
+export const Healthy = Template.bind({})
+Healthy.decorators = [mocks(HEALTHY, { results: [], next: null, previous: null })]
diff --git a/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/PipelineOverviewScene.tsx b/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/PipelineOverviewScene.tsx
new file mode 100644
index 000000000000..1f04e81bfa1b
--- /dev/null
+++ b/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/PipelineOverviewScene.tsx
@@ -0,0 +1,131 @@
+import { useActions, useValues } from 'kea'
+
+import { IconPlusSmall, IconRefresh } from '@posthog/icons'
+import { LemonButton, LemonSelect, Link } from '@posthog/lemon-ui'
+
+import { NotFound } from 'lib/components/NotFound'
+import { FEATURE_FLAGS } from 'lib/constants'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { SceneExport } from 'scenes/sceneTypes'
+import { urls } from 'scenes/urls'
+
+import { SceneContent } from '~/layout/scenes/components/SceneContent'
+import { SceneDivider } from '~/layout/scenes/components/SceneDivider'
+import { SceneSection } from '~/layout/scenes/components/SceneSection'
+import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
+import { ProductKey } from '~/queries/schema/schema-general'
+
+import { PipelineHealth } from './PipelineHealth'
+import type { PipelineStatsWindow } from './pipelineOverviewSceneLogic'
+import { pipelineOverviewSceneLogic } from './pipelineOverviewSceneLogic'
+import { PipelineStatTiles } from './PipelineStatTiles'
+import { RecentFailures } from './RecentFailures'
+
+export const scene: SceneExport = {
+ component: PipelineOverviewScene,
+ logic: pipelineOverviewSceneLogic,
+ productKey: ProductKey.DATA_WAREHOUSE,
+}
+
+export function PipelineOverviewScene(): JSX.Element {
+ const { featureFlags, receivedFeatureFlags } = useValues(featureFlagLogic)
+ const { window, jobStatsLoading } = useValues(pipelineOverviewSceneLogic)
+ const { setWindow, refresh } = useActions(pipelineOverviewSceneLogic)
+
+ // Wait for the flags to land before refusing. Rendering NotFound first and the scene a beat
+ // later reads as a broken page to anyone who does have the flag.
+ if (receivedFeatureFlags && !featureFlags[FEATURE_FLAGS.WAREHOUSE_MULTI_DESTINATION]) {
+ return <NotFound object="page" caption="ETL isn't available for this project yet." />
+ }
+
+ return (
+ <SceneContent className="pb-4">
+ <SceneTitleSection
+ name="ETL"
+ description="Every source you import from and every destination you write to, with the health of each."
+ resourceType={{ type: 'data_pipeline' }}
+ actions={
+ <div className="flex flex-wrap gap-2">
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconRefresh />}
+ onClick={refresh}
+ loading={jobStatsLoading}
+ data-attr="etl-refresh"
+ >
+ Refresh
+ </LemonButton>
+ <LemonButton
+ type="primary"
+ size="small"
+ icon={<IconPlusSmall />}
+ to={urls.dataPipelinesNew('source')}
+ data-attr="etl-new-source"
+ >
+ New source
+ </LemonButton>
+ </div>
+ }
+ />
+
+ <PipelineStatTiles />
+
+ <SceneDivider />
+
+ <SceneSection
+ title="Needs attention"
+ description="Worst first. A pipeline stopped by a billing limit counts as needing attention."
+ >
+ <PipelineHealth />
+ </SceneSection>
+
+ <SceneDivider />
+
+ <SceneSection
+ title="Runs"
+ description="How many runs finished, and how many of them failed."
+ actions={
+ <LemonSelect<PipelineStatsWindow>
+ size="small"
+ value={window}
+ onChange={setWindow}
+ data-attr="etl-window"
+ options={[
+ { value: 1, label: 'Last 24 hours' },
+ { value: 7, label: 'Last 7 days' },
+ { value: 30, label: 'Last 30 days' },
+ ]}
+ />
+ }
+ >
+ <RecentFailures />
+ </SceneSection>
+
+ <SceneDivider />
+
+ <SceneSection
+ title="Sources and destinations"
+ description="Connect a source, and choose where its tables are written."
+ >
+ <div className="flex flex-wrap gap-2">
+ <LemonButton type="secondary" size="small" to={urls.sources()} data-attr="etl-sources">
+ Manage sources
+ </LemonButton>
+ <LemonButton
+ type="secondary"
+ size="small"
+ to={urls.warehouseDestinations()}
+ data-attr="etl-destinations"
+ >
+ Manage destinations
+ </LemonButton>
+ </div>
+ <p className="mt-2 mb-0 text-xs text-muted">
+ Pipeline failures are also listed on <Link to={urls.pipelineStatus()}>Pipeline status</Link>, which
+ covers materialized views and batch exports too.
+ </p>
+ </SceneSection>
+ </SceneContent>
+ )
+}
diff --git a/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/PipelineStatTiles.tsx b/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/PipelineStatTiles.tsx
new file mode 100644
index 000000000000..bebbaead9c80
--- /dev/null
+++ b/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/PipelineStatTiles.tsx
@@ -0,0 +1,88 @@
+import { useValues } from 'kea'
+
+import { LemonCard, LemonSkeleton } from '@posthog/lemon-ui'
+
+import { humanFriendlyLargeNumber, humanFriendlyNumber } from 'lib/utils/numbers'
+
+import { pipelineOverviewSceneLogic } from './pipelineOverviewSceneLogic'
+
+interface StatTileProps {
+ label: string
+ value: string
+ /** Full value, shown on hover when `value` is compacted. */
+ exact?: string
+ sub?: string
+ loading: boolean
+ danger?: boolean
+}
+
+function StatTile({ label, value, exact, sub, loading, danger }: StatTileProps): JSX.Element {
+ return (
+ <LemonCard hoverEffect={false} className="flex min-w-40 flex-1 flex-col justify-center px-4 py-3">
+ <div className="text-xs font-medium text-secondary">{label}</div>
+ {/* Skeleton the whole tile on a first load rather than showing a zero that is about
+ to change, which reads as a real answer. */}
+ {loading ? (
+ <LemonSkeleton className="my-1 h-7 w-20" />
+ ) : (
+ <div
+ className={`my-0.5 truncate text-2xl font-bold tabular-nums ${danger ? 'text-danger' : ''}`}
+ title={exact}
+ >
+ {value}
+ </div>
+ )}
+ {sub ? <div className="text-xs text-muted">{sub}</div> : null}
+ </LemonCard>
+ )
+}
+
+export function PipelineStatTiles(): JSX.Element {
+ const {
+ jobStats,
+ jobStatsLoading,
+ rowsStats,
+ rowsStatsLoading,
+ healthIssues,
+ healthIssuesLoading,
+ failingSyncCount,
+ } = useValues(pipelineOverviewSceneLogic)
+
+ const issueCount = healthIssues?.count ?? 0
+ const running = (jobStats?.external_data_jobs?.running ?? 0) + (jobStats?.modeling_jobs?.running ?? 0)
+
+ return (
+ <div className="@container">
+ <div className="grid grid-cols-2 gap-3 @3xl:grid-cols-4">
+ <StatTile
+ label="Rows synced this billing period"
+ // Compacted, because a busy team's row count runs to ten digits and would
+ // otherwise wrap out of the tile.
+ value={humanFriendlyLargeNumber(rowsStats?.total_rows ?? 0)}
+ exact={humanFriendlyNumber(rowsStats?.total_rows ?? 0)}
+ sub={rowsStats?.billing_available ? undefined : 'Billing is unavailable, so this may be behind'}
+ loading={rowsStatsLoading && rowsStats === null}
+ />
+ <StatTile
+ label="Runs"
+ value={humanFriendlyNumber(jobStats?.total_jobs ?? 0)}
+ sub={`${humanFriendlyNumber(jobStats?.successful_jobs ?? 0)} succeeded`}
+ loading={jobStatsLoading && jobStats === null}
+ />
+ <StatTile
+ label="Needs attention"
+ value={humanFriendlyNumber(issueCount)}
+ sub={issueCount > 0 ? `${failingSyncCount} of them syncs` : 'Everything is healthy'}
+ loading={healthIssuesLoading && healthIssues === null}
+ danger={issueCount > 0}
+ />
+ <StatTile
+ label="Running now"
+ value={humanFriendlyNumber(running)}
+ sub="Syncs and materializations"
+ loading={jobStatsLoading && jobStats === null}
+ />
+ </div>
+ </div>
+ )
+}
diff --git a/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/RecentFailures.tsx b/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/RecentFailures.tsx
new file mode 100644
index 000000000000..161c6d174946
--- /dev/null
+++ b/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/RecentFailures.tsx
@@ -0,0 +1,70 @@
+import { useValues } from 'kea'
+
+import { LemonSkeleton, LemonTable, LemonTag } from '@posthog/lemon-ui'
+
+import { TZLabel } from 'lib/components/TZLabel'
+
+import type { PipelineActivityRowApi } from 'products/data_warehouse/frontend/generated/api.schemas'
+
+import { pipelineOverviewSceneLogic } from './pipelineOverviewSceneLogic'
+
+export function RecentFailures(): JSX.Element {
+ const { failedRuns, recentFailures, recentFailuresLoading } = useValues(pipelineOverviewSceneLogic)
+
+ if (recentFailuresLoading && recentFailures === null) {
+ return <LemonSkeleton className="h-24 w-full" />
+ }
+
+ if (recentFailures !== null && failedRuns.length === 0) {
+ return (
+ <div className="rounded border border-primary bg-surface-primary px-4 py-6 text-center text-muted">
+ No runs have failed recently.
+ </div>
+ )
+ }
+
+ return (
+ <LemonTable<PipelineActivityRowApi>
+ id="etl-recent-failures"
+ dataSource={failedRuns}
+ rowKey="id"
+ size="small"
+ loading={recentFailuresLoading && recentFailures !== null}
+ nouns={['run', 'runs']}
+ columns={[
+ {
+ title: 'Table',
+ key: 'name',
+ render: (_, run) => (
+ <div className="flex min-w-0 flex-col">
+ <span className="truncate font-medium">{run.name ?? 'Unnamed'}</span>
+ <span className="text-xs text-muted">{run.type ?? 'Unknown'}</span>
+ </div>
+ ),
+ },
+ {
+ title: 'Status',
+ key: 'status',
+ width: 150,
+ render: (_, run) => <LemonTag type="danger">{run.status}</LemonTag>,
+ },
+ {
+ title: 'Error',
+ key: 'latest_error',
+ render: (_, run) =>
+ run.latest_error ? (
+ <span className="line-clamp-2 font-mono text-xs text-secondary">{run.latest_error}</span>
+ ) : (
+ <span className="text-muted">—</span>
+ ),
+ },
+ {
+ title: 'When',
+ key: 'created_at',
+ width: 140,
+ render: (_, run) => <TZLabel time={run.created_at} />,
+ },
+ ]}
+ />
+ )
+}
diff --git a/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/pipelineOverviewSceneLogic.test.ts b/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/pipelineOverviewSceneLogic.test.ts
new file mode 100644
index 000000000000..8db3f523e79e
--- /dev/null
+++ b/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/pipelineOverviewSceneLogic.test.ts
@@ -0,0 +1,135 @@
+import { expectLogic } from 'kea-test-utils'
+
+import { initKeaTests } from '~/test/init'
+
+import { pipelineOverviewSceneLogic } from './pipelineOverviewSceneLogic'
+
+jest.mock('products/data_warehouse/frontend/generated/api', () => ({
+ dataWarehouseJobStatsRetrieve: jest.fn(),
+ dataWarehouseTotalRowsStatsRetrieve: jest.fn(),
+ dataWarehouseDataHealthIssuesRetrieve: jest.fn(),
+ dataWarehouseCompletedActivityRetrieve: jest.fn(),
+}))
+
+const api = jest.requireMock('products/data_warehouse/frontend/generated/api')
+
+const issue = (overrides: Record<string, any> = {}): Record<string, any> => ({
+ id: 'issue-1',
+ name: 'charges',
+ type: 'external_data_sync',
+ status: 'failed',
+ error: 'it broke',
+ failed_at: '2026-09-25T10:00:00Z',
+ url: '/data-management/sources/1',
+ ...overrides,
+})
+
+describe('pipelineOverviewSceneLogic', () => {
+ let logic: ReturnType<typeof pipelineOverviewSceneLogic.build>
+
+ beforeEach(() => {
+ initKeaTests()
+ api.dataWarehouseJobStatsRetrieve.mockResolvedValue({ days: 7, total_jobs: 0 })
+ api.dataWarehouseTotalRowsStatsRetrieve.mockResolvedValue({ total_rows: 0 })
+ api.dataWarehouseDataHealthIssuesRetrieve.mockResolvedValue({ results: [], count: 0 })
+ api.dataWarehouseCompletedActivityRetrieve.mockResolvedValue({ results: [], next: null, previous: null })
+ logic = pipelineOverviewSceneLogic()
+ logic.mount()
+ })
+
+ afterEach(() => {
+ logic.unmount()
+ jest.clearAllMocks()
+ })
+
+ it('has answered nothing while its loaders are still in flight', () => {
+ // `null` rather than an empty list, so the scene can tell "not asked yet" from "nothing
+ // is wrong" and never renders the healthy state over a pending load.
+ logic.unmount()
+ // A promise the test never settles, so the in-flight state can be asserted rather than raced.
+ api.dataWarehouseDataHealthIssuesRetrieve.mockReturnValue(new Promise(() => {}))
+ api.dataWarehouseJobStatsRetrieve.mockReturnValue(new Promise(() => {}))
+
+ logic.mount()
+
+ expect(logic.values.healthIssues).toBeNull()
+ expect(logic.values.jobStats).toBeNull()
+ expect(logic.values.loadingFirstTime).toBe(true)
+ })
+
+ it('orders issues worst first', async () => {
+ // The point of the section is that the worst pipeline is the one you see, whatever order
+ // the endpoint happened to return.
+ api.dataWarehouseDataHealthIssuesRetrieve.mockResolvedValue({
+ count: 4,
+ results: [
+ issue({ id: 'a', status: 'disabled' }),
+ issue({ id: 'b', status: 'degraded' }),
+ issue({ id: 'c', status: 'failed' }),
+ issue({ id: 'd', status: 'billing_limit' }),
+ ],
+ })
+
+ await expectLogic(logic, () => logic.actions.loadHealthIssues()).toFinishAllListeners()
+
+ expect(logic.values.issuesBySeverity.map((i: any) => i.status)).toEqual([
+ 'failed',
+ 'billing_limit',
+ 'degraded',
+ 'disabled',
+ ])
+ })
+
+ it('counts only syncs as failing syncs', async () => {
+ // The tile says "of them syncs", so a failed materialized view must not inflate it.
+ api.dataWarehouseDataHealthIssuesRetrieve.mockResolvedValue({
+ count: 2,
+ results: [issue({ id: 'a' }), issue({ id: 'b', type: 'materialized_view' })],
+ })
+
+ await expectLogic(logic, () => logic.actions.loadHealthIssues()).toFinishAllListeners()
+
+ expect(logic.values.failingSyncCount).toEqual(1)
+ })
+
+ it('asks for failed runs, not completed ones', async () => {
+ // Without the outcome parameter this endpoint returns successes, so the failures section
+ // would quietly list runs that worked.
+ await expectLogic(logic, () => logic.actions.loadRecentFailures()).toFinishAllListeners()
+
+ expect(api.dataWarehouseCompletedActivityRetrieve).toHaveBeenCalledWith(
+ expect.anything(),
+ expect.objectContaining({ outcome: 'failed' })
+ )
+ })
+
+ it('reloads only the run counts when the window changes', async () => {
+ // Rows are per billing period and health is current state, so refetching them on a window
+ // change would be three wasted requests per click.
+ api.dataWarehouseJobStatsRetrieve.mockClear()
+ api.dataWarehouseTotalRowsStatsRetrieve.mockClear()
+
+ await expectLogic(logic, () => logic.actions.setWindow(30)).toFinishAllListeners()
+
+ expect(logic.values.window).toEqual(30)
+ expect(api.dataWarehouseJobStatsRetrieve).toHaveBeenCalledWith(
+ expect.anything(),
+ expect.objectContaining({ days: 30 })
+ )
+ expect(api.dataWarehouseTotalRowsStatsRetrieve).not.toHaveBeenCalled()
+ })
+
+ it('refresh reloads everything', async () => {
+ api.dataWarehouseJobStatsRetrieve.mockClear()
+ api.dataWarehouseTotalRowsStatsRetrieve.mockClear()
+ api.dataWarehouseDataHealthIssuesRetrieve.mockClear()
+ api.dataWarehouseCompletedActivityRetrieve.mockClear()
+
+ await expectLogic(logic, () => logic.actions.refresh()).toFinishAllListeners()
+
+ expect(api.dataWarehouseJobStatsRetrieve).toHaveBeenCalled()
+ expect(api.dataWarehouseTotalRowsStatsRetrieve).toHaveBeenCalled()
+ expect(api.dataWarehouseDataHealthIssuesRetrieve).toHaveBeenCalled()
+ expect(api.dataWarehouseCompletedActivityRetrieve).toHaveBeenCalled()
+ })
+})
diff --git a/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/pipelineOverviewSceneLogic.ts b/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/pipelineOverviewSceneLogic.ts
new file mode 100644
index 000000000000..3fdeceacceee
--- /dev/null
+++ b/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/pipelineOverviewSceneLogic.ts
@@ -0,0 +1,166 @@
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { loaders } from 'kea-loaders'
+
+import { teamLogic } from 'scenes/teamLogic'
+
+import { Breadcrumb } from '~/types'
+
+import {
+ dataWarehouseCompletedActivityRetrieve,
+ dataWarehouseDataHealthIssuesRetrieve,
+ dataWarehouseJobStatsRetrieve,
+ dataWarehouseTotalRowsStatsRetrieve,
+} from 'products/data_warehouse/frontend/generated/api'
+import type {
+ DataHealthIssueApi,
+ DataHealthIssuesResponseApi,
+ PipelineActivityResponseApi,
+ PipelineActivityRowApi,
+ PipelineJobStatsResponseApi,
+ PipelineRowsStatsResponseApi,
+} from 'products/data_warehouse/frontend/generated/api.schemas'
+
+/** Windows `job_stats` accepts. Anything else is a 400. */
+export type PipelineStatsWindow = 1 | 7 | 30
+
+/** Most severe first, so the worst pipeline is the one a reader sees. */
+const ISSUE_SEVERITY: Record<string, number> = {
+ failed: 0,
+ billing_limit: 1,
+ degraded: 2,
+ disabled: 3,
+}
+
+export interface pipelineOverviewSceneLogicValues {
+ currentTeamId: number | null // teamLogic
+ window: PipelineStatsWindow
+ jobStats: PipelineJobStatsResponseApi | null
+ jobStatsLoading: boolean
+ rowsStats: PipelineRowsStatsResponseApi | null
+ rowsStatsLoading: boolean
+ healthIssues: DataHealthIssuesResponseApi | null
+ healthIssuesLoading: boolean
+ recentFailures: PipelineActivityResponseApi | null
+ recentFailuresLoading: boolean
+ breadcrumbs: Breadcrumb[]
+ issuesBySeverity: DataHealthIssueApi[]
+ failingSyncCount: number
+ failedRuns: PipelineActivityRowApi[]
+ loadingFirstTime: boolean
+}
+
+export interface pipelineOverviewSceneLogicActions {
+ setWindow: (window: PipelineStatsWindow) => { window: PipelineStatsWindow }
+ loadJobStats: () => any
+ loadRowsStats: () => any
+ loadHealthIssues: () => any
+ loadRecentFailures: () => any
+ refresh: () => { value: true }
+}
+
+export type pipelineOverviewSceneLogicType = MakeLogicType<
+ pipelineOverviewSceneLogicValues,
+ pipelineOverviewSceneLogicActions
+>
+
+export const pipelineOverviewSceneLogic = kea<pipelineOverviewSceneLogicType>([
+ path([
+ 'products',
+ 'warehouse_sources',
+ 'frontend',
+ 'scenes',
+ 'PipelineOverviewScene',
+ 'pipelineOverviewSceneLogic',
+ ]),
+ connect(() => ({ values: [teamLogic, ['currentTeamId']] })),
+ actions({
+ setWindow: (window: PipelineStatsWindow) => ({ window }),
+ refresh: true,
+ }),
+ reducers({
+ window: [
+ 7 as PipelineStatsWindow,
+ { setWindow: (_: unknown, { window }: { window: PipelineStatsWindow }) => window },
+ ],
+ }),
+ loaders(({ values }: any) => ({
+ // `null` rather than an empty shape throughout: the scene has to tell "not answered yet"
+ // from "answered, and there is nothing", or it renders an empty state over a pending load.
+ jobStats: [
+ null as PipelineJobStatsResponseApi | null,
+ {
+ loadJobStats: async () =>
+ await dataWarehouseJobStatsRetrieve(String(values.currentTeamId), { days: values.window }),
+ },
+ ],
+ rowsStats: [
+ null as PipelineRowsStatsResponseApi | null,
+ { loadRowsStats: async () => await dataWarehouseTotalRowsStatsRetrieve(String(values.currentTeamId)) },
+ ],
+ healthIssues: [
+ null as DataHealthIssuesResponseApi | null,
+ { loadHealthIssues: async () => await dataWarehouseDataHealthIssuesRetrieve(String(values.currentTeamId)) },
+ ],
+ recentFailures: [
+ null as PipelineActivityResponseApi | null,
+ {
+ loadRecentFailures: async () =>
+ await dataWarehouseCompletedActivityRetrieve(String(values.currentTeamId), {
+ outcome: 'failed',
+ limit: 10,
+ }),
+ },
+ ],
+ })),
+ selectors({
+ breadcrumbs: [
+ () => [],
+ (): Breadcrumb[] => [{ key: 'PipelineOverview', name: 'ETL', iconType: 'data_pipeline' }],
+ ],
+ issuesBySeverity: [
+ (s: any) => [s.healthIssues],
+ (healthIssues: DataHealthIssuesResponseApi | null): DataHealthIssueApi[] =>
+ [...(healthIssues?.results ?? [])].sort(
+ (a, b) => (ISSUE_SEVERITY[a.status] ?? 99) - (ISSUE_SEVERITY[b.status] ?? 99)
+ ),
+ ],
+ failingSyncCount: [
+ (s: any) => [s.healthIssues],
+ (healthIssues: DataHealthIssuesResponseApi | null): number =>
+ (healthIssues?.results ?? []).filter((issue) => issue.type === 'external_data_sync').length,
+ ],
+ failedRuns: [
+ (s: any) => [s.recentFailures],
+ (recentFailures: PipelineActivityResponseApi | null): PipelineActivityRowApi[] =>
+ recentFailures?.results ?? [],
+ ],
+ // A first load shows skeletons; a refresh keeps the numbers on screen and dims them, so
+ // polling does not make the page flash.
+ loadingFirstTime: [
+ (s: any) => [s.jobStats, s.jobStatsLoading, s.healthIssues, s.healthIssuesLoading],
+ (
+ jobStats: unknown,
+ jobStatsLoading: boolean,
+ healthIssues: unknown,
+ healthIssuesLoading: boolean
+ ): boolean => (jobStatsLoading && jobStats === null) || (healthIssuesLoading && healthIssues === null),
+ ],
+ }),
+ listeners(({ actions }: any) => ({
+ // Only the run counts are windowed. Rows are reported per billing period and health is
+ // current state, so neither changes with the window.
+ setWindow: () => actions.loadJobStats(),
+ refresh: () => {
+ actions.loadJobStats()
+ actions.loadRowsStats()
+ actions.loadHealthIssues()
+ actions.loadRecentFailures()
+ },
+ })),
+ afterMount(({ actions }: any) => {
+ actions.loadJobStats()
+ actions.loadRowsStats()
+ actions.loadHealthIssues()
+ actions.loadRecentFailures()
+ }),
+])
diff --git a/products/warehouse_sources/manifest.tsx b/products/warehouse_sources/manifest.tsx
index 2cf68d3584fd..7ea8500bfa57 100644
--- a/products/warehouse_sources/manifest.tsx
+++ b/products/warehouse_sources/manifest.tsx
@@ -3,21 +3,49 @@
*
* Defines scenes, routes, URLs, and navigation for this product.
*/
-import { ProductManifest } from '../../frontend/src/types'
+import { FEATURE_FLAGS } from 'lib/constants'
+import { urls } from 'scenes/urls'
+
+import { ProductItemCategory, ProductKey } from '~/queries/schema/schema-general'
+import { ProductManifest } from '~/types'
export const manifest: ProductManifest = {
- name: 'WarehouseSources',
+ name: 'ETL',
scenes: {
- // Define scenes here
+ PipelineOverview: {
+ import: () => import('./frontend/scenes/PipelineOverviewScene/PipelineOverviewScene'),
+ projectBased: true,
+ name: 'ETL',
+ description: 'Every source you import from and every destination you write to, with the health of each.',
+ iconType: 'data_pipeline',
+ docsHref: 'https://posthog.com/docs/data-warehouse',
+ },
},
routes: {
- // Define routes here
+ '/etl': ['PipelineOverview', 'pipelineOverview'],
},
redirects: {},
urls: {
- // Define URL helpers here
+ etlOverview: (): string => '/etl',
},
fileSystemTypes: {},
treeItemsNew: [],
- treeItemsProducts: [],
+ treeItemsProducts: [
+ {
+ path: 'ETL',
+ // Reuses the warehouse product key rather than minting a new one: this is a surface
+ // over the same sources and destinations, so setup state and Quick Start tracking
+ // should read as the same product.
+ intents: [ProductKey.DATA_WAREHOUSE],
+ category: ProductItemCategory.TOOLS,
+ iconType: 'data_pipeline',
+ iconColor: ['var(--color-product-data-warehouse-light)'],
+ href: urls.etlOverview(),
+ // The nav entry and the scene body are gated separately. This hides the entry; the
+ // scene itself still has to refuse a direct visit.
+ flag: FEATURE_FLAGS.WAREHOUSE_MULTI_DESTINATION,
+ sceneKey: 'PipelineOverview',
+ sceneKeys: ['PipelineOverview'],
+ },
+ ],
}
diff --git a/products/warehouse_sources/package.json b/products/warehouse_sources/package.json
index 864ffcb9390d..1788aecdecb4 100644
--- a/products/warehouse_sources/package.json
+++ b/products/warehouse_sources/package.json
@@ -3,5 +3,25 @@
"scripts": {
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -m 'not async_migrations' --reruns=2 --reruns-delay=1 -v --tb=short",
"backend:contract-check": "echo 'Contract files unchanged'"
+ },
+ "dependencies": {
+ "kea": "catalog:",
+ "kea-forms": "catalog:",
+ "kea-loaders": "catalog:",
+ "kea-router": "catalog:",
+ "kea-test-utils": "catalog:",
+ "posthog-js": "catalog:"
+ },
+ "devDependencies": {
+ "@testing-library/jest-dom": "^5.17.0",
+ "@testing-library/react": "^14.3.1"
+ },
+ "peerDependencies": {
+ "@posthog/brand": "catalog:",
+ "@posthog/icons": "catalog:",
+ "@posthog/lemon-ui": "*",
+ "@storybook/react": "catalog:",
+ "@types/react": "*",
+ "react": "*"
}
}
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 9b6acefe21c6..74004dde44c0 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -25731,6 +25731,44 @@ export namespace Schemas {
sources: DataFreshnessSource[];
}
+ export interface DataHealthIssue {
+ /** Id of the thing that is unhealthy. */
+ id: string;
+ /** Table, view or export the issue is about. */
+ name: string;
+ /** What kind of thing is unhealthy. One of: materialized_view, external_data_sync, source, destination, transformation. */
+ type: string;
+ /**
+ * Source type for a sync issue, for example 'Stripe'.
+ * @nullable
+ */
+ source_type?: string | null;
+ /** Why it is unhealthy. One of: failed, disabled, degraded, billing_limit. */
+ status: string;
+ /**
+ * The error, where one was recorded.
+ * @nullable
+ */
+ error: string | null;
+ /**
+ * When it last failed.
+ * @nullable
+ */
+ failed_at: string | null;
+ /**
+ * Where to go to fix it.
+ * @nullable
+ */
+ url: string | null;
+ }
+
+ export interface DataHealthIssuesResponse {
+ /** Everything currently unhealthy. */
+ results: DataHealthIssue[];
+ /** How many issues are in `results`. */
+ count: number;
+ }
+
/**
* * `Cancelled` - Cancelled
* * `Completed` - Completed
@@ -54991,6 +55029,24 @@ export namespace Schemas {
projects: JiraProject[];
}
+ export interface JobCounts {
+ /** Runs that finished inside the window. */
+ total: number;
+ /** Runs in flight right now, regardless of the window. */
+ running: number;
+ /** Runs that completed. */
+ successful: number;
+ /** Runs that errored or that billing stopped. */
+ failed: number;
+ }
+
+ export interface JobStatsBucket {
+ /** Runs that completed in this bucket. */
+ successful: number;
+ /** Runs that failed in this bucket. */
+ failed: number;
+ }
+
export interface JsonValue {}
/**
@@ -79723,6 +79779,126 @@ export namespace Schemas {
task_ids: string[];
}
+ export interface PipelineActivityRow {
+ /** Run id. */
+ id: string;
+ /**
+ * The source type for a sync, or 'Materialized view' for a model run.
+ * @nullable
+ */
+ type: string | null;
+ /**
+ * Table or view the run wrote.
+ * @nullable
+ */
+ name: string | null;
+ /** Run status. One of: Running, Completed, Failed, BillingLimitReached, BillingLimitTooLow. */
+ status: string;
+ /** Rows the run wrote. Zero while it is still going. */
+ rows: number;
+ /** When the run was created. There is no separate start time. */
+ created_at: string;
+ /**
+ * When the run ended, or null while running.
+ * @nullable
+ */
+ finished_at: string | null;
+ /**
+ * Error the run ended with, if any.
+ * @nullable
+ */
+ latest_error: string | null;
+ /**
+ * Temporal run id, for finding the run's logs.
+ * @nullable
+ */
+ workflow_run_id: string | null;
+ /**
+ * Where a materialized view came from. Null for syncs.
+ * @nullable
+ */
+ origin: string | null;
+ }
+
+ export interface PipelineActivityResponse {
+ /** Runs, newest first. */
+ results: PipelineActivityRow[];
+ /**
+ * Query string for the next page, or null on the last.
+ * @nullable
+ */
+ next: string | null;
+ /**
+ * Query string for the previous page, or null on the first.
+ * @nullable
+ */
+ previous: string | null;
+ }
+
+ export interface PipelineError {
+ /** What went wrong, for a reader rather than a parser. */
+ error: string;
+ }
+
+ /**
+ * Runs per time bucket, keyed by ISO hour when days=1 and by ISO date otherwise. Buckets with no runs are absent rather than zero.
+ */
+ export type PipelineJobStatsResponseBreakdown = {[key: string]: JobStatsBucket};
+
+ export interface PipelineJobStatsResponse {
+ /** Window the counts cover, in days. One of 1, 7 or 30. */
+ days: number;
+ /** Start of the window, in the project's timezone. */
+ cutoff_time: string;
+ /** Sync runs plus materialization runs in the window. */
+ total_jobs: number;
+ /** Sync and materialization runs that completed. */
+ successful_jobs: number;
+ /** Sync and materialization runs that failed. */
+ failed_jobs: number;
+ /** Counts for warehouse source syncs alone. */
+ external_data_jobs: JobCounts;
+ /** Counts for materialized view runs alone. */
+ modeling_jobs: JobCounts;
+ /** Runs per time bucket, keyed by ISO hour when days=1 and by ISO date otherwise. Buckets with no runs are absent rather than zero. */
+ breakdown: PipelineJobStatsResponseBreakdown;
+ }
+
+ /**
+ * Rows synced in the billing period, keyed by source id.
+ */
+ export type PipelineRowsStatsResponseBreakdownOfRowsBySource = {[key: string]: number};
+
+ export interface PipelineRowsStatsResponse {
+ /** Whether billing answered. When false, only the counts derived from runs are meaningful. */
+ billing_available: boolean;
+ /**
+ * Length of the billing period, for example 'month'.
+ * @nullable
+ */
+ billing_interval: string | null;
+ /**
+ * Start of the current billing period.
+ * @nullable
+ */
+ billing_period_start: string | null;
+ /**
+ * End of the current billing period.
+ * @nullable
+ */
+ billing_period_end: string | null;
+ /** Rows synced in the billing period, billed and not yet billed. */
+ total_rows: number;
+ /** Rows billing has already counted. */
+ tracked_billing_rows: number;
+ /** Rows synced since billing last counted. */
+ pending_billing_rows: number;
+ /** Rows written by materialized view runs in the billing period. */
+ materialized_rows_in_billing_period: number;
+ /** Rows synced in the billing period, keyed by source id. */
+ breakdown_of_rows_by_source: PipelineRowsStatsResponseBreakdownOfRowsBySource;
+ }
+
export interface PlainThreadSignalExtra {
status: string | null;
priority: string | null;
@@ -109135,6 +109311,57 @@ export namespace Schemas {
name: string;
};
+ export type DataWarehouseCompletedActivityRetrieveParams = {
+ /**
+ * Only include runs created within this many days of now. Defaults to 30.
+ */
+ cutoff_days?: number;
+ /**
+ * Max rows to return. Capped at 50 server-side. Defaults to 20.
+ */
+ limit?: number;
+ /**
+ * Rows to skip, for pagination. Defaults to 0.
+ */
+ offset?: number;
+ /**
+ * Which outcome to return: 'completed' or 'failed'. Defaults to 'completed'.
+ *
+ * * `completed` - completed
+ * * `failed` - failed
+ * @minLength 1
+ */
+ outcome?: DataWarehouseCompletedActivityRetrieveOutcome;
+ };
+
+ export type DataWarehouseCompletedActivityRetrieveOutcome = typeof DataWarehouseCompletedActivityRetrieveOutcome[keyof typeof DataWarehouseCompletedActivityRetrieveOutcome];
+
+
+ export const DataWarehouseCompletedActivityRetrieveOutcome = {
+ Completed: 'completed',
+ Failed: 'failed',
+ } as const;
+
+ export type DataWarehouseJobStatsRetrieveParams = {
+ /**
+ * Window the counts should cover, in days. One of 1, 7 or 30. Defaults to 7.
+ *
+ * * `1` - 1
+ * * `7` - 7
+ * * `30` - 30
+ */
+ days?: DataWarehouseJobStatsRetrieveDays;
+ };
+
+ export type DataWarehouseJobStatsRetrieveDays = typeof DataWarehouseJobStatsRetrieveDays[keyof typeof DataWarehouseJobStatsRetrieveDays];
+
+
+ export const DataWarehouseJobStatsRetrieveDays = {
+ Number1: 1,
+ Number7: 7,
+ Number30: 30,
+ } as const;
+
export type DataWarehouseManagedWarehouseMonitoringTimeseriesRetrieveParams = {
/**
* Allow-listed managed warehouse metric to retrieve.
diff --git a/services/mcp/src/tools/links/app-url-manifest.json b/services/mcp/src/tools/links/app-url-manifest.json
index c96b3990359b..e803e289cb42 100644
--- a/services/mcp/src/tools/links/app-url-manifest.json
+++ b/services/mcp/src/tools/links/app-url-manifest.json
@@ -684,6 +684,11 @@
"params": ["id"],
"scope": "project"
},
+ "etlOverview": {
+ "template": "/etl",
+ "params": [],
+ "scope": "project"
+ },
"event": {
"template": "/events/{id}/{timestamp}",
"params": ["id", "timestamp"],
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json
index bec4ad844b4b..2896cc7b87a3 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json
@@ -13,7 +13,7 @@
"type": "object"
},
"url": {
- "description": "A path template copied verbatim from the catalog below (e.g. `/persons/{uuid}`). Its `{placeholders}` are filled from `params`. These slugs come from PostHog's canonical route table, so they are always correct — never pass a path that is not in this list.\n\n/account-connected/{kind}\n/account/credential-review\n/account/social-connected\n/activity-logs\n/activity/{tab}\n/agentic/account-mismatch\n/agentic/authorize\n/ai\n/ai-enrichment\n/ai-evals/datasets\n/ai-evals/datasets/{id}\n/ai-evals/evaluations\n/ai-evals/evaluations/offline/experiments\n/ai-evals/evaluations/offline/experiments/{experimentId}\n/ai-evals/evaluations/templates\n/ai-evals/evaluations/{id}\n/ai-evals/taggers\n/ai-evals/taggers/{id}\n/ai-gateway\n/ai-observability/clusters\n/ai-observability/clusters/{runId}/{clusterId}\n/ai-observability/dashboard\n/ai-observability/errors\n/ai-observability/generations\n/ai-observability/playground\n/ai-observability/reviews\n/ai-observability/self-driving\n/ai-observability/sentiment\n/ai-observability/sessions\n/ai-observability/sessions/{id}\n/ai-observability/tools\n/ai-observability/traces\n/ai-observability/traces/{id}\n/ai-observability/users\n/ai/history\n/alerts\n/approvals/{id}\n/billing/authorization_status\n/broadcasts\n/broadcasts/new\n/broadcasts/{id}\n/business-knowledge\n/business-knowledge/settings\n/business-knowledge/{id}\n/canvas\n/cli/authorize\n/cli/live\n/code-review\n/code/canvas/{channelId}/{dashboardId}\n/code/channel/{channelId}\n/code/loop/{loopId}\n/code/task/{taskId}\n/cohorts\n/cohorts/{id}\n/cohorts/{id}/calculation-history\n/connect/vercel/link\n/coupons/{campaign}\n/create-organization\n/customer_analytics\n/customer_analytics/accounts\n/customer_analytics/accounts/by-external-id/{externalId}\n/customer_analytics/accounts/{accountId}\n/customer_analytics/announcements\n/customer_analytics/configuration\n/customer_analytics/dashboard\n/customer_analytics/feature-requests\n/customer_analytics/feed\n/customer_analytics/journeys\n/customer_analytics/journeys/new\n/customer_analytics/journeys/templates\n/customer_analytics/journeys/{id}/edit\n/customer_analytics/notes\n/customer_analytics/tasks\n/dashboard\n/dashboard/templates/{templateId}/copy-to-project\n/dashboard/{id}\n/dashboard/{id}/sharing\n/dashboard/{id}/subscriptions\n/dashboard/{id}/subscriptions/{subscriptionId}\n/dashboard/{id}/tiles/{tileId}\n/data-catalog\n/data-catalog/metrics/{name}\n/data-management/actions\n/data-management/actions/new\n/data-management/actions/new/\n/data-management/actions/{id}\n/data-management/annotations\n/data-management/annotations/{id}\n/data-management/core-events\n/data-management/database\n/data-management/destinations\n/data-management/event-filtering\n/data-management/events\n/data-management/events/{id}\n/data-management/events/{id}/edit\n/data-management/history\n/data-management/ingestion-warnings\n/data-management/ingestion-warnings-v2\n/data-management/managed-viewsets\n/data-management/materialized-columns\n/data-management/properties\n/data-management/properties/{id}\n/data-management/properties/{id}/edit\n/data-management/revenue\n/data-management/schema\n/data-management/sources\n/data-management/sources/{id}/schemas\n/data-management/sources/{sourceId}/schemas/{schemaId}\n/data-management/transformations\n/data-management/variables\n/data-management/variables/{id}\n/data-management/variables/{id}/edit\n/data-management/warehouse-destinations\n/data-management/warehouse-properties\n/data-ops\n/data-warehouse/connect\n/data-warehouse/new-source\n/debug\n/debug/hog\n/debug/precompute\n/early_access_features\n/early_access_features/{id}\n/embedded/{token}\n/endpoints\n/endpoints/{name}\n/engineering-analytics/authors\n/engineering-analytics/authors/{handle}\n/engineering-analytics/deploys\n/engineering-analytics/overview\n/engineering-analytics/pull-requests\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/runs/{runId}\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/workflows/{workflowName}\n/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}\n/engineering-analytics/teams\n/engineering-analytics/teams/{ownerTeam}\n/engineering-analytics/tests\n/engineering-analytics/workflows\n/error_tracking\n/error_tracking/alerts/new/{templateId}\n/error_tracking/alerts/{id}\n/error_tracking/fingerprint/{fingerprint}\n/error_tracking/{id}\n/events/{id}/{timestamp}\n/experiments\n/experiments/shared-metrics\n/experiments/shared-metrics/{id}\n/experiments/staff\n/experiments/{id}\n/exports\n/feature_flags\n/feature_flags/new\n/feature_flags/staff\n/feature_flags/staff/cohorts\n/feature_flags/templates\n/feature_flags/{id}\n/files\n/functions/new/{templateId}\n/functions/{id}\n/games/368hedgehogs\n/games/flappyhog\n/games/shipit\n/groups/{groupTypeIndex}\n/groups/{groupTypeIndex}/new\n/groups/{groupTypeIndex}/{groupKey}\n/health\n/health/alerts\n/health/pipeline-status\n/health/sdk-health\n/health/{category}\n/heatmaps\n/heatmaps/new\n/heatmaps/recording\n/heatmaps/{id}\n/home\n/identity-matching\n/inbox\n/inbox/reports/triage\n/inbox/scouts/findings\n/inbox/scouts/runs\n/inbox/scouts/scratchpad\n/inbox/scouts/{skillName}\n/inbox/{tab}/{reportId}\n/insights\n/insights/new\n/insights/quick-start\n/insights/{id}\n/insights/{id}/edit\n/insights/{id}/sharing\n/insights/{id}/subscriptions\n/insights/{id}/subscriptions/{subscriptionId}\n/insights/{insightShortId}/alerts\n/instance/async_migrations\n/instance/async_migrations/future\n/instance/async_migrations/settings\n/instance/dead_letter_queue\n/instance/kafka_inspector\n/instance/metrics\n/instance/settings\n/instance/staff_users\n/instance/status\n/integrations/stripe/confirm-install\n/integrations/vercel/link-error\n/integrations/{kind}/callback\n/integrations/{slug}\n/legal\n/legal/new/{type}\n/link/{id}\n/links\n/live-debugger\n/login\n/login/2fa\n/login/2fa_setup\n/logs\n/logs/alerts/{alertId}/notifications/{hogFunctionId}\n/logs/alerts/{id}\n/logs/drop-rules/new\n/logs/drop-rules/{id}\n/logs/retention-rules/new\n/logs/retention-rules/{id}\n/managed_migrations\n/managed_migrations/new\n/marketing\n/mcp-analytics\n/mcp-analytics/activity\n/mcp-analytics/dashboard\n/mcp-analytics/intent-clustering\n/mcp-analytics/missing-capabilities\n/mcp-analytics/notifications\n/mcp-analytics/sessions\n/mcp-analytics/tool-quality\n/mcp-analytics/tool-quality/{toolName}\n/mcp-registry\n/mcp-servers\n/mcp-servers/agent/{id}\n/mcp-servers/member/{id}\n/mcp-servers/server/{id}\n/mcp-servers/{tab}\n/metrics\n/models\n/models/{id}\n/move-to-cloud\n/my-tickets\n/notebooks\n/notebooks/widgets/{widgetId}\n/notebooks/{shortId}\n/oauth/authorize\n/onboarding\n/organization-deactivated\n/organization-pending-deletion\n/organization/billing\n/organization/billing/overview\n/organization/billing/real-time-usage\n/organization/confirm-creation\n/organization/create-project\n/person/{id}\n/persons\n/persons/{uuid}\n/pipeline/batch-exports/new/{service}\n/pipeline/batch-exports/{id}\n/pipeline/new/\n/pipeline/plugins/{id}\n/preflight\n/product_tours\n/product_tours/{id}\n/project-pending-deletion\n/prompt-management/prompts\n/prompt-management/prompts/{name}\n/pulse\n/replay-vision\n/replay-vision/new/template\n/replay-vision/observations/{observationId}\n/replay-vision/{id}/budget\n/replay-vision/{id}/configure\n/replay-vision/{id}/details\n/replay-vision/{id}/overview\n/replay-vision/{id}/self-driving\n/replay-vision/{id}/template\n/replay-vision/{id}/triggers\n/replay/file-playback\n/replay/home\n/replay/kiosk\n/replay/playlists/{id}\n/replay/settings\n/replay/{id}\n/reset\n/reset/{userUuid}/{token}\n/reset_2fa/{userUuid}/{token}\n/resource-transfer/{resourceKind}/{resourceId}\n/sessions/{id}\n/settings/environment-approvals\n/settings/organization-authentication/{feature}/{configId}\n/settings/project\n/settings/user-feature-previews\n/shared/{token}\n/shared_dashboard/{shareToken}\n/signup\n/signup/{id}\n/site/{url}\n/skills\n/skills/community\n/skills/{categoryTab}\n/skills/{name}\n/slack-task-context\n/sql\n/stamphog\n/stamphog/digests\n/stamphog/install/callback\n/stamphog/runs\n/startups\n/streamlit-apps\n/streamlit-apps/new\n/streamlit-apps/{id}\n/streamlit-apps/{id}/edit\n/subscriptions\n/subscriptions/new\n/subscriptions/{id}\n/subscriptions/{id}/edit\n/support\n/support/settings\n/support/tickets\n/support/tickets/{ticketId}\n/surveys\n/surveys/form/new\n/surveys/guided/new\n/surveys/{id}\n/tasks\n/tasks/new\n/tasks/{taskId}\n/terminal\n/themes/custom-css\n/toolbar\n/tracing\n/tracing/retention-rules/new\n/tracing/retention-rules/{id}\n/unsubscribe\n/user_research\n/user_research/{id}\n/user_research/{topicId}/response/{responseId}\n/verify_email\n/visual_review\n/visual_review/repos/{repoId}/flakiness\n/visual_review/repos/{repoId}/runs\n/visual_review/repos/{repoId}/snapshots\n/visual_review/repos/{repoId}/{runType}/snapshots/{identifier}\n/visual_review/runs/{runId}\n/visual_review/settings\n/web\n/web-scripts\n/web-scripts/new\n/web/agents\n/web/bots\n/web/content-autopilot\n/web/health\n/web/live\n/web/marketing\n/web/page-performance\n/web/page-reports\n/web/recap\n/web/session-attribution-explorer\n/web/web-vitals\n/wizard/runs\n/workflows\n/workflows/library/messages/{id}\n/workflows/library/templates/new\n/workflows/library/templates/{id}\n/workflows/new/workflow\n/workflows/{id}/{tab}",
+ "description": "A path template copied verbatim from the catalog below (e.g. `/persons/{uuid}`). Its `{placeholders}` are filled from `params`. These slugs come from PostHog's canonical route table, so they are always correct — never pass a path that is not in this list.\n\n/account-connected/{kind}\n/account/credential-review\n/account/social-connected\n/activity-logs\n/activity/{tab}\n/agentic/account-mismatch\n/agentic/authorize\n/ai\n/ai-enrichment\n/ai-evals/datasets\n/ai-evals/datasets/{id}\n/ai-evals/evaluations\n/ai-evals/evaluations/offline/experiments\n/ai-evals/evaluations/offline/experiments/{experimentId}\n/ai-evals/evaluations/templates\n/ai-evals/evaluations/{id}\n/ai-evals/taggers\n/ai-evals/taggers/{id}\n/ai-gateway\n/ai-observability/clusters\n/ai-observability/clusters/{runId}/{clusterId}\n/ai-observability/dashboard\n/ai-observability/errors\n/ai-observability/generations\n/ai-observability/playground\n/ai-observability/reviews\n/ai-observability/self-driving\n/ai-observability/sentiment\n/ai-observability/sessions\n/ai-observability/sessions/{id}\n/ai-observability/tools\n/ai-observability/traces\n/ai-observability/traces/{id}\n/ai-observability/users\n/ai/history\n/alerts\n/approvals/{id}\n/billing/authorization_status\n/broadcasts\n/broadcasts/new\n/broadcasts/{id}\n/business-knowledge\n/business-knowledge/settings\n/business-knowledge/{id}\n/canvas\n/cli/authorize\n/cli/live\n/code-review\n/code/canvas/{channelId}/{dashboardId}\n/code/channel/{channelId}\n/code/loop/{loopId}\n/code/task/{taskId}\n/cohorts\n/cohorts/{id}\n/cohorts/{id}/calculation-history\n/connect/vercel/link\n/coupons/{campaign}\n/create-organization\n/customer_analytics\n/customer_analytics/accounts\n/customer_analytics/accounts/by-external-id/{externalId}\n/customer_analytics/accounts/{accountId}\n/customer_analytics/announcements\n/customer_analytics/configuration\n/customer_analytics/dashboard\n/customer_analytics/feature-requests\n/customer_analytics/feed\n/customer_analytics/journeys\n/customer_analytics/journeys/new\n/customer_analytics/journeys/templates\n/customer_analytics/journeys/{id}/edit\n/customer_analytics/notes\n/customer_analytics/tasks\n/dashboard\n/dashboard/templates/{templateId}/copy-to-project\n/dashboard/{id}\n/dashboard/{id}/sharing\n/dashboard/{id}/subscriptions\n/dashboard/{id}/subscriptions/{subscriptionId}\n/dashboard/{id}/tiles/{tileId}\n/data-catalog\n/data-catalog/metrics/{name}\n/data-management/actions\n/data-management/actions/new\n/data-management/actions/new/\n/data-management/actions/{id}\n/data-management/annotations\n/data-management/annotations/{id}\n/data-management/core-events\n/data-management/database\n/data-management/destinations\n/data-management/event-filtering\n/data-management/events\n/data-management/events/{id}\n/data-management/events/{id}/edit\n/data-management/history\n/data-management/ingestion-warnings\n/data-management/ingestion-warnings-v2\n/data-management/managed-viewsets\n/data-management/materialized-columns\n/data-management/properties\n/data-management/properties/{id}\n/data-management/properties/{id}/edit\n/data-management/revenue\n/data-management/schema\n/data-management/sources\n/data-management/sources/{id}/schemas\n/data-management/sources/{sourceId}/schemas/{schemaId}\n/data-management/transformations\n/data-management/variables\n/data-management/variables/{id}\n/data-management/variables/{id}/edit\n/data-management/warehouse-destinations\n/data-management/warehouse-properties\n/data-ops\n/data-warehouse/connect\n/data-warehouse/new-source\n/debug\n/debug/hog\n/debug/precompute\n/early_access_features\n/early_access_features/{id}\n/embedded/{token}\n/endpoints\n/endpoints/{name}\n/engineering-analytics/authors\n/engineering-analytics/authors/{handle}\n/engineering-analytics/deploys\n/engineering-analytics/overview\n/engineering-analytics/pull-requests\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/runs/{runId}\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/workflows/{workflowName}\n/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}\n/engineering-analytics/teams\n/engineering-analytics/teams/{ownerTeam}\n/engineering-analytics/tests\n/engineering-analytics/workflows\n/error_tracking\n/error_tracking/alerts/new/{templateId}\n/error_tracking/alerts/{id}\n/error_tracking/fingerprint/{fingerprint}\n/error_tracking/{id}\n/etl\n/events/{id}/{timestamp}\n/experiments\n/experiments/shared-metrics\n/experiments/shared-metrics/{id}\n/experiments/staff\n/experiments/{id}\n/exports\n/feature_flags\n/feature_flags/new\n/feature_flags/staff\n/feature_flags/staff/cohorts\n/feature_flags/templates\n/feature_flags/{id}\n/files\n/functions/new/{templateId}\n/functions/{id}\n/games/368hedgehogs\n/games/flappyhog\n/games/shipit\n/groups/{groupTypeIndex}\n/groups/{groupTypeIndex}/new\n/groups/{groupTypeIndex}/{groupKey}\n/health\n/health/alerts\n/health/pipeline-status\n/health/sdk-health\n/health/{category}\n/heatmaps\n/heatmaps/new\n/heatmaps/recording\n/heatmaps/{id}\n/home\n/identity-matching\n/inbox\n/inbox/reports/triage\n/inbox/scouts/findings\n/inbox/scouts/runs\n/inbox/scouts/scratchpad\n/inbox/scouts/{skillName}\n/inbox/{tab}/{reportId}\n/insights\n/insights/new\n/insights/quick-start\n/insights/{id}\n/insights/{id}/edit\n/insights/{id}/sharing\n/insights/{id}/subscriptions\n/insights/{id}/subscriptions/{subscriptionId}\n/insights/{insightShortId}/alerts\n/instance/async_migrations\n/instance/async_migrations/future\n/instance/async_migrations/settings\n/instance/dead_letter_queue\n/instance/kafka_inspector\n/instance/metrics\n/instance/settings\n/instance/staff_users\n/instance/status\n/integrations/stripe/confirm-install\n/integrations/vercel/link-error\n/integrations/{kind}/callback\n/integrations/{slug}\n/legal\n/legal/new/{type}\n/link/{id}\n/links\n/live-debugger\n/login\n/login/2fa\n/login/2fa_setup\n/logs\n/logs/alerts/{alertId}/notifications/{hogFunctionId}\n/logs/alerts/{id}\n/logs/drop-rules/new\n/logs/drop-rules/{id}\n/logs/retention-rules/new\n/logs/retention-rules/{id}\n/managed_migrations\n/managed_migrations/new\n/marketing\n/mcp-analytics\n/mcp-analytics/activity\n/mcp-analytics/dashboard\n/mcp-analytics/intent-clustering\n/mcp-analytics/missing-capabilities\n/mcp-analytics/notifications\n/mcp-analytics/sessions\n/mcp-analytics/tool-quality\n/mcp-analytics/tool-quality/{toolName}\n/mcp-registry\n/mcp-servers\n/mcp-servers/agent/{id}\n/mcp-servers/member/{id}\n/mcp-servers/server/{id}\n/mcp-servers/{tab}\n/metrics\n/models\n/models/{id}\n/move-to-cloud\n/my-tickets\n/notebooks\n/notebooks/widgets/{widgetId}\n/notebooks/{shortId}\n/oauth/authorize\n/onboarding\n/organization-deactivated\n/organization-pending-deletion\n/organization/billing\n/organization/billing/overview\n/organization/billing/real-time-usage\n/organization/confirm-creation\n/organization/create-project\n/person/{id}\n/persons\n/persons/{uuid}\n/pipeline/batch-exports/new/{service}\n/pipeline/batch-exports/{id}\n/pipeline/new/\n/pipeline/plugins/{id}\n/preflight\n/product_tours\n/product_tours/{id}\n/project-pending-deletion\n/prompt-management/prompts\n/prompt-management/prompts/{name}\n/pulse\n/replay-vision\n/replay-vision/new/template\n/replay-vision/observations/{observationId}\n/replay-vision/{id}/budget\n/replay-vision/{id}/configure\n/replay-vision/{id}/details\n/replay-vision/{id}/overview\n/replay-vision/{id}/self-driving\n/replay-vision/{id}/template\n/replay-vision/{id}/triggers\n/replay/file-playback\n/replay/home\n/replay/kiosk\n/replay/playlists/{id}\n/replay/settings\n/replay/{id}\n/reset\n/reset/{userUuid}/{token}\n/reset_2fa/{userUuid}/{token}\n/resource-transfer/{resourceKind}/{resourceId}\n/sessions/{id}\n/settings/environment-approvals\n/settings/organization-authentication/{feature}/{configId}\n/settings/project\n/settings/user-feature-previews\n/shared/{token}\n/shared_dashboard/{shareToken}\n/signup\n/signup/{id}\n/site/{url}\n/skills\n/skills/community\n/skills/{categoryTab}\n/skills/{name}\n/slack-task-context\n/sql\n/stamphog\n/stamphog/digests\n/stamphog/install/callback\n/stamphog/runs\n/startups\n/streamlit-apps\n/streamlit-apps/new\n/streamlit-apps/{id}\n/streamlit-apps/{id}/edit\n/subscriptions\n/subscriptions/new\n/subscriptions/{id}\n/subscriptions/{id}/edit\n/support\n/support/settings\n/support/tickets\n/support/tickets/{ticketId}\n/surveys\n/surveys/form/new\n/surveys/guided/new\n/surveys/{id}\n/tasks\n/tasks/new\n/tasks/{taskId}\n/terminal\n/themes/custom-css\n/toolbar\n/tracing\n/tracing/retention-rules/new\n/tracing/retention-rules/{id}\n/unsubscribe\n/user_research\n/user_research/{id}\n/user_research/{topicId}/response/{responseId}\n/verify_email\n/visual_review\n/visual_review/repos/{repoId}/flakiness\n/visual_review/repos/{repoId}/runs\n/visual_review/repos/{repoId}/snapshots\n/visual_review/repos/{repoId}/{runType}/snapshots/{identifier}\n/visual_review/runs/{runId}\n/visual_review/settings\n/web\n/web-scripts\n/web-scripts/new\n/web/agents\n/web/bots\n/web/content-autopilot\n/web/health\n/web/live\n/web/marketing\n/web/page-performance\n/web/page-reports\n/web/recap\n/web/session-attribution-explorer\n/web/web-vitals\n/wizard/runs\n/workflows\n/workflows/library/messages/{id}\n/workflows/library/templates/new\n/workflows/library/templates/{id}\n/workflows/new/workflow\n/workflows/{id}/{tab}",
"type": "string"
}
},