Book 4 · Lesson 4.7

Consumer writes to Postgres

  • Trace persist_event after Kafka recv
  • Verify rows with psql
  • Call GET /api/metrics/summary

Prerequisites: 4.6

curl POST:8081/webhooks/hello → ingestion
Kafkaraw-dev-events (ingestion) → enriched-dev-events (llm Stage 3)
Consumeranalyzer run_consumer recv()
PostgresINSERT team_events ON CONFLICT DO UPDATE
QueryGET :8082/api/metrics/summary

Lab commands

cargo run -p millipede-analyzer    # terminal 1
cargo run -p millipede-ingestion   # terminal 2
curl -X POST http://localhost:8081/webhooks/hello \
  -H 'Content-Type: application/json' \
  -d '{"action":"opened","source":"github"}'
psql postgres://millipede:millipede@localhost:5432/team_radar \
  -c "SELECT id, source FROM team_events ORDER BY created_at DESC LIMIT 3;"

Teach-back prompt

At which step is the HTTP client done waiting?

Webhook to Postgres

Lesson 4.7 check

1. Metrics API is served by…