Overview
Scribe provides comprehensive debugging tools across all layers:- Logfire for distributed tracing and LLM call inspection
- FastAPI /docs for interactive API testing
- Celery Flower for task queue monitoring
- Python debugger for breakpoint debugging
Logfire Observability
Logfire provides real-time distributed tracing with automatic pydantic-ai instrumentation.Viewing Traces
Access Logfire Dashboard
Visit logfire.pydantic.dev and sign in.
Example Trace Structure
Custom Logging in Code
Add structured logging to your code:Filtering Logs
FastAPI Interactive Docs
FastAPI automatically generates interactive API documentation.Accessing /docs
Open in Browser
Navigate to: http://localhost:8000/docs
Testing Protected Endpoints
Example: Testing Email Generation
Celery Task Debugging
Flower Dashboard
Flower provides a web UI for monitoring Celery workers and tasks.- Active tasks and worker status
- Task history with timing
- Failed task inspection with tracebacks
- Worker pool configuration
- Broker (Redis) statistics
Inspecting Task State
Worker Logs
Task Stuck in PENDING
If tasks remain PENDING indefinitely:Python Debugger
Using Breakpoints
VS Code Debugger
Create.vscode/launch.json:
Database Debugging
Enable SQL Logging
Inspect Queries
Check Connection Status
Common Issues & Solutions
Redis Connection Error
Redis Connection Error
Symptom:Solution:
Playwright Browser Error
Playwright Browser Error
Symptom:Solution:
Module Import Errors
Module Import Errors
Symptom:Solution:
Task Stuck in PENDING
Task Stuck in PENDING
Symptom:
Task never transitions from PENDING state.Solution:
Database Connection Timeout
Database Connection Timeout
Symptom:Solution:
LLM API Rate Limit
LLM API Rate Limit
Symptom:Solution:
- Celery worker already runs with
concurrency=1to prevent this - Check your Anthropic dashboard for rate limits
- Consider switching to Fireworks AI (higher limits)
- Add retry logic with exponential backoff
Performance Profiling
Timing Pipeline Steps
Pipeline automatically records step timings:Memory Profiling
Database Query Profiling
Next Steps
Testing Guide
Learn how to write comprehensive tests
Project Structure
Understand the codebase organization
Pipeline Deep Dive
Explore the 4-step email generation pipeline
Deployment
Deploy to production (Raspberry Pi + Cloudflare)
