Skip to content

[AISAGE-781] perf: bypass the staging usage writer relay - #8911

Merged
johnnyeric merged 1 commit into
mainfrom
johnnyeric/staging-usage-relay-bypass
Oct 26, 2026
Merged

johnnyeric merged 1 commit into
mainfrom
johnnyeric/staging-usage-relay-bypass

Conversation

@johnnyeric

Copy link
Copy Markdown
Contributor

Staging queued usage writes currently traverse a private Frankfurt relay before reaching the Vercel writer. Remove the staging USAGE_WRITER_RELAY binding so the existing writer client calls the same https://staging-app.kilo.ai/api/internal/usage/record endpoint directly for a controlled latency comparison.

Keep the single EU source/DLQ, batch 2, parallelism 2, cap 200 (at most 400 writer calls), retry policy and diagnostics unchanged. Production effective configuration is identical. Retain relay code/config/tests and its deployed resource; revert this change and redeploy staging to restore the binding. Both existing CI paths skip relay deployment when unbound and retain EU preparation/consumer uploads.

Validation: 157 service tests across 12 files, 17 queue-preparation tests, nine deployment-workflow tests; typecheck, lint, generated types check, formatting and diff check; local staging/production dry runs. Actual local workerd/Queue/loopback HTTP tests cover the normal direct route and explicitly bound relay route, including ACK/retry behavior. Actual config checks prove production equality and both CI detection outputs. No hosted deployment, measurements or latency improvement claimed.

AISAGE-781

@johnnyeric
johnnyeric marked this pull request as ready for review October 26, 2026 13:06
@johnnyeric
johnnyeric added this pull request to the merge queue Oct 26, 2026
@kilo-code-bot

kilo-code-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Assumptions: [INFERENCE] Tests were not executed in this read-only sandbox (dependencies are not installed); test-harness behavior was reviewed from source only.

Files Reviewed (9 files)
  • services/usage-ingest/README.md
  • services/usage-ingest/diagnostics.md
  • services/usage-ingest/eu-queues.md
  • services/usage-ingest/src/consume-usage.runtime.test.ts
  • services/usage-ingest/src/index.runtime.test.ts
  • services/usage-ingest/src/publish-usage.ts
  • services/usage-ingest/src/writer-relay.runtime.test.ts
  • services/usage-ingest/worker-configuration.d.ts
  • services/usage-ingest/wrangler.jsonc

Reviewed by deepseek-flash-latest · Input: 75.6K · Output: 15.1K · Cached: 1.6M

Review guidance: REVIEW.md from base branch main

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.

2 participants