Deterministic backend incident replay system for Django applications.
Project description
incident-replay
incident-replay is a deterministic backend incident capture and replay system for Django applications.
It automatically captures the minimal database, cache, environment, and external API state surrounding failing production requests, generating a portable incident snapshot.
You can then deterministically replay these incidents locally on your machine with a single CLI command!
Features (v0.1.0 MVP)
- Failing Request Capture: Intercepts HTTP 500s or Python unhandled exceptions via standard Django Middleware.
- Minimal Data Extraction Engine: Traces all SQL executed during a bad request, calculates foreign key dependencies automatically via Django models, and saves ONLY the rows accessed (no full database dumps needed!).
- Portable Snapshots: Generates
INC-<ULID>/snapshots containing serialized JSON artifactsrequest.json,query_trace.json,metadata.json, anddb_snapshot.json. - Deterministic CLI Replay: Spin up incidents directly in your local environment. Replay engine initializes an ephemeral SQLite schema automatically, loads the minimal DB snapshot, mocks out UUID generation and Time (WIP), and deterministically crashes with the exact same stack-trace.
Installation
pip install incident-replay
Add to your Django project settings:
INSTALLED_APPS = [
# ...
# Any specific apps...
]
MIDDLEWARE = [
'incident_replay.capture.middleware.IncidentReplayMiddleware',
# ... your other middleware
]
# Local directory where snapshots are placed (S3 integrations planned)
INCIDENT_REPLAY_STORAGE_DIR = "/tmp/incident_snapshots"
Usage
1. Wait for an Incident
When your application throws an internal server error (or if a manual trigger header X-Incident-Trigger: true is sent), incident-replay captures it to your storage backend.
2. List Incidents
incident-replay list
3. Replay locally!
You must set your DJANGO_SETTINGS_MODULE to run the replay engine.
DJANGO_SETTINGS_MODULE=myproject.settings incident-replay run INC-01JEXAMPLEID1234
You will see the identical stack trace error out on your terminal.
Core Principles
- Developer First: Focus on exactly what broke during a single request execution timeline.
- Minimal Data Universe: Extracts rows that matter. No PII leaking across massive table dumps.
- Low Overhead: Uses passive DB cursor tracing
<5%overhead on the critical path. Snapshot serialization only occurs off the critical path or synchronously on failures only.
Phase 2 roadmap includes Redis capture, httpx interception, and background Celery integrations.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file incident_replay-0.1.0.tar.gz.
File metadata
- Download URL: incident_replay-0.1.0.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6eecffd6abf7183e16a19441ab8c5c29aa51e9c4fdc64d8f192445b75028b8f0
|
|
| MD5 |
475bbfe9512f11bba3da961a5f0cb940
|
|
| BLAKE2b-256 |
238821430776e11627a37749e056d3a37d45c20f0fc597e24ac1cbf6f046eb3d
|
File details
Details for the file incident_replay-0.1.0-py3-none-any.whl.
File metadata
- Download URL: incident_replay-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27ff99ff8913ef8068c30abd661d9b0143fb4092979c4fd61fd482bec0e7ecc1
|
|
| MD5 |
bb85c3ef94c38a0790b10dcb9a788700
|
|
| BLAKE2b-256 |
d5cb7f3e24a66ebc087560b8f52d5d03cfa018ce0a467942d0c2425fb452f1b4
|