Skip to content

release: promote staging to prod#1436

Merged
suisuss merged 2 commits into
prodfrom
staging
Jun 2, 2026
Merged

release: promote staging to prod#1436
suisuss merged 2 commits into
prodfrom
staging

Conversation

@suisuss
Copy link
Copy Markdown

@suisuss suisuss commented Jun 2, 2026

Promotes staging to prod - wave 2 of the gas-denormalization work (2 commits, read-switch only).

What

Flips the two heaviest /analytics gas reads off the per-step workflow_execution_logs.output JSONB scan and onto the workflow_executions.gas_used_wei column:

  • getWorkflowGasTotal (summary KPI, current + previous period)
  • the workflow portion of getSpendCapData (today's gas vs daily cap)

No migration, no schema change, no @requires-db-prep. Only lib/analytics/queries.ts changes.

Why this is safe to deploy now

The column it reads is already live and verified on prod from wave 1 (#1435):

  • Backfill completed (4,940 historical rows, clean full walk) and the writer is populating new runs.
  • Equivalence gate passed on prod: 0 per-org mismatches, identical grand totals (col == json to the wei). So the read-switch reads a column already proven equal to the old JSON computation.

Because the column is correct, flipping the reads keeps the dashboard numbers stable.

Impact

Removes the logs join, the JSONB parse, and the TOAST detoast from the gas reads. Staging proxy EXPLAIN (heaviest org, 30d): 2,140 ms / ~5.1 GB -> 397 ms / ~162 MB, with the date filter now index-pushed. On prod this eliminates the ~33 GB per-load scan behind the 2026-05-29 RDS CPU incident.

Behavioral note

Gas is now windowed by run-start time (workflow_executions.started_at) rather than per-step time, because the column is a run-level rollup. This makes gas consistent with every other summary metric; only boundary-straddling runs reattribute, immaterially at dashboard granularity. The per-network breakdown still reads step-level data and is unchanged.

Before merging

Confirm the staging deploy of #1434 is healthy (read-switch live, /analytics renders, no new errors). Prod correctness is already established by the wave-1 gate; staging is the runtime sanity check on the read-switch code.

suisuss added 2 commits June 2, 2026 16:05
…spend-cap

Switch getWorkflowGasTotal (summary current + previous period) and the
workflow portion of getSpendCapData to SUM workflow_executions.gas_used_wei
instead of re-extracting and summing the per-step logs JSONB. Removes the
logs join, the JSONB parse, and the TOAST detoast - the org+window slice is
aggregated straight off workflow_executions with the date filter pushed into
idx_workflow_executions_workflow_started.

Staging proxy EXPLAIN (heaviest org, 30d): 2140ms / 5.1GB -> 397ms / 162MB.

Gas is now windowed by run start (workflow_executions.started_at) rather than
per-step time, consistent with the other summary metrics. Depends on the
denormalized columns and backfill from the previous PR.
…ad-column

perf: switch analytics gas reads to the denormalized column
@suisuss suisuss merged commit 597e120 into prod Jun 2, 2026
30 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant