Skip to content

Add auction timeline offsets spec amendment - #1076

Open
jevansnyc wants to merge 4 commits into
feat/request-phase-timingfrom
spec/auction-timeline-offsets
Open

Add auction timeline offsets spec amendment#1076
jevansnyc wants to merge 4 commits into
feat/request-phase-timingfrom
spec/auction-timeline-offsets

Conversation

@jevansnyc

@jevansnyc jevansnyc commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Spec-first follow-up to #1074, targeting the feature branch so it lands with (or after) the base spec rather than against main.

Adds section 18 to the request phase timing design: three T0-anchored auction milestones so the auction's timeline and the request's timeline finally share a clock.

Problem

Two clocks that never meet: auction_events_raw measures the auction internally (total_time_ms, per-provider provider_response_time_ms) on a clock that starts at auction creation; the access row is T0-anchored but only records auction_wait_ms (blocked time at collect). Nothing can answer: when did the auction start relative to request entry, when did the final bid land, and when was targeting committed toward GAM.

Design

  • Three first-call-wins marks on RequestTimings (same style as mark_headers_ready()): dispatched (bid requests left the edge), resolved (final bid or timeout), committed (write_bids_to_state returned; targeting available to the response pipeline in both buffered and streaming modes).
  • Four additive columns on access_logs_raw: auction_dispatched_ms / auction_resolved_ms / auction_committed_ms (Nullable UInt32; null = no auction ran) plus auction_id (join key to the per-bidder auction dataset; none sentinel).
  • No header emission, no config surface, no new emission path: values ride the existing snapshot and the existing tinybird.access_enabled gate. Additive schema evolution with JSONPaths + FORWARD_QUERY, checked with tb --cloud deploy --check.
  • "Committed toward GAM" is defined as edge-side commit: TS never calls GAM server-side; the browser GPT call carries the targeting, and that half of the timeline stays client-measured.

Why it matters

This is the overlap proof: a client-side wrapper cannot dispatch until the browser boots (t~3000ms on measured prospect pages); the server-side auction dispatches while the origin fetch is in flight. One access row then reads as a timeline (dispatch at t=D, resolve at t=R, commit at t=C, headers at t=H), with R - D joining per-bidder detail via auction_id, and auction_wait_ms finally interpretable next to it: (R - D) - auction_wait_ms approximates how much of the auction was absorbed by work the request needed anyway.

Update: implementation is included in this PR (per owner direction), as separate commits on top of the spec: the three marks on RequestTimings, the publisher call sites, the four row columns, and the datasource evolution (validated with tb --cloud deploy --check; the FORWARD_QUERY triggers a backfill at promotion, acceptable at current volume and required for the none sentinel on pre-existing rows). All CI gates pass locally.

🤖 Generated with Claude Code

Adds section 18 to the request phase timing spec: three first-call-wins
T0 offsets (auction dispatched, resolved, committed) on RequestTimings,
emitted as additive nullable columns on access_logs_raw with auction_id
as the join key to the per-bidder auction dataset. Answers the
overlap-proof questions the two existing clocks cannot: when the
auction started relative to request entry, when the final bid landed,
and when targeting was committed toward GAM.
Implements spec section 18: three first-call-wins marks on
RequestTimings (dispatched at the DispatchAuctionOutcome::Dispatched
arm, resolved after collect at both sites, committed after
write_bids_to_state at both sites), carried through TimingSnapshot into
four additive access_logs_raw columns: auction_dispatched_ms,
auction_resolved_ms, auction_committed_ms, and auction_id as the join
key to the per-bidder auction dataset. Null offsets mean no auction
ran; a failed dispatch records nothing. FORWARD_QUERY fills the new
columns with typed defaults for pre-existing rows.

No header emission, no config surface, no adapter changes: the values
ride the existing snapshot and the tinybird.access_enabled gate.
The Cloudflare integration harness writes
wrangler.integration.generated.toml at test time; it was swept into the
previous commit by accident. Ignore it so local CI=1 runs cannot commit
it again.
@aram356
aram356 requested review from ChristianPavilonis, aram356 and prk-Jr and removed request for prk-Jr August 28, 2026 20:58
@aram356 aram356 added this to the 202608 milestone Aug 28, 2026
@aram356
aram356 removed their request for review August 31, 2026 15:21

