reader
reader
¶
Data reader for the Marianne Monitor TUI.
Provides MonitorReader which reads system snapshots and process events
from multiple data sources (IPC, SQLite, JSONL) for display in mzt top.
The reader auto-detects the best available data source: 1. IPC (DaemonClient) — live data from the running conductor 2. SQLite (MonitorStorage) — historical data from the profiler database 3. JSONL tail — streaming fallback when neither IPC nor SQLite available
Classes¶
MonitorReader
¶
Reads profiler data for display in the TUI.
Supports three data sources, tried in priority order:
- IPC — queries the running daemon via
DaemonClient - SQLite — reads directly from
MonitorStorage - JSONL — tails the NDJSON streaming log
Parameters¶
storage:
Optional MonitorStorage instance for SQLite reads.
jsonl_path:
Path to the JSONL streaming file.
ipc_client:
Optional DaemonClient for live daemon queries.
Source code in src/marianne/tui/reader.py
Attributes¶
Functions¶
get_latest_snapshot
async
¶
Get the most recent system snapshot.
Returns None if no data is available from any source.
Source code in src/marianne/tui/reader.py
get_snapshots
async
¶
Get snapshots since the given unix timestamp.
Source code in src/marianne/tui/reader.py
get_events
async
¶
Get process lifecycle events since the given unix timestamp.
Source code in src/marianne/tui/reader.py
get_observer_events
async
¶
Get recent observer events via IPC.
Returns observer events (file and process activity) from the ObserverRecorder's in-memory ring buffer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_id
|
str | None
|
Specific job ID, or None for all jobs. |
None
|
limit
|
int
|
Maximum number of events to return. |
50
|
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List of observer event dicts, newest first. Empty if no |
list[dict[str, Any]]
|
IPC client or on error. |
Source code in src/marianne/tui/reader.py
stream_events
async
¶
Yield EventBus events as they arrive from the daemon via IPC.
Source code in src/marianne/tui/reader.py
stream_snapshots
async
¶
Yield snapshots as they become available.
For JSONL: tails the file, parsing new lines as they appear. For IPC: polls the daemon at a regular interval. For SQLite: polls the database at a regular interval.