Repository navigation
feat: add bounded per-worker organization traffic logs - #965
Merged
Merged
Conversation
WorksOnMyVM
marked this pull request as ready for review
October 13, 2026 14:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Adds trusted Org attribution to root call logs so operators can identify traffic/pool spikes within one or two reporting intervals. Covers
/call/,/catalog/call/,/table/, and MCP call/media adapters; unresolved auth logsorg_id: null. Adds the effective limit to guard 429 logs.Main only had Uvicorn transport access logs, which MCP's internal HTTP calls bypass, and no dedicated guard busy log. These are new application-owned lines; Render edge logs are unchanged. No IP/UA, names, emails, keys, payloads, external counters, new settings/endpoints or policy changes.
One process-local timer emits Top 10 every 60s. Arrivals count after caller resolution; statuses/latency count completion after streaming and awaited cleanup. Actual live in-flight survives rollover; internal children and MCP envelopes are not extra roots. Storage is capped at 4,096 orgs with 33 latency buckets each, and overflow is explicit. p95 is a nearest-rank bucket upper bound (up to 2x overestimate).
Synthetic samples:
Combine worker counts over timestamp-aligned windows, then filter request/rejection logs by org. Top-10 truncation makes combined counts lower bounds; summed peaks are upper bounds. Do not add/average p95s; a global p95 requires request durations. Full boundaries/operator notes are documented; composition and org-concurrency fragments/indexes are updated.
How it was tested
.venv/bin/python -m pytest -q tests/test_org_traffic.py tests/test_org_concurrency.py: 81 passed..venv/bin/lint-imports: 15 contracts kept.git diff --checkandbash .agents/skills/tools-registry-context/scripts/drift.shpass.test_org_traffic, guard, error capture, MCP and directory). After updating the intentional middleware composition snapshot: 37 passed (surface snapshots, roles and traffic); route/OpenAPI/lifespan snapshots are unchanged.73a26826821aaceb89dde36537d59036ff911b24: full Python suite, PostgreSQL/Redis regressions, frontend, gitleaks and catalog-date checks. CI run.Branched from main
70058fbaa108eaf6d5452a2dcad6ea58bca9f0eb; #964 (8b0af9bd) verified as an ancestor before edits. No production SQL/traffic/jobs, config changes, deployment, restart or merge.Checklist
uv run --with pytest-xdist pytest -n auto -qlocally (focused/relevant regressions above; full suite and PostgreSQL/Redis run in CI)docs/context/fragments