@ChristianPavilonis ChristianPavilonis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Reviewed 1fa9f8cc09df889aec42039b13b7a108d1df9d47 against 38043d7464362d44519153a09fe850bacc256b58. Two actionable telemetry-correctness issues are posted inline. Focused WASM tests and Rust formatting passed; the Tinybird schema evolution could not be independently dry-run without credentials. The current format-docs CI check also fails on the new implementation plan.

.await;
timings.record_auction_wait(*placement, wait_started.elapsed());
// T0-anchored timeline mark (spec section 18): final bid or timeout.
timings.mark_auction_resolved();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 P1 / High: Resolved time is collection time, not bidder completion time

Issue: When bidder responses finish before the origin stream reaches </body>, nothing polls them until the seam. This line stamps auction_resolved_ms only after collect_dispatched_auction returns, potentially much later. An all-immediate provider result makes this explicit: the auction is terminal at dispatch, but this mark still waits for the seam.

Impact: R - D includes origin fetch and body-stream delay rather than auction duration. The documented overlap calculation can therefore substantially overstate auction runtime and cannot answer when the final bid landed, which is the main purpose of this change.

Evidence: Collection starts at the delayed body seam, while collect_dispatched_auction performs the first select over pending requests. The focused split_auction_accepts_an_all_immediate_no_bid_result test passes and confirms that Dispatched does not imply work remains.

Suggested fix: Capture the terminal timestamp when the final provider actually completes or times out, then pass that timestamp into RequestTimings. This likely requires polling collection concurrently or receiving completion timing from the transport. If that is unavailable, rename the field to auction_collected_ms and remove the auction-duration and overlap claims. Add a delayed-collection regression test.

"auction_dispatched_ms": timings.auction_dispatched_ms,
"auction_resolved_ms": timings.auction_resolved_ms,
"auction_committed_ms": timings.auction_committed_ms,
"auction_id": timings.auction_id.as_deref().unwrap_or("none"),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 P2 / Medium: Auction API requests serialize as if no auction ran

Issue: The new fields are marked only by the split initial-page auction path. Successful /auction and /_ts/page-bids requests run auctions and emit auction_events_raw rows, but their access rows retain null offsets and the none auction ID serialized here.

Impact: Every Fastly access row for these routes loses its join to per-bidder telemetry and violates the documented meaning that null or none means no auction ran.

Evidence: POST /auction calls run_auction in auction/endpoints.rs, and GET /_ts/page-bids calls it in publisher.rs; neither path invokes any of the new mark methods. The Fastly post-send emitter still serializes the shared RequestTimings snapshot for both routes.

Suggested fix: Instrument both handlers using their AuctionObservationContext::auction_id and accurate lifecycle timestamps. If these columns intentionally cover only initial publisher navigation, document and name that narrower scope rather than using a global no-auction sentinel. Add route-level row tests.

@prk-Jr prk-Jr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Clean, well-scoped increment: the three marks reuse RequestTimings' existing infallible model exactly, both write_bids_to_state call sites are covered, and the auction_id recorded on the row is genuinely observation.auction_id — the same UUID auction_events_raw carries — so the join key is real. Two things block: format-docs is red on the new plan document, and the new non-Nullable auction_id column leaves the Tinybird fixture invalid against its own schema. The rest are spec-accuracy and test-strength points.

6 of the inline comments below carry a one-click GitHub suggestion — use Commit suggestion (or Add suggestion to batch for several at once) to apply them as commits on the PR branch. Every suggestion was applied and verified in an isolated worktree at this head before being posted. The remaining comments describe the fix in prose because the change touches another file or would drift under a formatter.

Blocking

🔧 wrench

  • format-docs CI fails — plan doc not Prettier-formatted — see inline at docs/superpowers/plans/2026-08-26-auction-timeline-offsets.md:25
  • Non-Nullable auction_id leaves the fixture invalid and constrains deploy order — see inline at tinybird/datasources/access_logs_raw.datasource:34

Non-blocking

♻️ refactor

  • auction_marks_are_first_call_wins… doesn't test first-call-wins — see inline at crates/trusted-server-core/src/request_timing.rs:504

