RFC 0006: Request Logging and Observability
Summary
Add structured access logging to the ingress proxy so every proxied request is logged with method, path, status code, duration, and client info.
Problem
The ingress logs nothing about proxied requests. No access log, no timing, no status codes. Makes debugging very hard — when something goes wrong there’s zero visibility into what requests were made and what happened to them.
Files to Modify
proxy/ingress.py— add logging in thehandle()method
Implementation
- Add Python
logging(orstructlog) setup to ingress - At the start of each request, record
time.monotonic()start time - After the response is sent (or on error), log a structured entry:
method: GET/POST/etcpath: request pathstatus: HTTP status code returnedduration_ms: wall clock time in millisecondsclient_ip: from request.remoteupstream: which runtime/host was targetederror: exception message if one occurred
- Use JSON log format for machine parseability
- Log level: INFO for successful requests, WARNING for 4xx, ERROR for 5xx and exceptions
- Do NOT log request/response bodies (privacy and size)
- Add a configurable log level via environment variable (default INFO)
Testing & Validation Requirements
- Send 5 different requests (GET, POST, 404, 500, timeout) through the ingress
- Verify each appears in the log with correct method, path, status, and duration
- Verify duration is a reasonable number (not 0, not negative)
- Verify JSON format is valid and parseable with
json.loads() - Verify 4xx logs at WARNING level and 5xx at ERROR level
- Verify bodies are NOT present in any log entry
- Verify the log line is emitted AFTER the response is sent (not before)
Report Requirements
- Show the logging code added with line numbers
- Include sample log output for various request types
- Show how to filter logs with
jqorgrepfor common debugging patterns