audit: logging escape hatch — let student devs inject info/debug messages into traces
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Active
- Domain
- observability
Research direction
Start with src/campus/audit/middleware/tracing.py and trace how RequestWarningCollector stores data in flask.g before build_span_from_context builds a span. The issue offers several possible APIs and capture policies but leaves the design open. Done means agreeing on the API and scope, then adding focused tests for annotations or opt-in INFO/DEBUG capture and verifying the resulting span data.
Written by the indexing model from the issue text.
Description
Part of the audit-middleware reorg (#TBD — will cross-link once filed). Design input from the 2026-11-19 session.
Problem
Student devs have no deliberate way to write into the audit trace:
logger.warning/error/exceptionduring a request are captured passively (RequestWarningCollector, flask-campus#26 →tags.warnings, capped 10 records × 500 chars, redacted, tracebacks stripped in prod).logger.info/logger.debugare dropped — the collector hard-filterslevelno < WARNING(src/campus/audit/middleware/tracing.py).- No annotation API: no way to attach a custom tag to the current span, no way to set
error_message(schema field exists, alwaysNonetoday), no structured event emission from consumers.
Exception capture (confirmed, with caveats)
Unhandled exceptions in a view surface as a span with status_code=500; werkzeug logs them at ERROR via the root logger, so the formatted message rides tags.warnings. Caveats: error_message stays None, prod tracebacks are stripped, and a request emitting >10 warning-level records loses the tail (silent cap).
Proposed direction (to design here)
New module home after the reorg: campus.flask_campus.audit. Candidate surface:
audit.annotate(message, *, level="info")/audit.span_tag(**tags)— stash intoflask.gfor the span builder to pick up (the g-stash → build_span_from_context pipeline already exists;tags.warningsuses exactly this path).- Optional INFO/DEBUG capture: per-app opt-in flag on
init_tracing(app, capture_info=...)or per-view via@journey— default stays WARNING+ to avoid payload bloat (chatty views already need the 10-record cap). - Consider actually populating
error_messagefor 4xx/5xx spans (schema field is dead today).
Non-goals: not a general metrics API; no new network calls — everything rides the existing span ingest.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 9m
- Merged PRs (30d)
- 40
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nyjc-computing/flask-campus
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
nyjc-computing/flask-campus#46 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 58/100
nyjc-computing/flask-campus#44 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 38/100
nyjc-computing/flask-campus#43 ·
Maintainers usually reply within 1 day
All issues in nyjc-computing/flask-campus
Similar issues
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
kornia/kornia-rs#1416 · 1 comment ·
Maintainers usually reply within 2 days
-
ui
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
PolicyEngine/ai-inequality#64 ·
Maintainers usually reply within 1 day
-
LinearGaussianStateSpace.dist splits states and observations wrongly when the transition varies over timePossibly taken @PabloRoque claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
pymc-devs/pymc-extras#839 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day