🤔 thinking

  • Null on resolved/committed also means abandoned, not only "no auction ran" — see inline at docs/superpowers/specs/2026-08-24-request-phase-timing-design.md:628
  • Timeline ladder is wrong for in_stream placement — see inline at docs/superpowers/specs/2026-08-24-request-phase-timing-design.md:654

⛏ nitpick

  • Section 18 Status line is stale — implementation is in this PR — see inline at docs/superpowers/specs/2026-08-24-request-phase-timing-design.md:568
  • Dispatch mark is recorded after dispatch_auction returns, in the caller — see inline at docs/superpowers/specs/2026-08-24-request-phase-timing-design.md:599
  • .gitignore entry reads as part of the defunct-crate-dirs block — see inline at .gitignore:66

Cross-cutting / body-level findings

  • 🤔 No test covers the three publisher call sites. The marks are unit-tested on RequestTimings, but nothing asserts that a dispatched auction actually yields non-null offsets end to end — Task 2 of the plan has no test checkbox. All three are one-line calls in the middle of long functions (publisher.rs:3955, :3967, :4019, :4035, :4356), the kind a refactor drops silently while every existing test stays green. publisher.rs already has auction coverage around write_bids_to_state (~17779, ~18104) to build on. Body-level because the fix is a new test outside this diff.

  • 📝 The join key's type differs from the dataset it joins. access_logs_raw.auction_id is String with a 'none' sentinel; auction_events_raw.auction_id is UUID. A join needs toUUIDOrNull(a.auction_id) = e.auction_id — plain toUUID throws on the sentinel rows rather than skipping them. Non-nullable String is the right call given section 9's sentinel convention; this is only about making sure the first dashboard query doesn't hit it, so a line in the spec's interpretation section would earn its keep.

  • 👍 auction_id is plain String, not LowCardinality(String). Every neighbouring dimension in that SCHEMA block is LowCardinality, so pattern-matching the line above would have been the easy mistake, and it would have been a bad one for an unbounded random UUID. The marks also reuse the existing model exactly — try_lock, first-call-wins, saturating duration_ms — so they add no new failure mode to a module whose contract is "never panics, never blocks", and the null-row assertion loop in access_telemetry.rs was extended rather than duplicated.

CI Status

  • browser integration tests: PASS
  • integration tests: PASS
  • integration tests (Fastly EC lifecycle): PASS
  • cargo test (axum native): PASS
  • cargo test (ts CLI, native): PASS
  • cargo check/build/test (spin native + wasm32-wasip1): PASS
  • cargo check (cloudflare native + wasm32-unknown-unknown): PASS
  • cargo test (cross-adapter parity): PASS
  • cargo test: PASS
  • cargo fmt: PASS
  • vitest: PASS
  • format-typescript: PASS
  • prepare integration artifacts: PASS
  • format-docs: FAILprettier --check rejects docs/superpowers/plans/2026-08-26-auction-timeline-offsets.md (see the 🔧 finding above)

Branch protection reports no required checks on this branch, so none of these are merge-blocking under protection; format-docs is still a CLAUDE.md PR gate.

Comment on lines +25 to +53
**Files:**
- Modify: `crates/trusted-server-core/src/request_timing.rs`

**Interfaces:**
- Produces: `mark_auction_dispatched(&self, auction_id: String)`, `mark_auction_resolved(&self)`, `mark_auction_committed(&self)`; `TimingSnapshot { auction_dispatched_ms, auction_resolved_ms, auction_committed_ms: Option<u32>, auction_id: Option<String>, .. }`

- [ ] Add `auction_dispatched`, `auction_resolved`, `auction_committed: Option<Duration>` and `auction_id: Option<String>` to `Inner`; initialize `None`.
- [ ] Add the three mark methods, first-call-wins on their own field, storing `inner.t0.elapsed()`; dispatched also stores the id first-call-wins.
- [ ] Map all four into `TimingSnapshot` via `duration_ms` / clone.
- [ ] Tests: first-call-wins per mark; snapshot maps offsets and id; unmarked snapshot yields all `None`.
- [ ] `cargo test-fastly request_timing`, commit.

### Task 2: Publisher call sites

