monitor
monitor
¶
SSE endpoint for real-time system monitor snapshots.
Streams SystemSnapshot NDJSON events from the profiler's JSONL file or
SQLite storage to connected dashboard clients. Each event is a complete
SystemSnapshot serialized as JSON — the same format produced by
mzt top --json.
Functions¶
get_monitor_storage
async
¶
Get or create a cached MonitorStorage instance.
Returns an initialized MonitorStorage that can be reused across requests instead of creating a new instance per call.
Source code in src/marianne/dashboard/routes/monitor.py
stream_monitor
async
¶
stream_monitor(source=Query(default='auto', description="Data source: 'daemon', 'jsonl', 'sqlite', or 'auto' (tries daemon, then jsonl, then sqlite)"), poll_interval=Query(default=1.0, ge=0.5, le=30.0, description='Poll interval in seconds'))
Stream real-time system monitor snapshots via Server-Sent Events.
Each event contains a complete SystemSnapshot as JSON — the same
format used by mzt top --json.
Source selection:
auto(default): Uses daemon IPC if configured, then JSONL, then SQLite.daemon: PollsDaemonSystemViewvia IPC.jsonl: Tails~/.marianne/monitor.jsonldirectly.sqlite: Polls~/.marianne/monitor.dbfor recent snapshots.
Returns:
| Type | Description |
|---|---|
StreamingResponse
|
SSE stream of |
StreamingResponse
|
events to keep the connection alive. |
Source code in src/marianne/dashboard/routes/monitor.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | |
get_latest_snapshot
async
¶
Get the most recent system snapshot (one-shot, not streaming).
When DaemonSystemView is configured, fetches a live snapshot via
IPC. Falls back to reading monitor.db when the daemon service
layer isn't wired.