:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(engineering-analytics): headline the full open-to-deploy lead time on the Health tab (#91273)
Paul D'Ambrab7d59575ed50
diff --git a/products/engineering_analytics/backend/facade/contracts.py b/products/engineering_analytics/backend/facade/contracts.pyindex d6161416e44c..f2a6e525d8af 100644--- a/products/engineering_analytics/backend/facade/contracts.py+++ b/products/engineering_analytics/backend/facade/contracts.py@@ -1359,6 +1359,10 @@ class DoraOverview:# (bots/drafts excluded; narrowed by github_team when given). Keyed on deploy time.median_merge_to_deploy_seconds: float | Nonemedian_merge_to_deploy_seconds_prev: float | None+ # Median seconds from a PR's open to the first successful deployment containing it — the+ # full-span twin of the merge-to-deploy median over the same deployed-PR population.+ median_open_to_deploy_seconds: float | None+ median_open_to_deploy_seconds_prev: float | None# PRs first deployed in the window (the population behind the medians and the box plot).deployed_pr_count: intdeployed_pr_count_prev: intdiff --git a/products/engineering_analytics/backend/logic/queries/dora.py b/products/engineering_analytics/backend/logic/queries/dora.pyindex 27b17fe216df..78d22079d31b 100644--- a/products/engineering_analytics/backend/logic/queries/dora.py+++ b/products/engineering_analytics/backend/logic/queries/dora.py@@ -11,6 +11,8 @@ Four quadrants, honestly named (SPEC §4):cannot decide this — deploys ship pre-built images, so a deploy routinelysucceeds *after* a merge it does not contain. The field name says merge-to-deploy,not the full commit-to-deploy DORA definition (pre-merge time is measured elsewhere).+ ``open_to_deploy_seconds`` — open to first successful deploy over the same+ population — is the full-span headline the Health tile shows.- Change failure: ``failed_deployment_share`` — deployments with a failure/errorstatus over deployments that reached any outcome. A proxy: no incident link, soa deploy that succeeded but broke production is invisible.@@ -219,6 +221,8 @@ _LEAD_TIME_HEADLINE_SELECT = f"""lead.deployed_prev,lead.median_cur,lead.median_prev,+ lead.otd_median_cur,+ lead.otd_median_prev,attributed.attributed_cur,merged.merged_curFROM (@@ -226,7 +230,9 @@ _LEAD_TIME_HEADLINE_SELECT = f"""countIf(__CUR_DEPLOYED__) AS deployed_cur,countIf(__PREV_DEPLOYED__) AS deployed_prev,quantileIf(0.5)(lead_seconds, __CUR_DEPLOYED__) AS median_cur,- quantileIf(0.5)(lead_seconds, __PREV_DEPLOYED__) AS median_prev+ quantileIf(0.5)(lead_seconds, __PREV_DEPLOYED__) AS median_prev,+ quantileIf(0.5)(open_to_deploy_seconds, __CUR_DEPLOYED__) AS otd_median_cur,+ quantileIf(0.5)(open_to_deploy_seconds, __PREV_DEPLOYED__) AS otd_median_prevFROM ({_LEAD_TIME_INNER})) AS leadCROSS JOIN (@@ -379,6 +385,8 @@ def _empty_overview(deployments_per_day_prev=None,median_merge_to_deploy_seconds=None,median_merge_to_deploy_seconds_prev=None,+ median_open_to_deploy_seconds=None,+ median_open_to_deploy_seconds_prev=None,deployed_pr_count=0,deployed_pr_count_prev=0,failed_deployment_count=0,@@ -479,6 +487,8 @@ class _LeadTime:deployed_count_prev: intmedian_seconds: float | Nonemedian_seconds_prev: float | None+ open_to_deploy_median_seconds: float | None+ open_to_deploy_median_seconds_prev: float | None# PRs merged in the window (the locked recipe), and how many of those a deploy attributed.merged_count: intattributed_count: int@@ -496,6 +506,8 @@ _EMPTY_LEAD_TIME = _LeadTime(deployed_count_prev=0,median_seconds=None,median_seconds_prev=None,+ open_to_deploy_median_seconds=None,+ open_to_deploy_median_seconds_prev=None,merged_count=0,attributed_count=0,series=[],@@ -528,9 +540,16 @@ def _query_lead_time(scan: _DoraScan, *, github_team: str | None, members_source.replace("__TEAM_FILTER__", team_filter))headline = scan.run(headline_sql, query_type="engineering_analytics.dora_lead_time")- deployed_cur, deployed_prev, median_cur, median_prev, attributed_cur, merged_cur = (- headline.results[0] if headline.results else (0, 0, None, None, 0, 0)- )+ (+ deployed_cur,+ deployed_prev,+ median_cur,+ median_prev,+ otd_median_cur,+ otd_median_prev,+ attributed_cur,+ merged_cur,+ ) = headline.results[0] if headline.results else (0, 0, None, None, None, None, 0, 0)series_sql = f"WITH {attribution_ctes} " + (_LEAD_TIME_SERIES_SELECT.replace("__BUCKET_FN__", bucket_expr(scan.granularity, "deployed_at")).replace(@@ -546,6 +565,8 @@ def _query_lead_time(scan: _DoraScan, *, github_team: str | None, members_sourcedeployed_count_prev=int(deployed_prev or 0),median_seconds=opt_float(median_cur),median_seconds_prev=opt_float(median_prev),+ open_to_deploy_median_seconds=opt_float(otd_median_cur),+ open_to_deploy_median_seconds_prev=opt_float(otd_median_prev),merged_count=int(merged_cur or 0),attributed_count=int(attributed_cur or 0),series=[@@ -637,6 +658,8 @@ def query_dora_overview(deployments_per_day_prev=outcomes.deployment_count_prev / window_days,median_merge_to_deploy_seconds=lead.median_seconds,median_merge_to_deploy_seconds_prev=lead.median_seconds_prev,+ median_open_to_deploy_seconds=lead.open_to_deploy_median_seconds,+ median_open_to_deploy_seconds_prev=lead.open_to_deploy_median_seconds_prev,deployed_pr_count=lead.deployed_count,deployed_pr_count_prev=lead.deployed_count_prev,failed_deployment_count=outcomes.failed_count,diff --git a/products/engineering_analytics/backend/presentation/serializers/dora.py b/products/engineering_analytics/backend/presentation/serializers/dora.pyindex 3cbde9b79584..c6859fcc8f19 100644--- a/products/engineering_analytics/backend/presentation/serializers/dora.py+++ b/products/engineering_analytics/backend/presentation/serializers/dora.py@@ -142,6 +142,17 @@ class DoraOverviewSerializer(DataclassSerializer):"help_text": "Previous-window twin of median_merge_to_deploy_seconds.","allow_null": True,},+ "median_open_to_deploy_seconds": {+ "help_text": "Median seconds from a PR's open to the first successful deployment "+ "containing it — the full open-to-deploy lead time over the same deployed-PR "+ "population as median_merge_to_deploy_seconds. Null when nothing deployed in the "+ "window.",+ "allow_null": True,+ },+ "median_open_to_deploy_seconds_prev": {+ "help_text": "Previous-window twin of median_open_to_deploy_seconds.",+ "allow_null": True,+ },"deployed_pr_count": {"help_text": "PRs first deployed in the window — the population behind the merge-to-deploy ""median and box plot."diff --git a/products/engineering_analytics/backend/tests/test_dora.py b/products/engineering_analytics/backend/tests/test_dora.pyindex d706c0eb91fb..886db6e18253 100644--- a/products/engineering_analytics/backend/tests/test_dora.py+++ b/products/engineering_analytics/backend/tests/test_dora.py@@ -207,6 +207,9 @@ class TestDoraQuery(ClickhouseTestMixin, BaseTest):# work: d1 succeeded after PR 6's merge but its head merged before it, so d1 doesn't count.assert result.median_merge_to_deploy_seconds == 9000.0assert result.median_merge_to_deploy_seconds_prev == 7200.0+ # Open→deploy per PR: PR 1 26h, PR 2 28h, PR 6 51h; prev window PR 5 4h.+ assert result.median_open_to_deploy_seconds == 100800.0+ assert result.median_open_to_deploy_seconds_prev == 14400.0assert result.merged_pr_count == 4 # PRs 1, 2, 4, 6; the bot merge is excludedassert result.unattributed_merged_pr_share == 0.25 # PR 4 merged Jan 19, never deployedassert result.latest_deploy_status_at == datetime(2026, 1, 13, 12, 0, tzinfo=UTC)diff --git a/products/engineering_analytics/frontend/generated/api.schemas.ts b/products/engineering_analytics/frontend/generated/api.schemas.tsindex f573a0f01a29..d7b35954ab2f 100644--- a/products/engineering_analytics/frontend/generated/api.schemas.ts+++ b/products/engineering_analytics/frontend/generated/api.schemas.ts@@ -288,6 +288,16 @@ export interface DoraOverviewApi {* @nullable*/median_merge_to_deploy_seconds_prev: number | null+ /**+ * Median seconds from a PR's open to the first successful deployment containing it — the full open-to-deploy lead time over the same deployed-PR population as median_merge_to_deploy_seconds. Null when nothing deployed in the window.+ * @nullable+ */+ median_open_to_deploy_seconds: number | null+ /**+ * Previous-window twin of median_open_to_deploy_seconds.+ * @nullable+ */+ median_open_to_deploy_seconds_prev: number | null/** PRs first deployed in the window — the population behind the merge-to-deploy median and box plot. */deployed_pr_count: number/** Previous-window twin of deployed_pr_count. */diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsHealth.stories.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsHealth.stories.tsxindex 882839a8b0a1..d8e7d38413fc 100644--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsHealth.stories.tsx+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsHealth.stories.tsx@@ -65,6 +65,8 @@ const DORA: DoraOverviewApi = {deployments_per_day_prev: 7.4,median_merge_to_deploy_seconds: 2520,median_merge_to_deploy_seconds_prev: 3300,+ median_open_to_deploy_seconds: 63000,+ median_open_to_deploy_seconds_prev: 82500,deployed_pr_count: 103,deployed_pr_count_prev: 88,failed_deployment_count: 2,@@ -99,6 +101,8 @@ const EMPTY_DORA: DoraOverviewApi = {deployments_per_day_prev: null,median_merge_to_deploy_seconds: null,median_merge_to_deploy_seconds_prev: null,+ median_open_to_deploy_seconds: null,+ median_open_to_deploy_seconds_prev: null,deployed_pr_count: 0,deployed_pr_count_prev: 0,failed_deployment_count: 0,diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsHealth.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsHealth.tsxindex 26d738b21ceb..e877c32131df 100644--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsHealth.tsx+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsHealth.tsx@@ -105,7 +105,7 @@ export function EngineeringAnalyticsHealth(): JSX.Element {)}{githubTeam && (<span className="text-xs text-tertiary">- The team filter narrows the merge to deploy figures. Deploy counts stay repo-wide.+ The team filter narrows the lead time figures. Deploy counts stay repo-wide.</span>)}{dora?.latest_deploy_status_at && (@@ -132,22 +132,22 @@ export function EngineeringAnalyticsHealth(): JSX.Element {loading={firstLoad}/><MetricTile- label="Merge to deploy"- tooltip={`Median wait from a PR's merge to the first successful deployment containing it, over ${dora?.deployed_pr_count ?? 0} deployed PRs (bots and drafts excluded). Not full commit-to-deploy lead time: pre-merge time is on the Overview tab.`}+ label="Open to deploy"+ tooltip={`Median from a PR's open to the first successful deployment containing it, over ${dora?.deployed_pr_count ?? 0} deployed PRs (bots and drafts excluded). The full lead time: the box plots below split it into open to merge and merge to deploy.`}value={- dora?.median_merge_to_deploy_seconds != null- ? compactAgeLabel(dora.median_merge_to_deploy_seconds)+ dora?.median_open_to_deploy_seconds != null+ ? compactAgeLabel(dora.median_open_to_deploy_seconds): '—'}delta={{value: percentChange(- dora?.median_merge_to_deploy_seconds,- dora?.median_merge_to_deploy_seconds_prev+ dora?.median_open_to_deploy_seconds,+ dora?.median_open_to_deploy_seconds_prev),goodWhenDown: true,}}sub={- dora && dora.median_merge_to_deploy_seconds == null+ dora && dora.median_open_to_deploy_seconds == null? 'No PRs were deployed in this window.': undefined}diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex e1542836249a..97fcbf0af163 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -29090,6 +29090,16 @@ export namespace Schemas {* @nullable*/median_merge_to_deploy_seconds_prev: number | null;+ /**+ * Median seconds from a PR's open to the first successful deployment containing it — the full open-to-deploy lead time over the same deployed-PR population as median_merge_to_deploy_seconds. Null when nothing deployed in the window.+ * @nullable+ */+ median_open_to_deploy_seconds: number | null;+ /**+ * Previous-window twin of median_open_to_deploy_seconds.+ * @nullable+ */+ median_open_to_deploy_seconds_prev: number | null;/** PRs first deployed in the window — the population behind the merge-to-deploy median and box plot. */deployed_pr_count: number;/** Previous-window twin of deployed_pr_count. */