monitor.server

MonitorServer — FastAPI web server for the otto monitoring dashboard.

Endpoints

GET / Serves dashboard.html GET /static/… Serves static assets (plotly.min.js, etc.) GET /api/meta JSON metadata (host name, metric labels, units) GET /api/data JSON snapshot of all metric series and events GET /api/stream SSE stream — pushes metric updates and events in real time POST /api/event Record a manual event from the dashboard UI

class otto.monitor.server.SuppressASGIWarning(name='')

Bases: Filter

filter(record)

Determine if the specified record is to be logged.

Returns True if the record should be logged, or False otherwise. If deemed appropriate, the record may be modified in-place.

class otto.monitor.server.MonitorServer(collector, host='0.0.0.0', port=0)

Bases: object

Wraps a FastAPI/uvicorn server for the monitoring dashboard.

Call await serve() from an async context to run the server. Call stop() from any thread to trigger a graceful shutdown.

property url : str

Primary URL using the first detected non-loopback IP (or the bind address).

property urls : list[str]

All URLs the server is reachable on (one per non-loopback interface).

property started : bool

True once the server is ready to accept connections.

async serve()

Run the web server until stop() is called or the process exits.

Return type:

None

stop()

Signal the server to shut down (thread-safe).

Return type:

None