Repository navigation
Description
The unbuilt half of the telemetry programme · release mvp · estimate 3.0 eng-weeks
Tracing is done; cost attribution is not started. This is telemetry plan P16 + P17 — two Postgres entities, a roll-up job, and five derived alarms. The owner named it as co-equal with tracing: "what is absolutely critical is understanding costs and being able to attribute every single sql statement". The statement half is built and persisted; the dollars half is not.
Note: issue #579, the closed
shippedcard, is titled "Observability — OpenTelemetry with cost attribution". Its body claims only tracing and statement attribution, which is accurate. The title overstates. This issue is the missing half.
Two blockers, both outside the code
- Split cost allocation is not switched on. Measured 2026-11-05: 0 of 19,770 November CUR rows carry split-allocation columns. It is a Billing console toggle, and it does not backfill — every day of delay is permanently unattributable pod-level spend. Tracked separately as Cost allocation tags + CUR verification #563, which is currently labelled
post-appexchangewhile this ismvp. That contradiction needs resolving — this cannot ship ahead of its blocker. - There is no runner workload to cost. October billed 0.3 hours of runner compute. A cost model calibrated against nothing converges on nothing, so this needs the batch orchestration work to be running real jobs first.
Decisions already taken — do not re-derive these
The design work is done and is worth carrying forward verbatim, because each of these was reasoned against a specific blocked alternative:
compute_priceis self-calibrated from the CUR, not the Pricing API. The obvious path is architecturally closed:rbac-dispatcher.yamllistsnodesas deliberately absent, andnodesis cluster-scoped so granting it means a ClusterRole against D-TENANCY; IMDS is closed by the §5.6 hop limit. A blended rate per(class, billing_period)also folds the family mix, the spot/on-demand mix and the Auto Mode ~12% fee in automatically, and converges rather than drifting.wait_secondsis part of the cost.allocated_usd = (wait_seconds + run_seconds) / 3600 * usd_per_pod_hour. A node was provisioned for that attempt — real money. Dropping the ~30s provision-dominated cold start understates a 120s run by 25%.- S and M carry the same rate, and that is not a bug. With the runner taint,
do-not-disruptandinFlightCap: 1, a 2-vCPU S pod holds a whole node exactly as a 6-vCPU M pod does. The cost lever is duration, not class. Say so in the docs or somebody will "optimize" by downgrading a class and change nothing. run_costis an entity, not a view. The CUR arrives 24–48h late and is revised, so the row carries bothallocated_usdandbilled_usd/billed_as_of.task_instances.livegoes NULL on archive, so a view would lose exactly the retried attempts the failure-spend query needs.- The pod→CUR join is
line_item_resource_idtail →task_instances.pod_uid(unique across namespaces and restarts, unlikepod_name).resource_tagsexposes only the six AWS-generatedaws:eks:*tags, so theer.dupezero.com/*pod labels will not be CUR columns. - Per-statement cost is normalised by attempt WALL time, not by the statement sum. Normalising by the sum makes shares total 100% and hides the residual — DuckDB parallelism outside statement boundaries, the cold start, inter-statement latency. Publish
coverageon every roll-up; if it is 61%, say 61%. - Never quote a per-statement dollar figure below $0.01. Present a share of wall time with dollars derived. The failure to avoid: someone reads "
golden_record.upsertcosts $0.42/run", spends a week optimising, and finds nothing, because its 30% wall share was 90% waiting on something the SQL cannot influence. - Do not build per-statement S3 attribution. 10,000 GETs per run is $0.004 and S3→EC2 in-region is $0. Emit
s3_get_requestsper attempt and alarm above 1M GETs/run, which is a partition-layout bug worth paging on.
The alarms (P17)
Aggregate scalars with no tenant dimension — the tenant's identity rides in the report payload, never a label. MaxTenantSpendShare > 0.5; MaxTenantDisproportion ≥ 3 for 2 of 3 periods; FailedRunSpendShare > 0.20; MaxCostPerMillionMoMChange > 0.5 twice consecutively; CurStalenessHours > 48.
disproportion = share_of_spend / share_of_records is the one scalar expressing "a small tenant costing like a big one". It is a max over (org, dataset) pairs, which is how it reaches a CloudWatch alarm without breaking the cardinality rule.
Cost-per-million must be per dataset, not per org: one org now runs several datasets concurrently and its org-level figure is a blend that hides the degrading one.
Current independent delivery
#1050 / merged PR #1051 implements the pending-runner and oldest-queued-job age alerts below, extending #552's operational snapshot/module. Post-merge/live-readback evidence is recorded in that PR ledger. Existing child #877 tracks the standalone alarm programme, including the remaining three signals and confirmation of the live alert path. The cost model remains on this parent; neither this parent nor #877 is complete.
Also unbuilt, and higher value per unit of effort than the model
None of these exist and none need the cost model:
- runner pod pending > 600s — the vCPU quota leaving a pod pending forever is a documented trap that has already cost real time
- oldest queued job age > 900s
- attempt failure rate > 25%/h
- spot interruption rate — how the spot assumption gets verified rather than trusted
- impersonation volume — free the moment
erweb.audithas rows, and the most security-valuable item in the set
Consider doing these first; they are independent of both blockers above.
Tasks
- Resolve the
mvp/post-appexchangecontradiction with Cost allocation tags + CUR verification #563 and switch on split cost allocation. -
infra/terraform/envs/core/athena.tf— Glue database, partition projection onBILLING_PERIOD, a 10 GiBbytes_scanned_cutoff_per_queryso a forgottenWHEREfails instead of billing. (Plan P1; also unbuilt.) - The three CUR probe queries in
docs/runbook.md, answered against one real month. - The two entities, the
er-server cost-rollCronJob, the five alarms. - The five standalone alarms above, which can land first.
Measurements dated 2026-11-05. The design decisions are from the telemetry plan and were each reasoned against a specific blocked alternative; the blockers were probed, not assumed.
Product context (2026-11-26)
Why this matters for the API product: This is indirect. It doesn't change any API step, but it gives cost per dataset and a runaway-tenant alarm. Both are needed to price the API and to operate safely with many tenants.
Current state:
- The claim is stale.
athvinmoved the card to In progress on 2026-11-08 (the day The five standalone telemetry alarms that need no cost model (runner-pending, queue age, failure rate, spot interruptions, impersonation volume) #877 was filed). It has no assignee, no claim comment and no open or draft PR. Underclaim-ticket, a claim is an open draft PR, so nobody holds this. - Cost allocation tags + CUR verification #563, the tracker for the split-cost opt-in, was closed as
prunedin the 2026-11-26 prune. The opt-in blocker now lives only here. Themvp/post-appexchangecontradiction in task 1 is moot. - Tasks 2, 3 and 5 are done:
envs/core/athena.tf; the probes iner-engine-ops/references/runbook.md(around line 205); and The five standalone telemetry alarms that need no cost model (runner-pending, queue age, failure rate, spot interruptions, impersonation volume) #877 via PRs feat(observability): add operational dashboards and alerts (#552) #1046, feat(observability): alert on pending pods and oldest queued jobs (#1050) #1051 and feat(obs): the three remaining standalone alarms — failure rate, spot interruptions, impersonation volume (#877) #1293. Blocker 2 is cleared by Observe an L-class run as three Jobs across two node classes #649/Phase 5 — measure the executor against the in-process monolith #650. The body'sdocs/runbook.mdpath is gone. - The join key already exists (
entities/task_instance/entity.yaml:144,pod_uid). No cost entity,cost-rollorcompute_pricecode exists on main. - One fact not in the body: the Auto Mode fee (~12%) is billed on its own line and won't appear in split rows. The model has to apportion it (runbook probe P2).
Definition of done: As above, for task 4 only.
Dependencies / sequencing: It's blocked on the owner console action. After that, wait one day of data. Move the card back to Todo or mark it blocked until then.
Open product decision: The owner has to enable Billing → Cost Management preferences → Split cost allocation data → Amazon EKS. It can only be done in the console, and it doesn't backfill.
Size: About 2 engineer-weeks remaining, down from 3. This is unverified.
Activity
athvin commentedon Nov 8, 2026
Filed #877 for the five standalone alarms — the part of this issue that is independent of both blockers, per this issue's own 'consider doing these first'.
athvin commentedon Nov 27, 2026
Status 2026-11-27 (autonomous board pass).
Still blocked on one owner action, and it is the only blocker left for the data: the account-level Billing → Cost Management preferences → Split cost allocation data → Amazon EKS opt-in. It is console-only (no API/CLI — confirmed against the CUR user guide), free, and does not backfill.
Re-probed today with
er-builder: the CUR 2.0 export still hasINCLUDE_SPLIT_COST_ALLOCATION_DATA = TRUE, and 0 of 147,646 November rows (2026-11-01 → 2026-11-26) carry asplit_line_item_split_cost.Project/Environment/ManagedByare active;Developeris on no resource;aws:eks:cluster-nameinactive.Done meanwhile:
cur2table already exist inenvs/core/athena.tf— the task list's "unbuilt" is stale.er-engine-ops/references/runbook.md.Remaining here once the opt-in has produced a day of data: the two entities, the
cost-rollCronJob and the five cost alarms.feat(obs): attribute runner cost from the CUR by instance, with five …
feat(obs): attribute runner cost from the CUR by instance, with five …