Repository navigation
observability: record audit trace spans for classroom requests - #38
Merged
Merged
Conversation
Make classroom a campus audit trace producer (campus#816 item 2, #37): with AUDIT_TRACING_ENABLED=1 and AUDIT_API_KEY set, classroom requests are recorded as spans in the audit service, and campus SDK calls made while handling a request carry trace context and land as child spans — the audit waterfall then shows which classroom route fired each campus call. - Opt-in via AUDIT_TRACING_ENABLED (default off; read once at app creation, flip = redeploy). Producer key recipe: campus docs/audit-tracing.md. Ingestion is async and fail-safe. - Dependency shape (the open decision in #37): resolved — no extraction needed; classroom already depends on campus-suite and the middleware ships in it. Documented on campus#816. SDK call propagation itself lands with campus-api-python#93; classroom picks it up via the campus-api-python lock bump once that PR merges.
- campus-api-python -> dd84fc7: SDK trace-context propagation (#93) — SDK calls made while handling a traced classroom request carry X-Request-ID / X-Parent-Span-ID and land as child audit spans. - campus-suite -> de7ec3c (weekly 2026-10-05): current middleware with producer-side span secret redaction (#805) and journey tagging (#803) — required before classroom starts ingesting spans.
Closed
3 tasks
This was referenced Oct 5, 2026
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.
Parent: nyjc-computing/campus#816 (item 2 — client apps as trace producers). Refs #37.
What
Make classroom a campus audit trace producer: when
AUDIT_TRACING_ENABLED=1, the app factory wirescampus.audit.middleware.init_appinto the Flask app, so every classroom request is recorded as a span in the audit service.Combined with SDK trace propagation (nyjc-computing/campus-api-python#93), campus SDK calls made while handling a classroom request carry
X-Request-ID/X-Parent-Span-IDand land as child spans — the audit waterfall then answers which classroom route fired each campus call, in what order (the duplicateGET /auth/v1/sessions/...question in campus#816).Decisions (the open questions in #37)
campus-suite(pyproject, branch weekly) and the middleware ships in it, so wiring is imports + config only. Flagged on campus#816; extraction into a shared package stays a non-goal unless the contract grows (W3Ctraceparent).AUDIT_TRACING_ENABLED=1+AUDIT_API_KEY=<producer key>), default off — a client app shouldn't ingest spans without an explicit key. Read once at app creation: flipping the flag is a redeploy, not a runtime change (same semantics as the campus services' gate). Dev deployment only for now; staging/prod get it when they exist.Verification
start_span/end_spanwith the flag set;X-Request-IDechoed on responses; flag unset → no hooks (kill-switch path); cross-repo contract check — the middleware'sflask.gstash read by the newcampus_python.tracingproduces both headers.AUDIT_TRACING_ENABLED=0.Notes
poetry.lockbump for the SDK propagation commit lands as a follow-up commit on this branch once campus-api-python#93 merges (git dep pinned by lock).flask.g.user→ spanuser_id) — needs a small stash inflask_campus.OAuthLoginManager(campus repo).