The write-ahead log is currently opt-in. It will be enabled by default in a future release.
Enable the write-ahead log
Set theWEAVE_ENABLE_WAL environment variable to true:
weave.init():
How it works
When the WAL is enabled:- Each call to the Weave API (object creates, call starts, call ends, and so on) is appended to a JSONL file on disk instead of being held only in memory.
- Each process writes to its own log file, so parallel processes do not conflict.
- A background sender reads the log files and flushes their contents to the Weave server.
- After the data is successfully sent, the log file is removed.
.weave/wal/ within your working directory, organized by entity and project. Each file contains the raw API requests as JSON objects, one per line.
When the client starts, it checks for existing log files from previous runs. If any are found, the sender flushes them along with any new data. This means data written by a process that crashed is recovered automatically the next time the client runs.
Environment variables
| Variable | Type | Default | Description |
|---|---|---|---|
WEAVE_ENABLE_WAL | bool | false | Enable the write-ahead log. When set to true, API requests are persisted to disk before being sent to the server. |
WEAVE_DISABLE_WAL_SENDER | bool | false | Disable the WAL sender. When set to true, requests are written to disk but not flushed to the server. Useful for debugging. |
When to use the write-ahead log
The WAL is especially useful in environments where processes may be interrupted or the server may be temporarily unavailable:- Container orchestration: Pods that may be evicted or OOM-killed before background threads finish uploading traces.
- Distributed training: Multiple processes writing traces in parallel, where any single process may fail.
- Unreliable networks: Environments where connectivity to the Weave server is intermittent.
- Batch jobs: Long-running jobs where losing trace data from a crash would be costly.
weave.flush() or weave.finish() before the process exits to ensure all data is uploaded. See Trace data loss in worker processes for more information.