**Files:**
- Modify: `crates/trusted-server-core/src/publisher.rs`

**Interfaces:**
- Consumes: Task 1 methods; `observation.auction_id` (`AuctionObservationContext`), in scope at the dispatch site.

- [ ] In the `DispatchAuctionOutcome::Dispatched` arm (~line 4341): `timings.mark_auction_dispatched(observation.auction_id.to_string());`
- [ ] After both `record_auction_wait` calls (collect sites ~3952 and ~4012): `mark_auction_resolved()`.
- [ ] After both `write_bids_to_state` calls (~3954 and ~4017): `mark_auction_committed()`.
- [ ] `cargo test-fastly`, commit.

### Task 3: Row columns and datasource

**Files:**
- Modify: `crates/trusted-server-core/src/access_telemetry.rs`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 wrenchformat-docs CI fails on this file. Prettier 3.8.1 (the pinned docs/node_modules version) requires a blank line between a **Files:** / **Interfaces:** paragraph and the list that follows it; five are missing across the three tasks.

Reproduced locally with the pinned binary, and verified that this replacement makes prettier --check pass on both docs files in this PR with no other formatting drift.

Suggested change
**Files:**
- Modify: `crates/trusted-server-core/src/request_timing.rs`
**Interfaces:**
- Produces: `mark_auction_dispatched(&self, auction_id: String)`, `mark_auction_resolved(&self)`, `mark_auction_committed(&self)`; `TimingSnapshot { auction_dispatched_ms, auction_resolved_ms, auction_committed_ms: Option<u32>, auction_id: Option<String>, .. }`
- [ ] Add `auction_dispatched`, `auction_resolved`, `auction_committed: Option<Duration>` and `auction_id: Option<String>` to `Inner`; initialize `None`.
- [ ] Add the three mark methods, first-call-wins on their own field, storing `inner.t0.elapsed()`; dispatched also stores the id first-call-wins.
- [ ] Map all four into `TimingSnapshot` via `duration_ms` / clone.
- [ ] Tests: first-call-wins per mark; snapshot maps offsets and id; unmarked snapshot yields all `None`.
- [ ] `cargo test-fastly request_timing`, commit.
### Task 2: Publisher call sites
**Files:**
- Modify: `crates/trusted-server-core/src/publisher.rs`
**Interfaces:**
- Consumes: Task 1 methods; `observation.auction_id` (`AuctionObservationContext`), in scope at the dispatch site.
- [ ] In the `DispatchAuctionOutcome::Dispatched` arm (~line 4341): `timings.mark_auction_dispatched(observation.auction_id.to_string());`
- [ ] After both `record_auction_wait` calls (collect sites ~3952 and ~4012): `mark_auction_resolved()`.
- [ ] After both `write_bids_to_state` calls (~3954 and ~4017): `mark_auction_committed()`.
- [ ] `cargo test-fastly`, commit.
### Task 3: Row columns and datasource
**Files:**
- Modify: `crates/trusted-server-core/src/access_telemetry.rs`
**Files:**
- Modify: `crates/trusted-server-core/src/request_timing.rs`
**Interfaces:**
- Produces: `mark_auction_dispatched(&self, auction_id: String)`, `mark_auction_resolved(&self)`, `mark_auction_committed(&self)`; `TimingSnapshot { auction_dispatched_ms, auction_resolved_ms, auction_committed_ms: Option<u32>, auction_id: Option<String>, .. }`
- [ ] Add `auction_dispatched`, `auction_resolved`, `auction_committed: Option<Duration>` and `auction_id: Option<String>` to `Inner`; initialize `None`.
- [ ] Add the three mark methods, first-call-wins on their own field, storing `inner.t0.elapsed()`; dispatched also stores the id first-call-wins.
- [ ] Map all four into `TimingSnapshot` via `duration_ms` / clone.
- [ ] Tests: first-call-wins per mark; snapshot maps offsets and id; unmarked snapshot yields all `None`.
- [ ] `cargo test-fastly request_timing`, commit.
### Task 2: Publisher call sites
**Files:**
- Modify: `crates/trusted-server-core/src/publisher.rs`
**Interfaces:**
- Consumes: Task 1 methods; `observation.auction_id` (`AuctionObservationContext`), in scope at the dispatch site.
- [ ] In the `DispatchAuctionOutcome::Dispatched` arm (~line 4341): `timings.mark_auction_dispatched(observation.auction_id.to_string());`
- [ ] After both `record_auction_wait` calls (collect sites ~3952 and ~4012): `mark_auction_resolved()`.
- [ ] After both `write_bids_to_state` calls (~3954 and ~4017): `mark_auction_committed()`.
- [ ] `cargo test-fastly`, commit.
### Task 3: Row columns and datasource
**Files:**
- Modify: `crates/trusted-server-core/src/access_telemetry.rs`

