Skip to content

feat(telemetry): report object-storage bytes per worker attempt (D148) - #535

Merged
fazpu merged 4 commits into
mainfrom
feat/egress-metering
Nov 6, 2026
Merged

fazpu merged 4 commits into
mainfrom
feat/egress-metering

Conversation

@fazpu

@fazpu fazpu commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Relaunch plan phase 2 item (f): egress byte metering per stage (UMC design/plan/relaunch-shared-runtime.md phase 2f). Artifact compression stays deferred and is not built. Builds on #529 and #533 (merged).

What changes

  • rememberstack.core.object_transfer: a per-task byte counter in a ContextVar (object_transfer_scope(), record_object_transfer(), current_object_transfer()).
  • MinIOObjectStore (the S3 adapter, i.e. the networked store) records every object it reads and every write it sends (a put refused because the key exists still uploaded its body, so it counts). The local-filesystem adapter is not counted: no network transfer.
  • Worker.run_claimed opens the scope around each claimed attempt; worker.run events built inside it carry object_bytes_read and object_bytes_written. That is the existing metrics path (the JSON-line worker event, already per stage); per-stage egress is a sum over it. No new table, store or exporter.
  • Not counted: API and setup calls (outside a worker attempt) and calls on helper threads a handler starts itself (today the structure summaries and image-description lanes, which make only model calls).
  • Corpus: D148; orchestration §7 lists the attributes. Docs: observability page.

Tests

  • test_minio_store.py: reads and attempted writes add to the open scope; nothing is kept outside a scope.
  • test_telemetry.py: a handler that reads 5 bytes and writes 3 through the S3 store produces a worker.run event with object_bytes_read=5, object_bytes_written=3.

Rule 4 (D56)

No ingestion keyed input or reuse identity changes; telemetry only.

🤖 Generated with Claude Code

https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm

@fazpu
fazpu force-pushed the feat/stage-class-worker branch from fdde26c to 0936e16 Compare November 6, 2026 17:27
fazpu added a commit that referenced this pull request Nov 6, 2026
… D146

Address Codex round 1 minors on #535 and renumber after the library-seams
decision moved to D147.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm
@fazpu
fazpu force-pushed the feat/egress-metering branch from 62001d3 to ad521fc Compare November 6, 2026 17:30
@fazpu

fazpu commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

Codex review round 1 (gpt-6.1-sol, max)

VERDICT: APPROVE

No blocker or major findings in git diff origin/feat/stage-class-worker...HEAD.

  • Minor — count writes after key validation. minio.py:181 increments before _validated_key(). A rejected ../invalid key recorded six written bytes despite zero PUTs. Simplest fix: validate the key first, then increment immediately before calling put_object.
  • Minor — reconcile §7’s introduction. orchestration_design.md:304 adds telemetry-only counters, while the introduction says everything below derives from existing tables. Change that wording to “existing tables and telemetry.”

The ContextVar scope isolates concurrent attempts and remains active through success, retry, dead-letter, no-route, and lease-lost events. Import boundaries hold; same-PR public docs are updated. Rule 4 reuse identities and paid-work behavior are unaffected.

Validation passed: 10 focused tests, lint, formatting, type checks, all five import contracts, and in-memory probes covering nine outcome paths and four concurrent attempt threads. No Postgres used; checkout unchanged.

Dispositions (ad521fc)

  • Write counted before key validation — fixed: the key is validated first, then the bytes are counted just before put_object.
  • §7 introduction — fixed: it now says the view derives from existing tables or the existing worker.run event.
  • Renumbered: after docs: renumber the library-seams decision D144 → D147 #534 moved library seams to D147, this decision is D146.

@fazpu fazpu changed the title feat(telemetry): report object-storage bytes per worker attempt (D147) feat(telemetry): report object-storage bytes per worker attempt (D146) Nov 6, 2026
@fazpu
fazpu force-pushed the feat/stage-class-worker branch 2 times, most recently from 80b1f30 to f3f1a32 Compare November 6, 2026 18:26
fazpu added a commit that referenced this pull request Nov 6, 2026
… D146

Address Codex round 1 minors on #535 and renumber after the library-seams
decision moved to D147.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm
@fazpu
fazpu force-pushed the feat/egress-metering branch from ad521fc to ce13ad8 Compare November 6, 2026 18:27
@fazpu fazpu changed the title feat(telemetry): report object-storage bytes per worker attempt (D146) feat(telemetry): report object-storage bytes per worker attempt (D148) Nov 6, 2026
@fazpu
fazpu force-pushed the feat/stage-class-worker branch from f3f1a32 to 7ff63bb Compare November 6, 2026 21:08
fazpu and others added 4 commits November 6, 2026 22:26
The S3 object-store adapter adds every object it reads and every write it
sends to a per-task counter that Worker.run_claimed opens around each
claimed attempt; the attempt's worker.run event carries
object_bytes_read and object_bytes_written, so storage egress is summed
per stage from existing telemetry. No new store or exporter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm
… D147

Renumber the egress decision to D147 after the stack rebase and prove the
worker.run event reports the bytes a handler read and wrote through the S3
store.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm
… D146

Address Codex round 1 minors on #535 and renumber after the library-seams
decision moved to D147.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm
@fazpu
fazpu force-pushed the feat/egress-metering branch from ce13ad8 to 3eb229f Compare November 6, 2026 21:27
@fazpu
fazpu changed the base branch from feat/stage-class-worker to main November 6, 2026 21:27
@fazpu
fazpu marked this pull request as ready for review November 6, 2026 21:27
@fazpu

fazpu commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

#529 and #533 merged; rebased onto main with no conflicts, base retargeted to main. Codex round 1 was APPROVE; its two minors are fixed in this branch.

@fazpu
fazpu merged commit 4e9a685 into main Nov 6, 2026
28 of 30 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