Module 09 Activity
Scenario
The chain is correct and takes seconds. This is about what the person waiting sees, and what your logs collect while they wait.
What you build
A streamed response with both latency numbers measured, a safe broken-stream path, and logging that redacts on the way in.
Steps
- Switch to
streamand accumulate the chunks rather than calling twice. - Measure time to first chunk and time to completion separately, and report p50 and p95 for both.
- Attach a callback that records timings and token counts. Confirm it changes nothing about the result.
- Simulate a stream failing midway. Mark the partial content incomplete, do not persist it, and retry the whole request.
- Redact structured identifiers on the way into your logs, and keep the debugging metadata in full.
- State plainly what your redaction does not catch.
Evidence to hand in
- The streamed output and the accumulated value.
- Both latency numbers at p50 and p95.
- The callback and evidence it does not alter results.
- The broken-stream handling.
- A redacted log line beside the raw content.
- What redaction misses.
Review checklist
- Chunks are accumulated, not fetched twice.
- Time to first chunk is measured and is the user-facing budget.
- The callback only observes.
- Partial content is marked incomplete and not persisted.
- Redaction happens before writing, and its limits are stated.