`auction_dispatched_ms` Nullable(UInt32) `json:$.auction_dispatched_ms`,
`auction_resolved_ms` Nullable(UInt32) `json:$.auction_resolved_ms`,
`auction_committed_ms` Nullable(UInt32) `json:$.auction_committed_ms`,
`auction_id` String `json:$.auction_id`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 wrenchauction_id is the only new column that is non-Nullable and carries no DEFAULT, which has two consequences this PR doesn't cover.

1. The fixture is now invalid against its own schema. tinybird/fixtures/access_logs_raw.ndjson holds a single row that has no auction_id key, so it no longer satisfies this datasource and will land in quarantine rather than the table. This isn't a missing nicety — commit 72d5755 ("Extend access_logs_raw with phase columns and a non-null sorting key"), the commit that gave this datasource its current shape, created and populated that fixture in the same commit. Extending SCHEMA without extending the fixture is drift against the convention this file was born with.

Proposed fixture row (apply manually — different file, so it can't be a suggestion here):

{"event_ts":"2026-06-23 12:00:00.000","method":"GET","status":200,"time_elapsed_ms":145,"sample_rate":0.1,"service_id":"abc123","publisher_domain":"test-publisher.com","env":"production","route_class":"publisher_html","route_template":"/news/*","body_mode":"streamed","auction_wait_placement":"in_stream","appbuild_ms":12,"filter_ms":5,"geo_ms":3,"kv_ms":8,"origin_ms":25,"template_cache_ms":10,"auction_wait_ms":45,"stream_ms":18,"request_elapsed_ms":145,"resp_bytes":8192,"auction_dispatched_ms":18,"auction_resolved_ms":63,"auction_committed_ms":64,"auction_id":"33333333-3333-3333-3333-333333333333","template_cache_state":"hit","country":"US","ts_version":"v1.2.3","pop":"SFO"}

2. It constrains deploy order. The FORWARD_QUERY backfills the 'none' sentinel onto pre-existing rows, but it does nothing for rows that arrive after promotion from a build that doesn't emit the key yet. Promoting the datasource ahead of the Wasm quarantines every access row for the length of that window. Deploying the Wasm first is the safe order — Tinybird ignores JSON keys that have no column, so the extra auction_id is inert until the schema lands. Worth stating explicitly in the PR's rollout note, since the description currently only discusses the backfill direction.

Comment on lines +504 to +525
let timings = RequestTimings::new();
timings.mark_auction_dispatched("11111111-1111-1111-1111-111111111111".to_owned());
timings.mark_auction_resolved();
timings.mark_auction_committed();
// Second calls must not overwrite the first-recorded values.
timings.mark_auction_dispatched("22222222-2222-2222-2222-222222222222".to_owned());
timings.mark_auction_resolved();
timings.mark_auction_committed();

let snapshot = timings.snapshot();
assert!(
snapshot.auction_dispatched_ms.is_some(),
"should record the dispatch offset"
);
assert!(
snapshot.auction_resolved_ms.is_some(),
"should record the resolve offset"
);
assert!(
snapshot.auction_committed_ms.is_some(),
"should record the commit offset"
);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ refactor — This test doesn't test what its name says for two of the three marks.

The three offset assertions are is_some(), which holds whether or not the first-call-wins guards exist. auction_id is the only witness that a guard actually fired, and it only witnesses the auction_dispatched branch — mark_auction_resolved and mark_auction_committed have no coverage of their is_none() check at all. Deleting either guard leaves this test green.

mark_headers_ready_is_first_call_wins (line 598, same module) already establishes the pattern: snapshot, sleep past the millisecond truncation in duration_ms, re-mark, compare.

Verified in a scratch worktree at this head: cargo fmt --all -- --check clean, cargo clippy-fastly clean, cargo test-fastly -p trusted-server-core --lib request_timing 12/12 pass, no post-verification drift. Also mutation-tested — removing the inner.auction_resolved.is_none() guard makes this revised test fail, while the current version still passes.

Suggested change
let timings = RequestTimings::new();
timings.mark_auction_dispatched("11111111-1111-1111-1111-111111111111".to_owned());
timings.mark_auction_resolved();
timings.mark_auction_committed();
// Second calls must not overwrite the first-recorded values.
timings.mark_auction_dispatched("22222222-2222-2222-2222-222222222222".to_owned());
timings.mark_auction_resolved();
timings.mark_auction_committed();
let snapshot = timings.snapshot();
assert!(
snapshot.auction_dispatched_ms.is_some(),
"should record the dispatch offset"
);
assert!(
snapshot.auction_resolved_ms.is_some(),
"should record the resolve offset"
);
assert!(
snapshot.auction_committed_ms.is_some(),
"should record the commit offset"
);
let timings = RequestTimings::new();
timings.mark_auction_dispatched("11111111-1111-1111-1111-111111111111".to_owned());
timings.mark_auction_resolved();
timings.mark_auction_committed();
let first = timings.snapshot();
assert!(
first.auction_dispatched_ms.is_some(),
"should record the dispatch offset"
);
assert!(
first.auction_resolved_ms.is_some(),
"should record the resolve offset"
);
assert!(
first.auction_committed_ms.is_some(),
"should record the commit offset"
);
// Sleep past `duration_ms`'s millisecond truncation so a restamp
// would change the recorded value, matching
// `mark_headers_ready_is_first_call_wins`.
std::thread::sleep(Duration::from_millis(5));
// Second calls must not overwrite the first-recorded values.
timings.mark_auction_dispatched("22222222-2222-2222-2222-222222222222".to_owned());
timings.mark_auction_resolved();
timings.mark_auction_committed();
let snapshot = timings.snapshot();
assert_eq!(
snapshot.auction_dispatched_ms, first.auction_dispatched_ms,
"should not restamp the dispatch offset"
);
assert_eq!(
snapshot.auction_resolved_ms, first.auction_resolved_ms,
"should not restamp the resolve offset"
);
assert_eq!(
snapshot.auction_committed_ms, first.auction_committed_ms,
"should not restamp the commit offset"
);

Comment on lines +628 to +629
- The three offsets are null when no auction ran (the common case: assets, EC
endpoints, auction-disabled deployments). Null means "no auction", never "zero".

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 thinking — "Null means no auction" is true for auction_dispatched_ms, but not for the other two.

abandon_hold_auction / emit_abandoned_auction terminate a dispatched auction without ever reaching collect, on stream_read_error, stream_process_error, and processor_init_error. Those requests produce a row with auction_dispatched_ms set and auction_resolved_ms / auction_committed_ms null. Under the current wording an analyst reads those as "no auction ran", which is exactly backwards — an auction ran, cost bid requests, and was thrown away.

That's a useful signal once it's named, so the fix is to document it rather than change behaviour. Prettier-verified, no drift.

Suggested change
- The three offsets are null when no auction ran (the common case: assets, EC
endpoints, auction-disabled deployments). Null means "no auction", never "zero".
- The three offsets are null when nothing reached that milestone. All three are
null when no auction was dispatched (the common case: assets, EC endpoints,
auction-disabled deployments, and `DispatchFailed` / `NotStarted`).
`auction_resolved_ms` and `auction_committed_ms` are _also_ null when a
dispatched auction was abandoned before collect (`stream_read_error`,
`stream_process_error`, `processor_init_error`), so
`auction_dispatched_ms IS NOT NULL AND auction_resolved_ms IS NULL` isolates
abandonment. Null means "did not happen", never "zero".

Comment on lines +654 to +659
Derivations the dashboard can add without schema help: auction duration on the
request clock (`R - D`), commit latency (`C - R`), and overlap ratio (share of
`R - D` that ran concurrently with `ts-origin`). `auction_wait_ms` keeps its
existing meaning (blocked time only) and is now interpretable next to the
timeline: `R - D` minus `auction_wait_ms` approximates how much of the auction
was absorbed by work the request needed anyway.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 thinking — The ladder above this paragraph puts t=H last, which only holds for the buffered path.

time_elapsed_ms maps to headers_ready_total. On the streaming path the collect runs inside a body that has already been handed to the client, so the marks land after the header freeze and the row reads H < D < R < C. The Scope section further down already concedes this ("two of the three are typically unknown at the header freeze point in streaming mode"), but the ladder is the part a dashboard author will copy, and it currently contradicts it. auction_wait_placement is already on the row, so the branch is cheap to express.

Prettier-verified, no drift.

Suggested change
Derivations the dashboard can add without schema help: auction duration on the
request clock (`R - D`), commit latency (`C - R`), and overlap ratio (share of
`R - D` that ran concurrently with `ts-origin`). `auction_wait_ms` keeps its
existing meaning (blocked time only) and is now interpretable next to the
timeline: `R - D` minus `auction_wait_ms` approximates how much of the auction
was absorbed by work the request needed anyway.
Derivations the dashboard can add without schema help: auction duration on the
request clock (`R - D`), commit latency (`C - R`), and overlap ratio (share of
`R - D` that ran concurrently with `ts-origin`). `auction_wait_ms` keeps its
existing meaning (blocked time only) and is now interpretable next to the
timeline: `R - D` minus `auction_wait_ms` approximates how much of the auction
was absorbed by work the request needed anyway.
The ladder above is the buffered ordering. When `auction_wait_placement` is
`in_stream` the collect happens after the header freeze, so the row reads
`H < D < R < C` instead. Any derivation that treats `H` as the last milestone
must branch on `auction_wait_placement`.

Comment on lines +568 to +569
Status: spec amendment for a follow-up PR; not part of the initial implementation
(#1074). Builds only on machinery that spec sections 5, 9, and 10 already define.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick — Status says the implementation is a follow-up PR, but it's in this one (commits 46911a6 and 1fa9f8c). Worth correcting before it merges, since this file is the spec of record.

Prettier-verified, no drift.

Suggested change
Status: spec amendment for a follow-up PR; not part of the initial implementation
(#1074). Builds only on machinery that spec sections 5, 9, and 10 already define.
Status: spec amendment written ahead of implementation, then implemented in the
same PR on top of the initial implementation (#1074). Builds only on machinery
that spec sections 5, 9, and 10 already define.


| Mark | Recorded at | Meaning |
| --------------------------- | --------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| `mark_auction_dispatched()` | immediately before `orchestrator.dispatch_auction` returns control to the caller (`publisher.rs` dispatch site) | bid requests have left the edge |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick — "immediately before orchestrator.dispatch_auction returns control to the caller" reads as if the mark lives inside the orchestrator. It's actually in the caller, at publisher.rs:4356, in the DispatchAuctionOutcome::Dispatched arm after the await returns. The distinction matters for the column's definition: the offset includes the full dispatch round-trip, not the moment the requests were handed off.

Suggested cell text: in the \DispatchAuctionOutcome::Dispatched` arm, immediately after `orchestrator.dispatch_auction` returns (`publisher.rs` dispatch site)`

Apply manually — can't be auto-applied as a suggestion because editing one cell changes the padding Prettier requires for the whole table, so the committed bytes wouldn't match what was verified.

Comment thread .gitignore
# leftover local build artifacts (node_modules, target, dist) that remain on disk.
/crates/js/
/crates/integration-tests/
wrangler.integration.generated.toml

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick — This lands directly under the two-line comment about defunct pre-rename crate dirs, so it reads as a third entry in that block. It's unrelated — it's the Cloudflare integration harness's per-run output (crates/trusted-server-integration-tests/tests/environments/cloudflare.rs:27).

Verified in the batch scratch pass: cargo fmt --all -- --check and the docs Prettier check stay clean, no drift.

Suggested change
wrangler.integration.generated.toml
# Cloudflare integration harness output, written at test time by
# crates/trusted-server-integration-tests/tests/environments/cloudflare.rs.
wrangler.integration.generated.toml

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.

Create eng spec for better server side timing metrics and observability

4 participants